diff --git a/bats/mysql-init-scripts.bats b/bats/mysql-init-scripts.bats index 038c7ea7d..36c7d9a12 100644 --- a/bats/mysql-init-scripts.bats +++ b/bats/mysql-init-scripts.bats @@ -231,6 +231,7 @@ function teardown(){ [ $status -eq 1 ] run is_running [ $status -eq 1 ] + run sed -i '/nonexistingoption=/d' ${MYSQLCONF} fi else skip "system doesn't have systemctl command" @@ -248,6 +249,7 @@ function teardown(){ # [ $status -eq 1 ] # run is_running # [ $status -eq 1 ] +# run sed -i '/nonexistingoption=/d' ${MYSQLCONF} # else # skip "system doesn't have service command" # fi diff --git a/bats/ps-admin_integration.bats b/bats/ps-admin_integration.bats index 14417a174..07516bf9d 100644 --- a/bats/ps-admin_integration.bats +++ b/bats/ps-admin_integration.bats @@ -169,3 +169,21 @@ load ps-admin_helper check_rocksdb_notexists fi } + +@test "reinstall ALL plugins for upgrade test" { + install_all + if [ ${MYSQL_VERSION} != "8.0" ]; then + check_qrt_exists + fi + check_audit_exists +# check_pam_exists +# check_pam_compat_exists + if [ ${MYSQL_VERSION} != "5.5" ]; then + check_tokudb_exists + check_tokubackup_exists + fi + if [ ${MYSQL_VERSION} != "5.5" -a ${MYSQL_VERSION} != "5.6" ]; then + check_mysqlx_exists + check_rocksdb_exists + fi +} diff --git a/molecule/ps-57-install/molecule/default/cleanup.yml b/molecule/ps-57-install/molecule/default/cleanup.yml index e92fadc47..0a13c3e77 100644 --- a/molecule/ps-57-install/molecule/default/cleanup.yml +++ b/molecule/ps-57-install/molecule/default/cleanup.yml @@ -5,6 +5,9 @@ become_method: sudo tasks: + - name: disable all percona repos + command: percona-release disable all + - name: remove Percona Server deb packages apt: name: "{{ packages }}" @@ -40,6 +43,14 @@ - name: check if process is stopped after package removal command: /package-testing/check_running.sh mysql stopped + - stat: + path: /var/lib/mysql + register: p + + - fail: + msg: "Path exists and is a directory and is not empty" + when: p.stat.isdir is defined and p.stat.isdir and p.stat.size > 1000000 + # - name: Unregister RedHat # redhat_subscription: # state: absent diff --git a/molecule/ps-57-install/tasks/main.yml b/molecule/ps-57-install/tasks/main.yml index 6f28693a8..8c4dd6717 100644 --- a/molecule/ps-57-install/tasks/main.yml +++ b/molecule/ps-57-install/tasks/main.yml @@ -70,9 +70,9 @@ - name: run PAM test include_tasks: ../../../tasks/pam_test.yml - - name: disable selinux on centos7 for TokuDB to work + - name: disable selinux on centos for TokuDB to work command: setenforce 0 - when: ansible_os_family == "RedHat" and ansible_distribution_major_version >= "7" + when: ansible_os_family == "RedHat" - name: install tokudb and restart server command: /usr/bin/ps_tokudb_admin --enable --enable-backup diff --git a/molecule/ps-57-upgrade/tasks/main.yml b/molecule/ps-57-upgrade/tasks/main.yml index fe9a91f8a..3bf9f81cf 100644 --- a/molecule/ps-57-upgrade/tasks/main.yml +++ b/molecule/ps-57-upgrade/tasks/main.yml @@ -62,9 +62,9 @@ mode=0640 owner=root group=root when: ansible_os_family == "RedHat" - - name: disable selinux on centos7 for TokuDB to work + - name: disable selinux on centos for TokuDB to work command: setenforce 0 - when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "7" + when: ansible_os_family == "RedHat" - name: install tokudb and restart server command: /usr/bin/ps_tokudb_admin --enable diff --git a/molecule/ps-80-install/molecule/default/cleanup.yml b/molecule/ps-80-install/molecule/default/cleanup.yml index 8bdb557fe..619a07321 100644 --- a/molecule/ps-80-install/molecule/default/cleanup.yml +++ b/molecule/ps-80-install/molecule/default/cleanup.yml @@ -5,6 +5,9 @@ become_method: sudo tasks: + - name: disable all percona repos + command: percona-release disable all + - name: remove Percona Server deb packages apt: name: "{{ packages }}" @@ -39,6 +42,14 @@ - name: check if process is stopped after package removal command: /package-testing/check_running.sh mysql stopped + - stat: + path: /var/lib/mysql + register: p + + - fail: + msg: "Path exists and is a directory and is not empty" + when: p.stat.isdir is defined and p.stat.isdir and p.stat.size > 1000000 + # - name: Unregister RedHat # redhat_subscription: # state: absent diff --git a/molecule/ps-80-install/tasks/main.yml b/molecule/ps-80-install/tasks/main.yml index 09465c4f3..0926b0b02 100644 --- a/molecule/ps-80-install/tasks/main.yml +++ b/molecule/ps-80-install/tasks/main.yml @@ -58,9 +58,9 @@ command: /package-testing/setpass_57.sh when: ansible_os_family == "RedHat" - - name: disable selinux on centos7 for TokuDB to work + - name: disable selinux on centos for TokuDB to work command: setenforce 0 - when: ansible_os_family == "RedHat" and ansible_distribution_major_version|int >= 7 + when: ansible_os_family == "RedHat" - name: run Group Replication tests include_tasks: ../../../tasks/gr_test.yml diff --git a/molecule/ps-80-maj-upgrade-to/tasks/main.yml b/molecule/ps-80-maj-upgrade-to/tasks/main.yml index 7e53cf164..9dbd3763a 100644 --- a/molecule/ps-80-maj-upgrade-to/tasks/main.yml +++ b/molecule/ps-80-maj-upgrade-to/tasks/main.yml @@ -19,6 +19,9 @@ - name: install Percona Server 8.0 packages include_tasks: ../../../tasks/install_ps80.yml + - name: install percona-mysql-shell package + include_tasks: ../../../tasks/install_pshell.yml + - name: start mysql service with service command command: service mysql start when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "6" diff --git a/molecule/ps-80-upgrade/tasks/main.yml b/molecule/ps-80-upgrade/tasks/main.yml index f3137cfd0..ee45c7cde 100644 --- a/molecule/ps-80-upgrade/tasks/main.yml +++ b/molecule/ps-80-upgrade/tasks/main.yml @@ -56,9 +56,9 @@ mode=0640 owner=root group=root when: ansible_os_family == "RedHat" - - name: disable selinux on centos7 for TokuDB to work + - name: disable selinux on centos for TokuDB to work command: setenforce 0 - when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "7" + when: ansible_os_family == "RedHat" - name: install tokudb and restart server command: /usr/bin/ps-admin --enable-tokudb diff --git a/playbooks/common_56.yml b/playbooks/common_56.yml index 80f6a704b..4f79a6bff 100644 --- a/playbooks/common_56.yml +++ b/playbooks/common_56.yml @@ -227,3 +227,11 @@ - name: check if process is stopped after package removal command: /package-testing/check_running.sh mysql stopped + + - stat: + path: /var/lib/mysql + register: p + + - fail: + msg: "Path exists and is a directory and is not empty" + when: p.stat.isdir is defined and p.stat.isdir and p.stat.size > 1000000 diff --git a/playbooks/common_57.yml b/playbooks/common_57.yml index b97137717..58533de05 100644 --- a/playbooks/common_57.yml +++ b/playbooks/common_57.yml @@ -84,7 +84,7 @@ - name: disable selinux on centos7 for TokuDB to work command: setenforce 0 - when: ansible_os_family == "RedHat" and ansible_distribution_major_version >= "7" + when: ansible_os_family == "RedHat" - name: install tokudb and restart server command: /usr/bin/ps_tokudb_admin --enable --enable-backup @@ -167,10 +167,16 @@ - name: start mysql service service: name=mysql state=started + - name: upgrade partitioning + command: /package-testing/scripts/ps_upgrade_partitioning.sh + # temporary commented out until BLD-906 is fixed # - name: check that mysqladmin shutdown works correctly # command: /package-testing/madmin_check.sh + - name: disable all percona repos + command: percona-release disable all + - name: remove PS 5.7 packages include_tasks: ../tasks/remove_ps57.yml diff --git a/playbooks/ps_80.yml b/playbooks/ps_80.yml index f73af13b7..612323a97 100644 --- a/playbooks/ps_80.yml +++ b/playbooks/ps_80.yml @@ -59,6 +59,9 @@ include_tasks: ../tasks/install_pxb80.yml when: lookup('env', 'install_repo') != "experimental" + - name: list installed packages + include_tasks: ../tasks/list_installed_packages.yml + - name: start mysql service with service command command: service mysql start when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "6" @@ -139,6 +142,9 @@ - rsyslog-mysql when: ansible_os_family == "RedHat" + - name: list installed packages + include_tasks: ../tasks/list_installed_packages.yml + - name: run bats tests for mysql init scripts command: /usr/local/bin/bats /package-testing/bats/mysql-init-scripts.bats @@ -148,6 +154,9 @@ - name: check that mysqladmin shutdown works correctly command: /package-testing/madmin_check.sh + - name: disable all percona repos + command: percona-release disable all + - name: remove Percona Server deb packages apt: name: "{{ packages }}" @@ -169,3 +178,11 @@ - name: check if process is stopped after package removal command: /package-testing/check_running.sh mysql stopped + + - stat: + path: /var/lib/mysql + register: p + + - fail: + msg: "Path exists and is a directory and is not empty" + when: p.stat.isdir is defined and p.stat.isdir and p.stat.size > 1000000 diff --git a/playbooks/ps_80_maj_upgrade_to.yml b/playbooks/ps_80_major_upgrade_to.yml similarity index 57% rename from playbooks/ps_80_maj_upgrade_to.yml rename to playbooks/ps_80_major_upgrade_to.yml index 8ffddfd35..b81c019e8 100644 --- a/playbooks/ps_80_maj_upgrade_to.yml +++ b/playbooks/ps_80_major_upgrade_to.yml @@ -12,9 +12,12 @@ vault_cert: "{{ lookup('env', 'VAULT_TEST_CERT') }}" tasks: - - name: Remove PS 5.7 packages + - name: remove PS 5.7 packages include_tasks: ../tasks/remove_ps57.yml + - name: remove PXB 2.4 packages + include_tasks: ../tasks/remove_pxb24.yml + - name: include tasks for enabling PS 8 test repo include: ../tasks/enable_ps8_main_repo.yml when: lookup('env', 'install_repo') == "main" @@ -26,6 +29,19 @@ - name: install Percona Server 8.0 packages include_tasks: ../tasks/install_ps80.yml + - name: install PXB 8.0 packages + include_tasks: ../tasks/install_pxb80.yml + + - name: install percona-mysql-shell package + include_tasks: ../tasks/install_pshell.yml + + - name: check that Percona XtraBackup version is correct + command: /package-testing/version_check.sh pxb80 + when: lookup('env', 'install_repo') != "experimental" + + - name: list installed packages + include_tasks: ../tasks/list_installed_packages.yml + - name: start mysql service with service command command: service mysql start when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "6" @@ -49,17 +65,31 @@ - name: run some MyRocks tests command: /package-testing/scripts/ps_myrocks_test.sh - - name: run bats tests for PAM - command: /usr/local/bin/bats /package-testing/scripts/ps_pam_test/ps_pam_test.bats +# - name: run bats tests for PAM +# command: /usr/local/bin/bats /package-testing/scripts/ps_pam_test/ps_pam_test.bats - name: keyring plugins test - command: /package-testing/scripts/ps_keyring_plugins_test/ps_keyring_plugins_test.sh ps57 + command: /package-testing/scripts/ps_keyring_plugins_test/ps_keyring_plugins_test.sh ps80 - - name: run bats unit tests for ps-admin script - command: /usr/local/bin/bats /package-testing/bats/ps-admin_unit.bats +# - name: run bats unit tests for ps-admin script +# command: /usr/local/bin/bats /package-testing/bats/ps-admin_unit.bats - - name: run bats integration tests for ps-admin script - command: /usr/local/bin/bats /package-testing/bats/ps-admin_integration.bats +# - name: run bats integration tests for ps-admin script +# command: /usr/local/bin/bats /package-testing/bats/ps-admin_integration.bats - name: run bats tests for mysql init scripts command: /usr/local/bin/bats /package-testing/bats/mysql-init-scripts.bats + + - name: remove PS 8.0 packages + include_tasks: ../tasks/remove_ps80.yml + + - name: check if process is stopped after package removal + command: /package-testing/check_running.sh mysql stopped + + - stat: + path: /var/lib/mysql + register: p + + - fail: + msg: "Path exists and is a directory and is not empty" + when: p.stat.isdir is defined and p.stat.isdir and p.stat.size > 1000000 diff --git a/playbooks/ps_80_upgrade.yml b/playbooks/ps_80_upgrade.yml index be0091b62..f4a089680 100644 --- a/playbooks/ps_80_upgrade.yml +++ b/playbooks/ps_80_upgrade.yml @@ -57,6 +57,9 @@ include_tasks: ../tasks/install_pxb80.yml when: lookup('env', 'install_repo') != "experimental" + - name: list installed packages + include_tasks: ../tasks/list_installed_packages.yml + - name: start mysql service with service command command: service mysql start when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "6" @@ -203,6 +206,9 @@ - name: install percona-mysql-shell package include_tasks: ../tasks/install_pshell.yml + - name: list installed packages + include_tasks: ../tasks/list_installed_packages.yml + - name: run mysql_upgrade command: mysql_upgrade -uroot @@ -269,3 +275,11 @@ - name: check if process is stopped after package removal command: /package-testing/check_running.sh mysql stopped + + - stat: + path: /var/lib/mysql + register: p + + - fail: + msg: "Path exists and is a directory and is not empty" + when: p.stat.isdir is defined and p.stat.isdir and p.stat.size > 1000000 diff --git a/scripts/ps_upgrade_partitioning.sh b/scripts/ps_upgrade_partitioning.sh new file mode 100755 index 000000000..825dc1969 --- /dev/null +++ b/scripts/ps_upgrade_partitioning.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +set -e + +if [ -f /etc/mysql/my.cnf ]; then + MYCNF="/etc/mysql/my.cnf" +else + MYCNF="/etc/my.cnf" +fi + +echo "Adding the config vars" +service mysql stop +sleep 10 +if [ $(grep -c "\[mysqld\]" ${MYCNF}) -eq 0 ]; then + echo -e "\n[mysqld]" >> ${MYCNF} +fi +sed -i '/\[mysqld\]/a rocksdb_enable_native_partition=ON' ${MYCNF} +sed -i '/\[mysqld\]/a tokudb_enable_native_partition=ON' ${MYCNF} +service mysql start +sleep 10 + +echo "upgrade tables" +mysql -e "ALTER TABLE comp_test.t1_RocksDB_default UPGRADE PARTITIONING;" +mysql -e "ALTER TABLE comp_test.t1_RocksDB_lz4 UPGRADE PARTITIONING;" +mysql -e "ALTER TABLE comp_test.t1_RocksDB_no UPGRADE PARTITIONING;" +mysql -e "ALTER TABLE comp_test.t1_RocksDB_zlib UPGRADE PARTITIONING;" +mysql -e "ALTER TABLE comp_test.t1_RocksDB_zstd UPGRADE PARTITIONING;" +mysql -e "ALTER TABLE comp_test.t1_TokuDB_default UPGRADE PARTITIONING;" +mysql -e "ALTER TABLE comp_test.t1_TokuDB_lzma UPGRADE PARTITIONING;" +mysql -e "ALTER TABLE comp_test.t1_TokuDB_no UPGRADE PARTITIONING;" +mysql -e "ALTER TABLE comp_test.t1_TokuDB_quicklz UPGRADE PARTITIONING;" +mysql -e "ALTER TABLE comp_test.t1_TokuDB_snappy UPGRADE PARTITIONING;" +mysql -e "ALTER TABLE comp_test.t1_TokuDB_zlib UPGRADE PARTITIONING;" + +echo "remove the config vars" +sed -i '/rocksdb_enable_native_partition=/d' ${MYCNF} +sed -i '/tokudb_enable_native_partition=/d' ${MYCNF} +service mysql restart +sleep 10 diff --git a/tasks/test_prep.yml b/tasks/test_prep.yml index b6ddfec15..cb1780f4e 100644 --- a/tasks/test_prep.yml +++ b/tasks/test_prep.yml @@ -102,21 +102,22 @@ - unzip when: ansible_os_family == "Suse" - - name: download package-testing repo with wget - command: "{{ item }}" - with_items: - - rm -rf /package-testing - - rm -f master.zip - - wget --no-check-certificate -O master.zip https://github.com/Percona-QA/package-testing/archive/master.zip - - unzip master.zip - - rm -f master.zip - - mv package-testing-master /package-testing - -# - name: copy package-testing directory to remote -# copy: -# src: ../../package-testing -# dest: / -# force: yes +# - name: download package-testing repo with wget +# command: "{{ item }}" +# with_items: +# - rm -rf /package-testing +# - rm -f master.zip +# - wget --no-check-certificate -O master.zip https://github.com/Percona-QA/package-testing/archive/master.zip +# - unzip master.zip +# - rm -f master.zip +# - mv package-testing-master /package-testing + + - name: copy package-testing directory to remote + copy: + src: ../../package-testing + dest: / + force: yes + mode: preserve - name: install latest bats from github command: "{{ item }}"