From d12c286bd6d9ccf0de7890076cf9620ab24e4913 Mon Sep 17 00:00:00 2001 From: Frank Wall Date: Thu, 8 Aug 2024 23:01:27 +0200 Subject: [PATCH] assorted fixes for Percona XtraDB 8.0 --- CHANGELOG.md | 6 ++++++ data/Debian-family.yaml | 6 ++++++ data/RedHat-family.yaml | 8 +++++++- data/common.yaml | 22 +++++++++++++++++++++- manifests/init.pp | 19 ++++++++++++------- spec/acceptance/galera_spec.rb | 4 +++- 6 files changed, 55 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0632cfe..e5f107a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,15 +13,21 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. * Add support for new operating systems ### Changed +* Disable option `pxc-encrypt-cluster-traffic` on Percona XtraDB 8.0 * Change default version of Codership/MySQL to 8.0 * Change default version of MariaDB to 10.11 * Change default version of Percona XtraDB to 8.0 * Enable systemd-based status check on RHEL 9, Debian 12 and Ubuntu 24.04 ([#191]) * Add new dependency for systemd-based status check ([#191]) +* Merge internal $default_options from multiple hierarchy levels * Extend unit tests ([#191]) ### Fixed +* SST package install fails because repo is not yet configured * Fix Percona XtraDB 8.0 package name on Debian/Ubuntu +* Fix Percona XtraDB 8.0 bootstrap command +* Fix Percona XtraDB `my.cnf` location on RHEL-based systems +* Percona XtraDB 8.0 no longer supports option `wsrep_sst_auth` ## [3.2.1] - 2024-03-13 diff --git a/data/Debian-family.yaml b/data/Debian-family.yaml index f641a3d..816e0b1 100644 --- a/data/Debian-family.yaml +++ b/data/Debian-family.yaml @@ -124,6 +124,12 @@ galera::percona::57::galera_package_name: 'percona-xtradb-cluster-galera-3.x' galera::percona::57::mysql_package_name: 'percona-xtradb-cluster-server-5.7' galera::percona::80::arbitrator_package_name: 'percona-xtradb-cluster-garbd' +galera::percona::80::bootstrap_command: > + sed -i 's@ExecStart=/usr/sbin/mysqld@ExecStart=/usr/sbin/mysqld --wsrep-new-cluster@' /usr/lib/systemd/system/mysql.service; + systemctl daemon-reload; + systemctl start mysqld; + sed -i 's@ExecStart=/usr/sbin/mysqld --wsrep-new-cluster@ExecStart=/usr/sbin/mysqld@' /usr/lib/systemd/system/mysql.service; + systemctl daemon-reload galera::percona::80::client_package_name: 'percona-xtradb-cluster-client' # In XtraDB Cluster 8.0 there is no "galera" package anymore. galera::percona::80::galera_package_name: 'percona-xtradb-cluster-galera' diff --git a/data/RedHat-family.yaml b/data/RedHat-family.yaml index f81fc3f..9395edc 100644 --- a/data/RedHat-family.yaml +++ b/data/RedHat-family.yaml @@ -148,7 +148,12 @@ galera::percona::57::mysql_package_name: 'Percona-XtraDB-Cluster-57' galera::percona::80::additional_packages: - 'nmap' galera::percona::80::arbitrator_package_name: 'percona-xtradb-cluster-garbd' -galera::percona::80::bootstrap_command: 'systemctl start mysql@bootstrap.service' +galera::percona::80::bootstrap_command: > + sed -i 's@ExecStart=/usr/sbin/mysqld@ExecStart=/usr/sbin/mysqld --wsrep-new-cluster@' /usr/lib/systemd/system/mysql.service; + systemctl daemon-reload; + systemctl start mysqld; + sed -i 's@ExecStart=/usr/sbin/mysqld --wsrep-new-cluster@ExecStart=/usr/sbin/mysqld@' /usr/lib/systemd/system/mysql.service; + systemctl daemon-reload galera::percona::80::client_package_name: 'percona-xtradb-cluster-client' # In XtraDB Cluster 8.0 there is no "galera" package anymore. galera::percona::80::galera_package_name: 'percona-xtradb-cluster-galera' @@ -163,6 +168,7 @@ galera::percona::arbitrator_config_file: '/etc/sysconfig/garb' galera::percona::arbitrator_package_name: 'Percona-XtraDB-Cluster-garbd-3' galera::percona::arbitrator_service_name: 'garb' galera::percona::bootstrap_command: 'systemctl start mysql@bootstrap.service' +galera::percona::config_file: '/etc/my.cnf' galera::percona::default_options: mysqld: log-error: '/var/log/mysqld.log' diff --git a/data/common.yaml b/data/common.yaml index 358ba4a..e1f5498 100644 --- a/data/common.yaml +++ b/data/common.yaml @@ -22,7 +22,6 @@ galera::default_options: wsrep_node_incoming_address: "<%= $local_ip %>" wsrep_on: 'ON' wsrep_provider: "<%= $params['libgalera_location'] %>" - wsrep_sst_auth: "\"<%= $wsrep_sst_auth_real %>\"" wsrep_sst_method: "<%= $wsrep_sst_method %>" wsrep_sst_receive_address: "<%= $local_ip %>" galera::epel_needed: false @@ -95,11 +94,32 @@ galera::percona::additional_packages: galera::mariadb::additional_packages: - 'nmap' +galera::codership::default_options: + mysqld: + wsrep_sst_auth: "\"<%= $wsrep_sst_auth_real %>\"" galera::codership::default_version: '8.0' galera::codership::galera_package_ensure: 'present' + +# Percona XtraDB removed support for wsrep_sst_auth in version 8.0, +# hence it should only be configured in older versions. +galera::percona::56::default_options: + mysqld: + wsrep_sst_auth: "\"<%= $wsrep_sst_auth_real %>\"" +galera::percona::57::default_options: + mysqld: + wsrep_sst_auth: "\"<%= $wsrep_sst_auth_real %>\"" +galera::percona::80::default_options: + mysqld: + # On XtraDB 8.0 the option pxc-encrypt-cluster-traffic is enabled by + # default. Disable it to make it easier to bootstrap new clusters. + pxc-encrypt-cluster-traffic: 'OFF' galera::percona::default_version: '8.0' # Percona does not allow installation of wsrep-enabled server and wsrep provider. galera::percona::galera_package_ensure: 'absent' + +galera::mariadb::default_options: + mysqld: + wsrep_sst_auth: "\"<%= $wsrep_sst_auth_real %>\"" galera::mariadb::default_version: '10.11' galera::mariadb::galera_package_ensure: 'present' diff --git a/manifests/init.pp b/manifests/init.pp index 3de04de..dae9c0a 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -451,12 +451,12 @@ } # Lookup vendor specific options for MySQL/MariaDB. - $_defaults_vendor = lookup("${module_name}::${vendor_type}::${vendor_version_internal}::default_options", { default_value => undef }) ? { - undef => lookup("${module_name}::${vendor_type}::default_options", { default_value => {} }), - default => lookup("${module_name}::${vendor_type}::${vendor_version_internal}::default_options", { default_value => {} }), - } + $_defaults_vendor = lookup("${module_name}::${vendor_type}::default_options", { default_value => {} }) + $_defaults_vendor_version = lookup("${module_name}::${vendor_type}::${vendor_version_internal}::default_options", { default_value => {} }) + # Merge results, the version-specific values take precedence. + $_default_pre = deep_merge($_defaults_vendor, $_defaults_vendor_version) # Now merge the vendor specific options with the global default values. - $_default_tmp = deep_merge($default_options, $_defaults_vendor) + $_default_tmp = deep_merge($default_options, $_default_pre) # XXX: The following is sort-of a compatibility layer. It passes all options # to the inline_epp() function. This way it is possible to use the values of @@ -517,6 +517,8 @@ } if $configure_repo { + # Ensure that repos are setup before trying to install packages. + $_packages_require = [Class['galera::repo']] include galera::repo unless $galera::arbitrator { if ($galera::params['galera_package_name']) { @@ -524,6 +526,8 @@ } Class['galera::repo'] -> Class['mysql::server'] } + } else { + $_packages_require = [] } if $configure_firewall { @@ -560,8 +564,9 @@ if ($manage_additional_packages and $additional_packages_real) { stdlib::ensure_packages($additional_packages_real, { - ensure => $package_ensure, - before => $_packages_before, + ensure => $package_ensure, + before => $_packages_before, + require => $_packages_require, }) } diff --git a/spec/acceptance/galera_spec.rb b/spec/acceptance/galera_spec.rb index dcf26d3..b01a496 100644 --- a/spec/acceptance/galera_spec.rb +++ b/spec/acceptance/galera_spec.rb @@ -25,7 +25,9 @@ class { 'galera': } }, vendor_type => 'percona', - vendor_version => '8.0' + vendor_version => '8.0', + # XtraDB 8 does not support the default SST method 'rsync' + wsrep_sst_method => 'xtrabackup-v2', } MANIFEST end