Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions config/blobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ Percona-XtraDB-Cluster-8.0.46-38.tar.gz:
size: 529960552
object_id: f2fcfd15-4847-4cb9-4cc5-7a28b445e95a
sha: sha256:759250a166681eb4d2025a1c8c68ce9bc483fbd982ec4b061b1bcf07d3e2fff9
Percona-XtraDB-Cluster-8.4.10-10-fix116741.tar.gz:
size: 507207675
object_id: a3cf39cd-c685-45a8-5ff4-a459e2af4502
sha: sha256:362e0ad02bfac2e629f2b10d8cacbc0b17d112212076b35047405e175b9829bc
Percona-XtraDB-Cluster-8.4.11-11.tar.gz:
size: 507646744
object_id: 690c4f7a-55a7-4320-5f9f-5345e0d50d33
sha: sha256:a0e20c13a3a0da0ec2b60e5b589214a63e2efa94a5c5d96ee5f8db15ad7ff4a9
boost_1_77_0.tar.bz2:
size: 110361537
object_id: d962752f-1ab7-4896-41d9-8deed29397ca
Expand Down
20 changes: 18 additions & 2 deletions jobs/pxc-mysql/templates/my.cnf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,21 @@ ssl_key=/var/vcap/jobs/pxc-mysql/certificates/server-key.pem
require_secure_transport = ON
<%- end -%>

<%- if p('engine_config.galera.enabled') -%>
<%- if p('engine_config.galera.enabled')
wsrep_provider_options = {
"gcache.size" => "#{p('engine_config.galera.gcache_size')}M",
"pc.recovery" => "FALSE",
"pc.checksum" => "TRUE",
"socket.ssl" => "yes",
"socket.ssl_ca" => "/var/vcap/jobs/pxc-mysql/certificates/galera-ca.pem",
"socket.ssl_cert" => "/var/vcap/jobs/pxc-mysql/certificates/galera-cert.pem",
"socket.ssl_key" => "/var/vcap/jobs/pxc-mysql/certificates/galera-key.pem",
"socket.ssl_cipher" => "ECDHE-RSA-AES256-GCM-SHA384"
}
if p('mysql_version') == '8.4'
wsrep_provider_options["repl.force_sst_after_inconsistency"] = "TRUE"
end
-%>
# GALERA options:
pxc_strict_mode = MASTER
pxc_maint_transition_period = 0
Expand All @@ -87,7 +101,7 @@ wsrep_node_address = <%= spec.ip %>:<%= p('engine_config.galera.por
wsrep_node_name = <%= name %>/<%= index %>
wsrep_on = ON
wsrep_provider = /var/vcap/packages/percona-xtradb-cluster-<%= p('mysql_version') %>/lib/libgalera_smm.so
wsrep_provider_options = "gcache.size=<%= p('engine_config.galera.gcache_size') %>M;pc.recovery=FALSE;pc.checksum=TRUE;socket.ssl=yes;socket.ssl_ca=/var/vcap/jobs/pxc-mysql/certificates/galera-ca.pem;socket.ssl_cert=/var/vcap/jobs/pxc-mysql/certificates/galera-cert.pem;socket.ssl_key=/var/vcap/jobs/pxc-mysql/certificates/galera-key.pem;socket.ssl_cipher=ECDHE-RSA-AES256-GCM-SHA384"
wsrep_provider_options = "<%= wsrep_provider_options.map { |k, v| "#{k}=#{v}" }.join(";") %>"
wsrep_replicate_myisam = OFF
wsrep_sst_method = xtrabackup-v2
pxc_encrypt_cluster_traffic = OFF
Expand Down Expand Up @@ -195,6 +209,8 @@ jemalloc_profiling = ON
[<%= section = 'mysqld-8.4' %>]
<%# Re-enable mysql_native_password authentication plugin in MySQL v8.4 for backwards compatibility %>
mysql_native_password = ON
# Avoid eagerly populating the entire buffer pool at startup in memory-constrained environments.
innodb_buffer_pool_populate = OFF
<%- additional_entries.extract_section(section).each do |key, value| -%>
<%= key %> = <%= value %>
<%- end -%>
Expand Down
61 changes: 61 additions & 0 deletions spec/pxc-mysql/mycnf_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,16 @@
end
}

it 'disables buffer pool populate on startup for mysql 8.4' do
expect(parsed_mycnf).to include("mysqld-8.4" => hash_including(
"innodb_buffer_pool_populate" => "OFF",
))
%w[mysqld mysqld-8.0].each do |section|
expect(parsed_mycnf[section]).not_to have_key("innodb_buffer_pool_populate")
expect(parsed_mycnf[section]).not_to have_key("innodb-buffer-pool-populate")
end
end

it 'sets the authentication policy to what is provided in the job spec' do
expect(parsed_mycnf).to include("mysqld" => hash_including("authentication_policy" => "caching_sha2_password"))
end
Expand Down Expand Up @@ -154,6 +164,10 @@
}
} }

it 'does not configure wsrep provider options' do
expect(parsed_mycnf["mysqld"]).not_to have_key("wsrep_provider_options")
end

context 'read_write_permissions' do
it 'configures the super-read-only option if read_write_permissions specified as "super_read_only"' do
spec["engine_config"]["read_write_permissions"] = "super_read_only"
Expand Down Expand Up @@ -209,6 +223,53 @@
}
} }

context 'wsrep provider options' do
let(:wsrep_provider_options) do
raw_options = parsed_mycnf.dig('mysqld', 'wsrep_provider_options') || ''
raw_options.delete('"').split(';').to_h { |opt| opt.split('=', 2) }
end

let(:default_wsrep_options) do
{
"gcache.size" => "512M",
"pc.recovery" => "FALSE",
"pc.checksum" => "TRUE",
"socket.ssl" => "yes",
"socket.ssl_ca" => "/var/vcap/jobs/pxc-mysql/certificates/galera-ca.pem",
"socket.ssl_cert" => "/var/vcap/jobs/pxc-mysql/certificates/galera-cert.pem",
"socket.ssl_key" => "/var/vcap/jobs/pxc-mysql/certificates/galera-key.pem",
"socket.ssl_cipher" => "ECDHE-RSA-AES256-GCM-SHA384"
}
end

it 'includes standard default options' do
expect(wsrep_provider_options).to include(default_wsrep_options)
end

context 'when engine_config.galera.gcache_size is specified in MiB' do
before { spec["engine_config"]["galera"]["gcache_size"] = "2048" }
it 'sets a non-default gcache size' do
expect(wsrep_provider_options).to include("gcache.size" => "2048M")
end
end

context 'when mysql_version is 8.0' do
before { spec["mysql_version"] = "8.0" }

it 'does not include the force_sst_after_inconsistency option' do
expect(wsrep_provider_options).not_to have_key("repl.force_sst_after_inconsistency")
end
end

context 'when mysql_version is 8.4' do
before { spec["mysql_version"] = "8.4" }

it 'forces SST after inconsistency' do
expect(wsrep_provider_options).to include("repl.force_sst_after_inconsistency" => "TRUE")
end
end
end

context 'when audit logs are disabled (default)' do
it 'has no audit log format' do
expect(rendered_template).not_to include("audit_log_format")
Expand Down
Loading