Skip to content

Commit

Permalink
Add ps_80_major_upgrade_to.yml
Browse files Browse the repository at this point in the history
Created script for native partitioning upgrade 5.7 to 8.0
Disabled selinux on centos6 because different images
  • Loading branch information
tplavcic committed Dec 19, 2019
1 parent 410e23e commit 2a295fc
Show file tree
Hide file tree
Showing 16 changed files with 191 additions and 32 deletions.
2 changes: 2 additions & 0 deletions bats/mysql-init-scripts.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down
18 changes: 18 additions & 0 deletions bats/ps-admin_integration.bats
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
11 changes: 11 additions & 0 deletions molecule/ps-57-install/molecule/default/cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions molecule/ps-57-install/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions molecule/ps-57-upgrade/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 11 additions & 0 deletions molecule/ps-80-install/molecule/default/cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}"
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions molecule/ps-80-install/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions molecule/ps-80-maj-upgrade-to/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions molecule/ps-80-upgrade/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions playbooks/common_56.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 7 additions & 1 deletion playbooks/common_57.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
17 changes: 17 additions & 0 deletions playbooks/ps_80.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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

Expand All @@ -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 }}"
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand All @@ -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
14 changes: 14 additions & 0 deletions playbooks/ps_80_upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
38 changes: 38 additions & 0 deletions scripts/ps_upgrade_partitioning.sh
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit 2a295fc

Please sign in to comment.