diff --git a/config/blobs.yml b/config/blobs.yml index 4822027b3..e34b5a1ad 100644 --- a/config/blobs.yml +++ b/config/blobs.yml @@ -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 diff --git a/jobs/pxc-mysql/templates/my.cnf.erb b/jobs/pxc-mysql/templates/my.cnf.erb index 8d1119d57..20ac5656f 100644 --- a/jobs/pxc-mysql/templates/my.cnf.erb +++ b/jobs/pxc-mysql/templates/my.cnf.erb @@ -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 @@ -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 @@ -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 -%> diff --git a/spec/pxc-mysql/mycnf_spec.rb b/spec/pxc-mysql/mycnf_spec.rb index 6d8a4dd07..67f1fca0e 100644 --- a/spec/pxc-mysql/mycnf_spec.rb +++ b/spec/pxc-mysql/mycnf_spec.rb @@ -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 @@ -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" @@ -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")