From b9b152a395268459b7e6ebeb4fda3ce0147e2ced Mon Sep 17 00:00:00 2001 From: Carlos Salguero Date: Sat, 26 May 2018 15:07:38 -0300 Subject: [PATCH 1/6] PT-1554 Tests for ps 5.7 --- bin/pt-mysql-summary | 2 +- t/pt-mysql-summary/pt-mysql-summary_encryption.t | 4 +++- t/pt-mysql-summary/samples/expected_output_temp002.txt | 1 + t/pt-mysql-summary/samples/expected_output_temp003.txt | 1 + t/pt-mysql-summary/samples/expected_output_temp004.txt | 1 + t/pt-mysql-summary/samples/expected_output_temp005.txt | 1 + t/pt-mysql-summary/samples/expected_output_temp006.txt | 1 + t/pt-mysql-summary/samples/expected_output_temp007.txt | 1 + t/pt-mysql-summary/samples/expected_output_temp_enc002.txt | 1 - t/pt-mysql-summary/samples/expected_output_temp_enc003.txt | 1 - t/pt-mysql-summary/samples/expected_output_temp_enc004.txt | 1 - t/pt-mysql-summary/samples/expected_output_temp_enc005.txt | 1 - t/pt-mysql-summary/samples/expected_output_temp_enc006.txt | 1 - t/pt-mysql-summary/samples/expected_output_temp_enc007.txt | 1 - t/pt-table-checksum/pt-136.t | 4 +++- 15 files changed, 13 insertions(+), 9 deletions(-) diff --git a/bin/pt-mysql-summary b/bin/pt-mysql-summary index ec3c5bc7..ffdf983f 100755 --- a/bin/pt-mysql-summary +++ b/bin/pt-mysql-summary @@ -2265,7 +2265,7 @@ report_jemalloc_enabled() { local GENERAL_JEMALLOC_STATUS=0 local JEMALLOC_LOCATION='' - for PID in $(pidof mysqld); do + for pid in $(pidof mysqld); do grep -qc jemalloc /proc/${pid}/environ || ldd $(which mysqld) 2>/dev/null | grep -qc jemalloc jemalloc_status=$? if [ $jemalloc_status = 1 ]; then diff --git a/t/pt-mysql-summary/pt-mysql-summary_encryption.t b/t/pt-mysql-summary/pt-mysql-summary_encryption.t index b8f510ed..dd941819 100644 --- a/t/pt-mysql-summary/pt-mysql-summary_encryption.t +++ b/t/pt-mysql-summary/pt-mysql-summary_encryption.t @@ -105,7 +105,7 @@ for my $i (2..7) { }, "t/pt-mysql-summary/samples/expected_output_temp_enc00$i.txt", ), - "--read-samples works for t/pt-mysql-summary/temp00$i", + "--read-samples works for t/pt-mysql-summary/temp_enc00$i", ) or diag($test_diff); } @@ -153,6 +153,8 @@ like( "Encrypted tablespaces included in report" ) or diag $out; +$master_dbh->do("DROP TABLE IF EXISTS test.t1"); +$master_dbh->do("DROP TABLE IF EXISTS test.t2"); $master_dbh->do("DROP DATABASE IF EXISTS test"); $master_dbh->do("DROP TABLESPACE foo"); diff --git a/t/pt-mysql-summary/samples/expected_output_temp002.txt b/t/pt-mysql-summary/samples/expected_output_temp002.txt index b7b7a5e2..9c90dae0 100644 --- a/t/pt-mysql-summary/samples/expected_output_temp002.txt +++ b/t/pt-mysql-summary/samples/expected_output_temp002.txt @@ -277,3 +277,4 @@ report-port = 12345 log-error = mysqld.log innodb_lock_wait_timeout = 3 # Memory management library ################################## +# The End #################################################### diff --git a/t/pt-mysql-summary/samples/expected_output_temp003.txt b/t/pt-mysql-summary/samples/expected_output_temp003.txt index e5b20824..64f0cd8c 100644 --- a/t/pt-mysql-summary/samples/expected_output_temp003.txt +++ b/t/pt-mysql-summary/samples/expected_output_temp003.txt @@ -220,3 +220,4 @@ report-port = 12345 log-error = mysqld.log innodb_lock_wait_timeout = 3 # Memory management library ################################## +# The End #################################################### diff --git a/t/pt-mysql-summary/samples/expected_output_temp004.txt b/t/pt-mysql-summary/samples/expected_output_temp004.txt index 55cd02a8..5ca8f669 100644 --- a/t/pt-mysql-summary/samples/expected_output_temp004.txt +++ b/t/pt-mysql-summary/samples/expected_output_temp004.txt @@ -219,3 +219,4 @@ report-port = 12345 log-error = mysqld.log innodb_lock_wait_timeout = 3 # Memory management library ################################## +# The End #################################################### diff --git a/t/pt-mysql-summary/samples/expected_output_temp005.txt b/t/pt-mysql-summary/samples/expected_output_temp005.txt index 3f48c826..fcfb9121 100644 --- a/t/pt-mysql-summary/samples/expected_output_temp005.txt +++ b/t/pt-mysql-summary/samples/expected_output_temp005.txt @@ -292,3 +292,4 @@ report-port = 12345 log-error = mysqld.log innodb_lock_wait_timeout = 3 # Memory management library ################################## +# The End #################################################### diff --git a/t/pt-mysql-summary/samples/expected_output_temp006.txt b/t/pt-mysql-summary/samples/expected_output_temp006.txt index 10b79804..9ce23275 100644 --- a/t/pt-mysql-summary/samples/expected_output_temp006.txt +++ b/t/pt-mysql-summary/samples/expected_output_temp006.txt @@ -341,3 +341,4 @@ log_queries_not_using_indexes | OFF # Configuration File ######################################### Config File | Cannot autodetect or find, giving up # Memory management library ################################## +# The End #################################################### diff --git a/t/pt-mysql-summary/samples/expected_output_temp007.txt b/t/pt-mysql-summary/samples/expected_output_temp007.txt index bd784839..efab17f4 100644 --- a/t/pt-mysql-summary/samples/expected_output_temp007.txt +++ b/t/pt-mysql-summary/samples/expected_output_temp007.txt @@ -295,3 +295,4 @@ log_queries_not_using_indexes | OFF # Configuration File ######################################### Config File | Cannot autodetect or find, giving up # Memory management library ################################## +# The End #################################################### diff --git a/t/pt-mysql-summary/samples/expected_output_temp_enc002.txt b/t/pt-mysql-summary/samples/expected_output_temp_enc002.txt index 33621026..e112c13b 100644 --- a/t/pt-mysql-summary/samples/expected_output_temp_enc002.txt +++ b/t/pt-mysql-summary/samples/expected_output_temp_enc002.txt @@ -282,5 +282,4 @@ report-port = 12345 log-error = mysqld.log innodb_lock_wait_timeout = 3 # Memory management library ################################## -Jemalloc library not found # The End #################################################### diff --git a/t/pt-mysql-summary/samples/expected_output_temp_enc003.txt b/t/pt-mysql-summary/samples/expected_output_temp_enc003.txt index 301c0e3f..909b1fef 100644 --- a/t/pt-mysql-summary/samples/expected_output_temp_enc003.txt +++ b/t/pt-mysql-summary/samples/expected_output_temp_enc003.txt @@ -225,5 +225,4 @@ report-port = 12345 log-error = mysqld.log innodb_lock_wait_timeout = 3 # Memory management library ################################## -Jemalloc library not found # The End #################################################### diff --git a/t/pt-mysql-summary/samples/expected_output_temp_enc004.txt b/t/pt-mysql-summary/samples/expected_output_temp_enc004.txt index 5ef0a955..89b13d84 100644 --- a/t/pt-mysql-summary/samples/expected_output_temp_enc004.txt +++ b/t/pt-mysql-summary/samples/expected_output_temp_enc004.txt @@ -224,5 +224,4 @@ report-port = 12345 log-error = mysqld.log innodb_lock_wait_timeout = 3 # Memory management library ################################## -Jemalloc library not found # The End #################################################### diff --git a/t/pt-mysql-summary/samples/expected_output_temp_enc005.txt b/t/pt-mysql-summary/samples/expected_output_temp_enc005.txt index d15262ce..98776caa 100644 --- a/t/pt-mysql-summary/samples/expected_output_temp_enc005.txt +++ b/t/pt-mysql-summary/samples/expected_output_temp_enc005.txt @@ -297,5 +297,4 @@ report-port = 12345 log-error = mysqld.log innodb_lock_wait_timeout = 3 # Memory management library ################################## -Jemalloc library not found # The End #################################################### diff --git a/t/pt-mysql-summary/samples/expected_output_temp_enc006.txt b/t/pt-mysql-summary/samples/expected_output_temp_enc006.txt index 0b927f58..ced33d67 100644 --- a/t/pt-mysql-summary/samples/expected_output_temp_enc006.txt +++ b/t/pt-mysql-summary/samples/expected_output_temp_enc006.txt @@ -346,5 +346,4 @@ log_queries_not_using_indexes | OFF # Configuration File ######################################### Config File | Cannot autodetect or find, giving up # Memory management library ################################## -Jemalloc library not found # The End #################################################### diff --git a/t/pt-mysql-summary/samples/expected_output_temp_enc007.txt b/t/pt-mysql-summary/samples/expected_output_temp_enc007.txt index 60425d5f..b0decdc6 100644 --- a/t/pt-mysql-summary/samples/expected_output_temp_enc007.txt +++ b/t/pt-mysql-summary/samples/expected_output_temp_enc007.txt @@ -300,5 +300,4 @@ log_queries_not_using_indexes | OFF # Configuration File ######################################### Config File | Cannot autodetect or find, giving up # Memory management library ################################## -Jemalloc library not found # The End #################################################### diff --git a/t/pt-table-checksum/pt-136.t b/t/pt-table-checksum/pt-136.t index 7124c9df..af117f09 100644 --- a/t/pt-table-checksum/pt-136.t +++ b/t/pt-table-checksum/pt-136.t @@ -28,6 +28,8 @@ else { } $sb->load_file('master', 't/pt-table-checksum/samples/pt-136.sql'); +$sb->wait_for_slaves(); +sleep(1); # The sandbox servers run with lock_wait_timeout=3 and it's not dynamic # so we need to specify --set-vars innodb_lock_wait_timeout=3 else the tool will die. # And --max-load "" prevents waiting for status variables. @@ -44,7 +46,7 @@ $output = output( is( $exit_status, 0, - "Checksum columns with mismatching collaitons", + "Checksum columns with mismatching collations", ); # ############################################################################# From 445d38f35917905a049099ec93824b7de903f089 Mon Sep 17 00:00:00 2001 From: Carlos Salguero Date: Sat, 26 May 2018 17:10:14 -0300 Subject: [PATCH 2/6] PT-1554 Test a fix for pt-136 & ps 5.7 --- t/pt-table-checksum/pt-136.t | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/t/pt-table-checksum/pt-136.t b/t/pt-table-checksum/pt-136.t index af117f09..d9b1ace2 100644 --- a/t/pt-table-checksum/pt-136.t +++ b/t/pt-table-checksum/pt-136.t @@ -16,6 +16,8 @@ use Sandbox; use SqlModes; require "$trunk/bin/pt-table-checksum"; +$ENV{PTDEBUG} = 1; + my $dp = new DSNParser(opts=>$dsn_opts); my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp); my $dbh = $sb->get_dbh_for('master'); @@ -30,9 +32,6 @@ else { $sb->load_file('master', 't/pt-table-checksum/samples/pt-136.sql'); $sb->wait_for_slaves(); sleep(1); -# The sandbox servers run with lock_wait_timeout=3 and it's not dynamic -# so we need to specify --set-vars innodb_lock_wait_timeout=3 else the tool will die. -# And --max-load "" prevents waiting for status variables. my $master_dsn = $sb->dsn_for('master'); my @args = ($master_dsn); my $output; @@ -49,6 +48,7 @@ is( "Checksum columns with mismatching collations", ); +delete $ENV{PTDEBUG}; # ############################################################################# # Done. # ############################################################################# From 0be68be8920377f21c6028d1e71c9a5433681066 Mon Sep 17 00:00:00 2001 From: Carlos Salguero Date: Sat, 26 May 2018 17:36:06 -0300 Subject: [PATCH 3/6] PT-1554 Test a fix for pt-136 & ps 5.7 --- bin/pt-table-checksum | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/pt-table-checksum b/bin/pt-table-checksum index f7fe1323..3a01755e 100755 --- a/bin/pt-table-checksum +++ b/bin/pt-table-checksum @@ -9831,7 +9831,7 @@ use warnings FATAL => 'all'; use English qw(-no_match_vars); use Percona::Toolkit; -use constant PTDEBUG => $ENV{PTDEBUG} || 0; +use constant PTDEBUG => $ENV{PTDEBUG} || 1; use POSIX qw(signal_h); use List::Util qw(max); From abd84d03a8f1c994a55644cc4e51c14666adea2d Mon Sep 17 00:00:00 2001 From: Carlos Salguero Date: Sat, 26 May 2018 19:52:12 -0300 Subject: [PATCH 4/6] PT-1554 Trying to debug to find why t/pt-table-checksum/pt-136.t fails on docker --- t/pt-table-checksum/pt-136.t | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/t/pt-table-checksum/pt-136.t b/t/pt-table-checksum/pt-136.t index d9b1ace2..6d02a8e7 100644 --- a/t/pt-table-checksum/pt-136.t +++ b/t/pt-table-checksum/pt-136.t @@ -16,8 +16,6 @@ use Sandbox; use SqlModes; require "$trunk/bin/pt-table-checksum"; -$ENV{PTDEBUG} = 1; - my $dp = new DSNParser(opts=>$dsn_opts); my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp); my $dbh = $sb->get_dbh_for('master'); @@ -29,11 +27,11 @@ else { plan tests => 2; } +$dbh->do("DROP TABLE IF EXISTS percona.checksums"); $sb->load_file('master', 't/pt-table-checksum/samples/pt-136.sql'); $sb->wait_for_slaves(); -sleep(1); my $master_dsn = $sb->dsn_for('master'); -my @args = ($master_dsn); +my @args = ($master_dsn, '--databases', 'db1', '--no-replicate-check'); my $output; my $exit_status; @@ -46,9 +44,9 @@ is( $exit_status, 0, "Checksum columns with mismatching collations", -); +) or BAIL_OUT("debug time"); + -delete $ENV{PTDEBUG}; # ############################################################################# # Done. # ############################################################################# From cb5e0077fd3d41560a707eb45244518194a2bd98 Mon Sep 17 00:00:00 2001 From: Carlos Salguero Date: Sat, 26 May 2018 21:58:28 -0300 Subject: [PATCH 5/6] PT-1554 Trying to debug to find why t/pt-table-checksum/pt-136.t fails on docker --- bin/pt-table-checksum | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/pt-table-checksum b/bin/pt-table-checksum index 3a01755e..f7fe1323 100755 --- a/bin/pt-table-checksum +++ b/bin/pt-table-checksum @@ -9831,7 +9831,7 @@ use warnings FATAL => 'all'; use English qw(-no_match_vars); use Percona::Toolkit; -use constant PTDEBUG => $ENV{PTDEBUG} || 1; +use constant PTDEBUG => $ENV{PTDEBUG} || 0; use POSIX qw(signal_h); use List::Util qw(max); From f3bca3af411c5f78de9be78185ff983bbd050889 Mon Sep 17 00:00:00 2001 From: Carlos Salguero Date: Mon, 28 May 2018 12:07:03 -0300 Subject: [PATCH 6/6] PT-1554 Fixed library report_mysql_info --- lib/bash/report_mysql_info.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/bash/report_mysql_info.sh b/lib/bash/report_mysql_info.sh index 0f874932..a523ef1f 100644 --- a/lib/bash/report_mysql_info.sh +++ b/lib/bash/report_mysql_info.sh @@ -1269,7 +1269,7 @@ report_jemalloc_enabled() { local GENERAL_JEMALLOC_STATUS=0 local JEMALLOC_LOCATION='' - for PID in $(pidof mysqld); do + for pid in $(pidof mysqld); do grep -qc jemalloc /proc/${pid}/environ || ldd $(which mysqld) 2>/dev/null | grep -qc jemalloc jemalloc_status=$? if [ $jemalloc_status = 1 ]; then @@ -1576,7 +1576,7 @@ report_mysql_summary () { local keyring_plugins="$(collect_keyring_plugins)" local encrypted_tables="" local encrypted_tablespaces="" - if [ ${OPT_LIST_ENCRYPTED_TABLES} == 'yes' ]; then + if [ "${OPT_LIST_ENCRYPTED_TABLES}" = 'yes' ]; then encrypted_tables="$(collect_encrypted_tables)" encrypted_tablespaces="$(collect_encrypted_tablespaces)" fi