diff --git a/Changelog b/Changelog index 2599015e..902b1d5e 100644 --- a/Changelog +++ b/Changelog @@ -1,8 +1,10 @@ Changelog for Percona Toolkit -v3.0.9 released 2018-04-17 +v3.0.10 -v3.0.9 + * Improvement PT-1546 : Improved support of MySQL 8 roles + +v3.0.9 released 2018-04-17 * Feature PT-1530 : Add support for encryption status to mysql-summary * Fixed bug PT-1527 : pt-table-checksum ignores --nocheck-binlog-format diff --git a/bin/pt-mext b/bin/pt-mext index 0e522065..af0f6b4b 100755 --- a/bin/pt-mext +++ b/bin/pt-mext @@ -599,9 +599,9 @@ for i in `_seq $NUM`; do NEXTFILE=$(($i + 1)) # Sort each file and eliminate empty lines, so 'join' doesn't complain. - sort "$FILE$i" | grep . > "$FILE$i.tmp" + sort -s "$FILE$i" | grep . > "$FILE$i.tmp" mv "$FILE$i.tmp" "$FILE$i" - sort "$FILE${NEXTFILE}" | grep . > "$FILE${NEXTFILE}.tmp" + sort -s "$FILE${NEXTFILE}" | grep . > "$FILE${NEXTFILE}.tmp" mv "$FILE${NEXTFILE}.tmp" "$FILE${NEXTFILE}" # Join the files together. This gets slow O(n^2) as we add more files, but @@ -610,7 +610,7 @@ for i in `_seq $NUM`; do # Find the max length of the [numeric only] values in the file so we know how # wide to make the columns - MAXLEN=`awk '{print $2}' "$FILE${NEXTFILE}" | grep -v '[^0-9]' | awk '{print length($1)}' | sort -rn | head -n1` + MAXLEN=`awk '{print $2}' "$FILE${NEXTFILE}" | grep -v '[^0-9]' | awk '{print length($1)}' | sort -rns | head -n1` mv "$FILE" "$FILE${NEXTFILE}" SPEC="$SPEC %${MAXLEN}d"; diff --git a/bin/pt-mysql-summary b/bin/pt-mysql-summary index b0da1ee0..122cdf00 100755 --- a/bin/pt-mysql-summary +++ b/bin/pt-mysql-summary @@ -2266,24 +2266,19 @@ report_jemalloc_enabled() { local JEMALLOC_LOCATION='' 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 - echo "jemalloc is not enabled in MySQL config for process with ID ${PID}" + grep -qc jemalloc /proc/${pid}/environ || ldd $(which mysqld) 2>/dev/null | grep -qc jemalloc + jemalloc_status=$? + if [ $jemalloc_status = 1 ]; then + echo "jemalloc is not enabled in mysql config for process with id ${pid}" else - echo "jemalloc enabled in MySQL config for process with ID ${PID}" + echo "jemalloc enabled in mysql config for process with id ${pid}" GENERAL_JEMALLOC_STATUS=1 fi done - if [ $GENERAL_JEMALLOC_STATUS = 1 ]; then - for libjemall in "/usr/lib64" "/usr/lib/x86_64-linux-gnu" "/usr/lib"; do - if [ -r "$libjemall/libjemalloc.so.1" ]; then - JEMALLOC_LOCATION="$libjemall/libjemalloc.so.1" - break - fi - done - if [ -z $JEMALLOC_LOCATION ]; then + if [ $GENERAL_JEMALLOC_STATUS -eq 1 ]; then + JEMALLOC_LOCATION=$(find /usr/lib64/ /usr/lib/x86_64-linux-gnu /usr/lib -name "libjemalloc.*" 2>/dev/null | head -n 1) + if [ -z "$JEMALLOC_LOCATION" ]; then echo "Jemalloc library not found" else echo "Using jemalloc from $JEMALLOC_LOCATION" diff --git a/bin/pt-show-grants b/bin/pt-show-grants index 0fdda5e4..bff296cf 100755 --- a/bin/pt-show-grants +++ b/bin/pt-show-grants @@ -1909,8 +1909,14 @@ sub main { . ($o->get('timestamp') ? ", MySQL $version at $ts" : ", MySQL $version"), ), "\n" if $o->get('header'); + # MySQL 8 roles must be excluded from the regular users list. + # Roles can be identified because the user password is expired, the authentication + # string is empty and the account is locked my $users = $o->get('only') || $dbh->selectall_arrayref( - 'SELECT DISTINCT User, Host FROM mysql.user ORDER BY User, Host', + 'SELECT DISTINCT User, Host FROM mysql.user WHERE NOT (`account_locked`="Y" + AND `password_expired`="Y" + AND `authentication_string`="" + ) ORDER BY User, Host', { Slice => {} }); if ( scalar @all_hosts ) { my $where = join(' OR ', map { "User='$_'" } @all_hosts); @@ -1922,6 +1928,24 @@ sub main { my $ignore_users = $o->get('ignore'); my $exit_status = 0; + my $roles = get_roles($dbh, $users); + if ($roles && scalar @$roles > 0) { + print "-- Roles\n"; + my $count=0; + + for my $role (@$roles) { + next if (!$o->get("include-unused-roles") && $role->{active} == 0); + unshift @$users, { Host => $role->{host}, User => $role->{name}, IsRole => 1}; + $count++; + printf('CREATE ROLE IF NOT EXISTS `%s`;'."\n", $role->{name}); + } + + if ($count == 0) { + print "No active roles found\n"; + } + print "-- End of roles listing\n"; + } + USER: foreach my $u ( @$users ) { my $user_host = "'$u->{User}'\@'$u->{Host}'"; @@ -2040,7 +2064,7 @@ sub main { "\n"; } - if ( $o->get('drop') ) { + if ( $o->get('drop') && !defined($u->{IsRole}) ) { print join("\n", "DROP USER $user_host;", "DELETE FROM `mysql`.`user` WHERE `User`='$u->{User}' AND `Host`='$u->{Host}';", @@ -2084,6 +2108,42 @@ sub parse_user { return ( $user, $host ); } +sub get_roles { + my ($dbh, $users) = @_; + my $query = <<__EOQ; + SELECT DISTINCT user.user AS name, user.host, IF(from_user IS NULL,0, 1) AS active + FROM mysql.user + LEFT JOIN mysql.role_edges ON role_edges.from_user=user.user + WHERE `account_locked`='Y' + AND `password_expired`='Y' + AND `authentication_string`='' +__EOQ + if (scalar $users > 0) { + my $user_names = join (", ", map { "'$_->{User}'" } @$users); + $query .= " AND to_user IN ($user_names)"; + } + PTDEBUG && _d("Getting roles"); + PTDEBUG && _d($query); + my $roles; + eval { $roles = $dbh->selectall_arrayref($query, { Slice => {} }) }; + if ($EVAL_ERROR) { + PTDEBUG && _d("Cannot list roles: $EVAL_ERROR"); + } + return $roles; +} + +sub is_role { + my ($users, $grant) = @_; + foreach my $u ( @$users ) { + my $user_host = "`$u->{User}`\@`$u->{Host}`"; + warn "> user_host: $user_host"; + if ($grant eq $user_host) { + return 1; + } + } + return 0; +} + sub split_grants { my ($grants) = @_; return unless $grants; @@ -2346,6 +2406,10 @@ example, specifying C<--set-vars wait_timeout=500> overrides the defaultvalue of The tool prints a warning and continues if a variable cannot be set. +=item --[no]include-unused-roles + +When dumping MySQL 8+ roles, include unused roles. + =item --socket short form: -S; type: string diff --git a/bin/pt-table-checksum b/bin/pt-table-checksum index b891dcf7..cddc74e5 100755 --- a/bin/pt-table-checksum +++ b/bin/pt-table-checksum @@ -9847,6 +9847,7 @@ use sigtrap 'handler', \&sig_int, 'normal-signals'; my $oktorun = 1; my $print_header = 1; my $exit_status = 0; +my $original_qrt_plugin_master_status = undef; # "exit codes 1 - 2, 126 - 165, and 255 [1] have special meanings, # and should therefore be avoided for user-specified exit parameters" @@ -10052,30 +10053,28 @@ sub main { # instead, it should check if it's already set to STATEMENT. # This is becase starting with MySQL 5.1.29, changing the format # requires a SUPER user. - if ( $o->get('check-binlog-format') ) { - if ( VersionParser->new($dbh) >= '5.1.5' ) { - $sql = 'SELECT @@binlog_format'; - PTDEBUG && _d($dbh, $sql); - my ($original_binlog_format) = $dbh->selectrow_array($sql); - PTDEBUG && _d('Original binlog_format:', $original_binlog_format); - if ( $original_binlog_format !~ /STATEMENT/i ) { - $sql = q{/*!50108 SET @@binlog_format := 'STATEMENT'*/}; - eval { - PTDEBUG && _d($dbh, $sql); - $dbh->do($sql); - }; - if ( $EVAL_ERROR ) { - die "Failed to $sql: $EVAL_ERROR\n" - . "This tool requires binlog_format=STATEMENT, " - . "but the current binlog_format is set to " - ."$original_binlog_format and an error occurred while " - . "attempting to change it. If running MySQL 5.1.29 or newer, " - . "setting binlog_format requires the SUPER privilege. " - . "You will need to manually set binlog_format to 'STATEMENT' " - . "before running this tool.\n"; - } - } - } + if ( VersionParser->new($dbh) >= '5.1.5' ) { + $sql = 'SELECT @@binlog_format'; + PTDEBUG && _d($dbh, $sql); + my ($original_binlog_format) = $dbh->selectrow_array($sql); + PTDEBUG && _d('Original binlog_format:', $original_binlog_format); + if ( $original_binlog_format !~ /STATEMENT/i ) { + $sql = q{/*!50108 SET @@binlog_format := 'STATEMENT'*/}; + eval { + PTDEBUG && _d($dbh, $sql); + $dbh->do($sql); + }; + if ( $EVAL_ERROR ) { + die "Failed to $sql: $EVAL_ERROR\n" + . "This tool requires binlog_format=STATEMENT, " + . "but the current binlog_format is set to " + ."$original_binlog_format and an error occurred while " + . "attempting to change it. If running MySQL 5.1.29 or newer, " + . "setting binlog_format requires the SUPER privilege. " + . "You will need to manually set binlog_format to 'STATEMENT' " + . "before running this tool.\n"; + } + } } # Set transaction isolation level. We set binlog_format to STATEMENT, @@ -10103,6 +10102,7 @@ sub main { . "level to REPEATABLE-READ.\n"; } + return; }; @@ -10131,6 +10131,20 @@ sub main { my $master_dbh = $master_cxn->dbh(); # just for brevity my $master_dsn = $master_cxn->dsn(); # just for brevity + if ($o->get('disable-qrt-plugin')) { + eval { + $master_dbh->selectrow_arrayref('SELECT @@query_response_time_session_stats' ); + }; + if ($EVAL_ERROR) { + $original_qrt_plugin_master_status = undef; + PTDEBUG && _d('QRT plugin is not installed: '.$EVAL_ERROR); + } else { + ($original_qrt_plugin_master_status) = $master_dbh->selectrow_arrayref('SELECT @@query_response_time_stats' ); + PTDEBUG && _d("Disabling qrt plugin on master server"); + $master_dbh->do('SET GLOBAL query_response_time_stats = off'); + } + } + my @ignored_engines = keys %{$o->get('ignore-engines')}; my @rocksdb_ignored = grep(/^ROCKSDB$/i, @ignored_engines); if (!@rocksdb_ignored) { @@ -10451,6 +10465,23 @@ sub main { } } + for my $slave (@$slaves) { + my $qrt_plugin_status; + eval { + ($qrt_plugin_status) = $slave->{dbh}->selectrow_arrayref('SELECT @@QUERY_RESPONSE_TIME_SESSION_STATS' ); + }; + if ($EVAL_ERROR) { + PTDEBUG && _d('QRT plugin is not installed on slave '.$slave->{dsn_name}); + $slave->{qrt_plugin_status} = undef; + next; + } + $slave->{qrt_plugin_status} = $qrt_plugin_status->[0]; + if ($slave->{qrt_plugin_status}) { + PTDEBUG && _d("Disabling qrt plugin state on slave ".$slave->{dsn_name}); + $slave->{dbh}->do('SET GLOBAL query_response_time_stats = off'); + } + } + if ( $o->get('check-slave-lag') ) { PTDEBUG && _d('Will use --check-slave-lag to check for slave lag'); my $cxn = $make_cxn->( @@ -11196,6 +11227,7 @@ sub main { # Update chunk-size based on rows/s checksum rate. $nibble_iter->set_chunk_size($tbl->{chunk_size}); + PTDEBUG && _d('Updated chunk size: '.$tbl->{chunk_size}); } # Every table should have a Progress obj; update it. @@ -11269,6 +11301,12 @@ sub main { map { $diff_chunks{ $_->{chunk} }++ } @$diffs; $exit_status |= $PTC_EXIT_STATUS{TABLE_DIFF}; } + my $max_cnt_diff=0; + for my $diff (@$diffs) { + if ( $diff->{cnt_diff} > $max_cnt_diff ) { + $tbl->{checksum_results}->{max_rows_cnt_diff} = $diff->{cnt_diff}; + } + } }; if ($EVAL_ERROR) { if ( $o->get('quiet') < 2 ) { @@ -11453,6 +11491,25 @@ sub main { } } + # Restore origin QRT pligin state + if ($o->get('disable-qrt-plugin')) { + eval { + if ($original_qrt_plugin_master_status) { + PTDEBUG && _d("Restoring qrt plugin state on master server"); + $master_dbh->do("SET GLOBAL query_response_time_stats = $original_qrt_plugin_master_status->[0]"); + } + for my $slave (@$slaves) { + if ($slave->{qrt_plugin_status}) { + PTDEBUG && _d("Restoring qrt plugin state on slave ".$slave->{dsn_name}); + $slave->{dbh}->do("SET GLOBAL query_response_time_stats = $slave->{qrt_plugin_status}"); + } + } + }; + if ($EVAL_ERROR) { + warn "Cannot restore qrt_plugin status: $EVAL_ERROR"; + } + } + PTDEBUG && _d('Exit status', $exit_status, 'oktorun', $oktorun, 'have time', $have_time->()); @@ -11703,8 +11760,8 @@ sub exec_nibble { } { -my $line_fmt = "%14s %6s %6s %8s %7s %7s %7s %-s\n"; -my @headers = qw(TS ERRORS DIFFS ROWS CHUNKS SKIPPED TIME TABLE); +my $line_fmt = "%14s %6s %6s %8s % 10s %7s %7s %7s %-s\n"; +my @headers = qw(TS ERRORS DIFFS ROWS DIFF_ROWS CHUNKS SKIPPED TIME TABLE); sub print_checksum_results { my (%args) = @_; @@ -11724,7 +11781,8 @@ sub print_checksum_results { ts(), $res->{errors} || 0, $res->{diffs} || 0, - $res->{n_rows} || 0, + $res->{n_rows} || 0, + $tbl->{checksum_results}->{max_rows_cnt_diff} || 0, $res->{n_chunks} || 0, $res->{skipped} || 0, sprintf('%.3f', $res->{start_time} ? time - $res->{start_time} : 0), @@ -13138,6 +13196,10 @@ short form: -F; type: string; group: Connection Only read mysql options from the given file. You must give an absolute pathname. +=item --disable-qrt-plugin + +Disable the QRT (Query Response Time) plugin if it is enabled. + =item --[no]empty-replicate-table default: yes @@ -13950,6 +14012,6 @@ Place, Suite 330, Boston, MA 02111-1307 USA. =head1 VERSION -pt-table-checksum 3.0.9 +pt-table-checksum 3.0.10-dev =cut diff --git a/lib/Percona/Test.pm b/lib/Percona/Test.pm index 2d2a952d..8d166ca6 100644 --- a/lib/Percona/Test.pm +++ b/lib/Percona/Test.pm @@ -656,14 +656,15 @@ sub test_bash_tool { } my %checksum_result_col = ( - ts => 0, - errors => 1, - diffs => 2, - rows => 3, - chunks => 4, - skipped => 5, - time => 6, - table => 7, + ts => 0, + errors => 1, + diffs => 2, + rows => 3, + diff_rows => 4, + chunks => 5, + skipped => 5, + time => 6, + table => 7, ); sub count_checksum_results { my ($output, $column, $table) = @_; @@ -696,7 +697,7 @@ sub normalize_checksum_results { open my $fh, ">", $tmp_file or die "Cannot open $tmp_file: $OS_ERROR"; printf $fh $output; close $fh; - my $normal_output = `cat $tmp_file | awk '/^[0-9 ]/ {print \$2 " " \$3 " " \$4 " " \$5 " " \$6 " " \$8} /^[A-Z]/ {print \$0}'`; + my $normal_output = `cat $tmp_file | awk '/^[0-9 ]/ {print \$2 " " \$3 " " \$4 " " \$5 " " \$6 " " \$7 " " \$9} /^[A-Z]/ {print \$0}'`; `rm $tmp_file >/dev/null`; return $normal_output; } diff --git a/lib/PerconaTest.pm b/lib/PerconaTest.pm index f324072b..40db20b5 100644 --- a/lib/PerconaTest.pm +++ b/lib/PerconaTest.pm @@ -692,14 +692,15 @@ sub test_bash_tool { } my %checksum_result_col = ( - ts => 0, - errors => 1, - diffs => 2, - rows => 3, - chunks => 4, - skipped => 5, - time => 6, - table => 7, + ts => 0, + errors => 1, + diffs => 2, + rows => 3, + diff_rows => 4, + chunks => 5, + skipped => 6, + time => 7, + table => 7, ); sub count_checksum_results { my ($output, $column, $table) = @_; @@ -732,7 +733,7 @@ sub normalize_checksum_results { open my $fh, ">", $tmp_file or die "Cannot open $tmp_file: $OS_ERROR"; printf $fh $output; close $fh; - my $normal_output = `cat $tmp_file | awk '/^[0-9 ]/ {print \$2 " " \$3 " " \$4 " " \$5 " " \$6 " " \$8} /^[A-Z]/ {print \$0}'`; + my $normal_output = `cat $tmp_file | awk '/^[0-9 ]/ {print \$2 " " \$3 " " \$4 " " \$5 " " \$6 " " \$7 " " \$9} /^[A-Z]/ {print \$0}'`; if ( wantarray ) { my $original_output = `cat $tmp_file`; return $normal_output, $original_output; diff --git a/lib/Sandbox.pm b/lib/Sandbox.pm index 474077e7..cec2b70d 100644 --- a/lib/Sandbox.pm +++ b/lib/Sandbox.pm @@ -211,6 +211,7 @@ sub wipe_clean { $self->wait_for_slaves(); + $self->clear_genlogs(); return; } @@ -391,7 +392,7 @@ sub verify_test_data { my @diffs; foreach my $c ( @checksums ) { next unless $c->{checksum}; - if ( $c->{checksum} ne $ref->{$c->{table}}->{checksum} ) { + if ( $ref->{$c->{table}} && $c->{checksum} ne $ref->{$c->{table}}->{checksum} ) { push @diffs, $c->{table}; } } diff --git a/lib/bash/report_mysql_info.sh b/lib/bash/report_mysql_info.sh index 660b039d..0f874932 100644 --- a/lib/bash/report_mysql_info.sh +++ b/lib/bash/report_mysql_info.sh @@ -1270,26 +1270,19 @@ report_jemalloc_enabled() { local JEMALLOC_LOCATION='' 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 - echo "jemalloc is not enabled in MySQL config for process with ID ${PID}" + grep -qc jemalloc /proc/${pid}/environ || ldd $(which mysqld) 2>/dev/null | grep -qc jemalloc + jemalloc_status=$? + if [ $jemalloc_status = 1 ]; then + echo "jemalloc is not enabled in mysql config for process with id ${pid}" else - echo "jemalloc enabled in MySQL config for process with ID ${PID}" + echo "jemalloc enabled in mysql config for process with id ${pid}" GENERAL_JEMALLOC_STATUS=1 fi done - if [ $GENERAL_JEMALLOC_STATUS = 1 ]; then - # Check location for libjemalloc.so.1 - #for libjemall in "${SCRIPT_PWD}/lib/mysql" "/usr/lib64" "/usr/lib/x86_64-linux-gnu" "/usr/lib"; do - for libjemall in "/usr/lib64" "/usr/lib/x86_64-linux-gnu" "/usr/lib"; do - if [ -r "$libjemall/libjemalloc.so.1" ]; then - JEMALLOC_LOCATION="$libjemall/libjemalloc.so.1" - break - fi - done - if [ -z $JEMALLOC_LOCATION ]; then + if [ $GENERAL_JEMALLOC_STATUS -eq 1 ]; then + JEMALLOC_LOCATION=$(find /usr/lib64/ /usr/lib/x86_64-linux-gnu /usr/lib -name "libjemalloc.*" 2>/dev/null | head -n 1) + if [ -z "$JEMALLOC_LOCATION" ]; then echo "Jemalloc library not found" else echo "Using jemalloc from $JEMALLOC_LOCATION" diff --git a/sandbox/servers/5.5/data.tar.gz b/sandbox/servers/5.5/data.tar.gz index 129b3c6a..6efc84e2 100644 Binary files a/sandbox/servers/5.5/data.tar.gz and b/sandbox/servers/5.5/data.tar.gz differ diff --git a/sandbox/servers/5.5/my.sandbox.cnf b/sandbox/servers/5.5/my.sandbox.cnf index f47ab48d..30010771 100644 --- a/sandbox/servers/5.5/my.sandbox.cnf +++ b/sandbox/servers/5.5/my.sandbox.cnf @@ -24,5 +24,4 @@ report-host = 127.0.0.1 report-port = PORT log-error = /tmp/PORT/data/mysqld.log innodb_lock_wait_timeout = 3 -general_log -general_log_file = genlog +secure-file-priv = diff --git a/sandbox/servers/5.7/my.sandbox.cnf b/sandbox/servers/5.7/my.sandbox.cnf index d751c55c..97d4662d 100644 --- a/sandbox/servers/5.7/my.sandbox.cnf +++ b/sandbox/servers/5.7/my.sandbox.cnf @@ -26,16 +26,16 @@ log-error = /tmp/PORT/data/mysqld.log innodb_lock_wait_timeout = 3 general_log general_log_file = genlog -lower_case_table_names = 0 -slow-query-log = 0 -slow-query-log-file = /tmp/PORT/data/slow.log -log_slow_admin_statements = 1 -long_query_time = 0 +#lower_case_table_names = 0 +#slow-query-log = 0 +#slow-query-log-file = /tmp/PORT/data/slow.log +#log_slow_admin_statements = 1 +#long_query_time = 0 #character-set-server = utf8 # fkc test binlog_format = STATEMENT -performance_schema = ON +#performance_schema = ON #performance-schema-instrument='wait/lock/metadata/sql/mdl=ON' #performance-schema-instrument='transaction=ON' secure-file-priv = diff --git a/t/lib/MockSyncStream.t b/t/lib/MockSyncStream.t index c90f7d9d..79b7992d 100644 --- a/t/lib/MockSyncStream.t +++ b/t/lib/MockSyncStream.t @@ -173,9 +173,9 @@ SKIP: { d => $DBD::mysql::VERSION ge '4.001' ? undef : '(7)', dt => undef, ts => undef, - c => '(1)', - c2 => '(15)', - v => '(32)', + c => '(3)', + c2 => '(45)', + v => '(96)', t => undef, }, }, diff --git a/t/lib/Quoter.t b/t/lib/Quoter.t index 34e9fb52..b07c10af 100644 --- a/t/lib/Quoter.t +++ b/t/lib/Quoter.t @@ -16,6 +16,7 @@ use Quoter; use PerconaTest; use DSNParser; use Sandbox; + my $dp = new DSNParser(opts=>$dsn_opts); my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp); my $dbh = $sb->get_dbh_for('master'); @@ -173,6 +174,12 @@ SKIP: { $dbh->do('CREATE DATABASE IF NOT EXISTS serialize_test'); $dbh->do('DROP TABLE IF EXISTS serialize_test.serialize'); $dbh->do('CREATE TABLE serialize_test.serialize (id INT, textval TEXT, blobval BLOB)'); + # Ensure we are using lantin1 as the default for the connection + # From the documentation: + # This statement sets the three session system variables character_set_client, + # character_set_connection, and character_set_results to the given character set. + $dbh->do("SET NAMES 'latin1'"); + warn Data::Dumper::Dumper($dbh); my $sth = $dbh->prepare( "INSERT INTO serialize_test.serialize VALUES (?, ?, ?)" diff --git a/t/lib/TableChecksum.t b/t/lib/TableChecksum.t index 6d8d09ee..de529ddd 100644 --- a/t/lib/TableChecksum.t +++ b/t/lib/TableChecksum.t @@ -626,7 +626,7 @@ is_deeply( is_deeply( [$c->get_crc_type($dbh, 'MD5')], - [qw(varchar 32)], + [qw(varchar 96)], 'Type and length of MD5' ); diff --git a/t/pt-archiver/issue_1225.t b/t/pt-archiver/issue_1225.t index 433d5e0d..2c99fc23 100644 --- a/t/pt-archiver/issue_1225.t +++ b/t/pt-archiver/issue_1225.t @@ -10,6 +10,7 @@ use strict; use warnings FATAL => 'all'; use English qw(-no_match_vars); use Test::More; +use utf8; use PerconaTest; use Sandbox; diff --git a/t/pt-archiver/issue_1229.t b/t/pt-archiver/issue_1229.t index 597cb76f..9a0f01a6 100644 --- a/t/pt-archiver/issue_1229.t +++ b/t/pt-archiver/issue_1229.t @@ -14,6 +14,8 @@ use Data::Dumper; use PerconaTest; use Sandbox; +use utf8; + require "$trunk/bin/pt-archiver"; my $dp = new DSNParser(opts=>$dsn_opts); diff --git a/t/pt-find/pt-find.t b/t/pt-find/pt-find.t index 1b2da840..870deedb 100644 --- a/t/pt-find/pt-find.t +++ b/t/pt-find/pt-find.t @@ -191,13 +191,13 @@ SKIP: { is( $output, "`sakila`.`actor_info` - `sakila`.`customer_list` - `sakila`.`film_list` - `sakila`.`nicer_but_slower_film_list` - `sakila`.`sales_by_film_category` - `sakila`.`sales_by_store` - `sakila`.`staff_list` - ", +`sakila`.`customer_list` +`sakila`.`film_list` +`sakila`.`nicer_but_slower_film_list` +`sakila`.`sales_by_film_category` +`sakila`.`sales_by_store` +`sakila`.`staff_list` +", '--datasize NULL', ); }; diff --git a/t/pt-mext/samples/mext-001-result.txt b/t/pt-mext/samples/mext-001-result.txt index 368f1542..83044c9e 100644 --- a/t/pt-mext/samples/mext-001-result.txt +++ b/t/pt-mext/samples/mext-001-result.txt @@ -47,6 +47,7 @@ Com_lock_tables 37 0 0 0 Com_optimize 1 0 0 0 Com_preload_keys 0 0 0 0 Com_prepare_sql 0 0 0 0 +Compression 0 0 0 0 Com_purge 0 0 0 0 Com_purge_before_date 0 0 0 0 Com_rename_table 0 0 0 0 @@ -107,7 +108,6 @@ Com_xa_prepare 0 0 0 0 Com_xa_recover 0 0 0 0 Com_xa_rollback 0 0 0 0 Com_xa_start 0 0 0 0 -Compression 0 0 0 0 Connections 1008 0 0 0 Created_tmp_disk_tables 350 0 0 0 Created_tmp_files 6 0 0 0 @@ -160,8 +160,8 @@ Innodb_os_log_fsyncs 2505 0 0 0 Innodb_os_log_pending_fsyncs 0 0 0 0 Innodb_os_log_pending_writes 0 0 0 0 Innodb_os_log_written 11063296 0 0 0 -Innodb_page_size 16384 0 0 0 Innodb_pages_created 542 0 0 0 +Innodb_page_size 16384 0 0 0 Innodb_pages_read 0 0 0 0 Innodb_pages_written 1071 0 0 0 Innodb_row_lock_current_waits 0 0 0 0 @@ -187,10 +187,10 @@ Ndb_config_from_host 0 0 0 0 Ndb_config_from_port 0 0 0 0 Ndb_number_of_data_nodes 0 0 0 0 Not_flushed_delayed_rows 0 0 0 0 +Opened_tables 1698 0 0 0 Open_files 5 0 0 0 Open_streams 0 0 0 0 Open_tables 1 0 0 0 -Opened_tables 1698 0 0 0 Prepared_stmt_count 0 0 0 0 Qcache_free_blocks 0 0 0 0 Qcache_free_memory 0 0 0 0 diff --git a/t/pt-mext/samples/mext-002-result.txt b/t/pt-mext/samples/mext-002-result.txt index 27dad458..ddd10813 100644 --- a/t/pt-mext/samples/mext-002-result.txt +++ b/t/pt-mext/samples/mext-002-result.txt @@ -47,6 +47,7 @@ Com_lock_tables 37 0 0 0 Com_optimize 1 0 0 0 Com_preload_keys 0 0 0 0 Com_prepare_sql 0 0 0 0 +Compression 0 0 0 0 Com_purge 0 0 0 0 Com_purge_before_date 0 0 0 0 Com_rename_table 0 0 0 0 @@ -107,7 +108,6 @@ Com_xa_prepare 0 0 0 0 Com_xa_recover 0 0 0 0 Com_xa_rollback 0 0 0 0 Com_xa_start 0 0 0 0 -Compression 0 0 0 0 Connections 1009 0 0 0 Created_tmp_disk_tables 350 0 0 0 Created_tmp_files 6 0 0 0 @@ -160,8 +160,8 @@ Innodb_os_log_fsyncs 2505 0 0 0 Innodb_os_log_pending_fsyncs 0 0 0 0 Innodb_os_log_pending_writes 0 0 0 0 Innodb_os_log_written 11063296 0 0 0 -Innodb_page_size 16384 0 0 0 Innodb_pages_created 542 0 0 0 +Innodb_page_size 16384 0 0 0 Innodb_pages_read 0 0 0 0 Innodb_pages_written 1071 0 0 0 Innodb_row_lock_current_waits 0 0 0 0 @@ -187,10 +187,10 @@ Ndb_config_from_host 0 0 0 0 Ndb_config_from_port 0 0 0 0 Ndb_number_of_data_nodes 0 0 0 0 Not_flushed_delayed_rows 0 0 0 0 +Opened_tables 1698 0 0 0 Open_files 5 0 0 0 Open_streams 0 0 0 0 Open_tables 1 0 0 0 -Opened_tables 1698 0 0 0 Prepared_stmt_count 0 0 0 0 Qcache_free_blocks 0 0 0 0 Qcache_free_memory 0 0 0 0 diff --git a/t/pt-mysql-summary/samples/expected_output_temp002.txt b/t/pt-mysql-summary/samples/expected_output_temp002.txt index 070af6a3..b7b7a5e2 100644 --- a/t/pt-mysql-summary/samples/expected_output_temp002.txt +++ b/t/pt-mysql-summary/samples/expected_output_temp002.txt @@ -277,5 +277,3 @@ 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_temp003.txt b/t/pt-mysql-summary/samples/expected_output_temp003.txt index 0e919522..e5b20824 100644 --- a/t/pt-mysql-summary/samples/expected_output_temp003.txt +++ b/t/pt-mysql-summary/samples/expected_output_temp003.txt @@ -220,5 +220,3 @@ 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_temp004.txt b/t/pt-mysql-summary/samples/expected_output_temp004.txt index 6961496d..55cd02a8 100644 --- a/t/pt-mysql-summary/samples/expected_output_temp004.txt +++ b/t/pt-mysql-summary/samples/expected_output_temp004.txt @@ -219,5 +219,3 @@ 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_temp005.txt b/t/pt-mysql-summary/samples/expected_output_temp005.txt index 95cbb20f..3f48c826 100644 --- a/t/pt-mysql-summary/samples/expected_output_temp005.txt +++ b/t/pt-mysql-summary/samples/expected_output_temp005.txt @@ -292,5 +292,3 @@ 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_temp006.txt b/t/pt-mysql-summary/samples/expected_output_temp006.txt index d8788b2b..10b79804 100644 --- a/t/pt-mysql-summary/samples/expected_output_temp006.txt +++ b/t/pt-mysql-summary/samples/expected_output_temp006.txt @@ -341,5 +341,3 @@ 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_temp007.txt b/t/pt-mysql-summary/samples/expected_output_temp007.txt index 50116ee3..bd784839 100644 --- a/t/pt-mysql-summary/samples/expected_output_temp007.txt +++ b/t/pt-mysql-summary/samples/expected_output_temp007.txt @@ -295,5 +295,3 @@ 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-online-schema-change/basics.t b/t/pt-online-schema-change/basics.t index 7fee8cb0..6c151fa9 100644 --- a/t/pt-online-schema-change/basics.t +++ b/t/pt-online-schema-change/basics.t @@ -843,10 +843,8 @@ diag("Reloading sakila"); my $master_port = $sb->port_for('master'); system "$trunk/sandbox/load-sakila-db $master_port &"; -$sb->do_as_root("master", q/GRANT REPLICATION SLAVE ON *.* TO 'slave_user'@'%' IDENTIFIED BY 'slave_password'/); -$sb->do_as_root("master", q/set sql_log_bin=0/); -$sb->do_as_root("master", q/DROP USER 'slave_user'/); -$sb->do_as_root("master", q/set sql_log_bin=1/); +$sb->do_as_root("slave1", q/CREATE USER 'slave_user'@'%' IDENTIFIED BY 'slave_password'/); +$sb->do_as_root("slave1", q/GRANT REPLICATION SLAVE ON *.* TO 'slave_user'@'%'/); test_alter_table( name => "--slave-user --slave-password", @@ -861,6 +859,8 @@ test_alter_table( # ############################################################################# # Done. # ############################################################################# +$sb->do_as_root("slave1", q/DROP USER 'slave_user'@'%'/); + $sb->wipe_clean($master_dbh); ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox"); # diff --git a/t/pt-online-schema-change/preserve_triggers.t b/t/pt-online-schema-change/preserve_triggers.t index 85ee1132..5137f251 100644 --- a/t/pt-online-schema-change/preserve_triggers.t +++ b/t/pt-online-schema-change/preserve_triggers.t @@ -468,6 +468,7 @@ test_alter_table( # Done. # ############################################################################# $sb->wipe_clean($master_dbh); +$sb->wait_for_slaves(); ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox"); # done_testing; diff --git a/t/pt-online-schema-change/pt-1455.t b/t/pt-online-schema-change/pt-1455.t index 3861019d..20f450d6 100644 --- a/t/pt-online-schema-change/pt-1455.t +++ b/t/pt-online-schema-change/pt-1455.t @@ -21,7 +21,11 @@ use Sandbox; use SqlModes; use File::Temp qw/ tempdir /; -plan tests => 3; +if (!$ENV{PERCONA_SLOW_BOX}) { + plan skip_all => 'This test needs a fast machine'; +} else { + plan tests => 3; +} require "$trunk/bin/pt-online-schema-change"; @@ -53,7 +57,7 @@ my $num_rows = 1000; my $master_port = 12345; diag("Loading $num_rows into the table. This might take some time."); -diag(`util/mysql_random_data_load_linux_amd64 --host=127.1 --port=$master_port --user=msandbox --password=msandbox employees t1 $num_rows`); +diag(`util/mysql_random_data_load --host=127.0.0.1 --port=$master_port --user=msandbox --password=msandbox employees t1 $num_rows`); diag("$num_rows rows loaded. Starting tests."); $master_dbh->do("FLUSH TABLES"); diff --git a/t/pt-online-schema-change/pt-229.t b/t/pt-online-schema-change/pt-229.t index d91d1fdf..2b8ed8c3 100644 --- a/t/pt-online-schema-change/pt-229.t +++ b/t/pt-online-schema-change/pt-229.t @@ -46,7 +46,7 @@ $sb->load_file('master', "t/pt-online-schema-change/samples/pt-229.sql"); my $num_rows = 40000; diag("Loading $num_rows into the table. This might take some time."); -diag(`util/mysql_random_data_load --host=127.1 --port=12345 --user=msandbox --password=msandbox test test_a $num_rows`); +diag(`util/mysql_random_data_load --host=127.0.0.1 --port=12345 --user=msandbox --password=msandbox test test_a $num_rows`); diag("$num_rows rows loaded. Starting tests."); $master_dbh->do("FLUSH TABLES"); diff --git a/t/pt-online-schema-change/pt-244.t b/t/pt-online-schema-change/pt-244.t index 79d396b4..f3e351a1 100644 --- a/t/pt-online-schema-change/pt-244.t +++ b/t/pt-online-schema-change/pt-244.t @@ -53,7 +53,7 @@ $sb->load_file('master3', "t/pt-online-schema-change/samples/pt-244.sql"); my $num_rows = 1000; diag("Loading $num_rows into the table. This might take some time."); -diag(`util/mysql_random_data_load_linux_amd64 --host=127.1 --port=$master3_port --user=msandbox --password=msandbox test t3 $num_rows`); +diag(`util/mysql_random_data_load --host=127.0.0.1 --port=$master3_port --user=msandbox --password=msandbox test t3 $num_rows`); diag("$num_rows rows loaded. Starting tests."); $dbh3->do("FLUSH TABLES"); diff --git a/t/pt-online-schema-change/slave_lag.t b/t/pt-online-schema-change/slave_lag.t index 58c13f70..d5da5dbb 100644 --- a/t/pt-online-schema-change/slave_lag.t +++ b/t/pt-online-schema-change/slave_lag.t @@ -19,7 +19,11 @@ use Sandbox; use SqlModes; use File::Temp qw/ tempdir /; -plan tests => 4; +if ($ENV{PERCONA_SLOW_BOX}) { + plan skip_all => 'This test needs a fast machine'; +} else { + plan tests => 4; +} our $delay = 30; my $tmp_file = File::Temp->new(); @@ -32,7 +36,7 @@ my $dp = new DSNParser(opts=>$dsn_opts); my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp); my $master_dbh = $sb->get_dbh_for('master'); my $slave_dbh = $sb->get_dbh_for('slave1'); -my $master_dsn = 'h=127.1,P=12345,u=msandbox,p=msandbox'; +my $master_dsn = 'h=127.0.0.1,P=12345,u=msandbox,p=msandbox'; if ( !$master_dbh ) { plan skip_all => 'Cannot connect to sandbox master'; @@ -65,7 +69,7 @@ $sb->load_file('master', "t/pt-online-schema-change/samples/slave_lag.sql"); my $num_rows = 10000; diag("Loading $num_rows into the table. This might take some time."); -diag(`util/mysql_random_data_load --host=127.1 --port=12345 --user=msandbox --password=msandbox test pt178 $num_rows`); +diag(`util/mysql_random_data_load --host=127.0.0.1 --port=12345 --user=msandbox --password=msandbox test pt178 $num_rows`); # Run a full table scan query to ensure the slave is behind the master # There is no query cache in MySQL 8.0+ @@ -89,7 +93,7 @@ like( # Repeat the test now using --check-slave-lag $args = "$master_dsn,D=test,t=pt178 --execute --chunk-size 1 --max-lag 5 --alter 'ENGINE=InnoDB' " - . "--check-slave-lag h=127.1,P=12346,u=msandbox,p=msandbox,D=test,t=sbtest"; + . "--check-slave-lag h=127.0.0.1,P=12346,u=msandbox,p=msandbox,D=test,t=sbtest"; # Run a full table scan query to ensure the slave is behind the master reset_query_cache($master_dbh, $master_dbh); diff --git a/t/pt-table-checksum/basics.t b/t/pt-table-checksum/basics.t index 08cf4fbb..00ae9da9 100644 --- a/t/pt-table-checksum/basics.t +++ b/t/pt-table-checksum/basics.t @@ -73,7 +73,7 @@ ok( no_diff( sub { pt_table_checksum::main(@args) }, "$sample/default-results-$sandbox_version.txt", - post_pipe => 'awk \'{print $2 " " $3 " " $4 " " $6 " " $8}\'', + post_pipe => 'awk \'{print $2 " " $3 " " $4 " " $7 " " $9}\'', ), "Default checksum" ); @@ -85,6 +85,7 @@ ok( # 2 $row = $master_dbh->selectrow_arrayref("select count(*) from percona.checksums"); my $max_chunks = $sandbox_version < '5.7' ? 60 : 100; + ok( $row->[0] > 25 && $row->[0] < $max_chunks, 'Between 25 and 60 chunks' @@ -98,7 +99,7 @@ ok( no_diff( sub { pt_table_checksum::main(@args, qw(--chunk-time 0)) }, "$sample/static-chunk-size-results-$sandbox_version.txt", - post_pipe => 'awk \'{print $2 " " $3 " " $4 " " $5 " " $6 " " $8}\'', + post_pipe => 'awk \'{print $2 " " $3 " " $4 " " $6 " " $7 " " $9}\'', ), "Static chunk size (--chunk-time 0)" ); diff --git a/t/pt-table-checksum/char_chunking.t b/t/pt-table-checksum/char_chunking.t index 3b92bc8e..e6836b11 100644 --- a/t/pt-table-checksum/char_chunking.t +++ b/t/pt-table-checksum/char_chunking.t @@ -34,7 +34,7 @@ my @args = ($master_dsn, qw(--set-vars innodb_lock_wait_timeout=3), '--max $sb->create_dbs($master_dbh, ['test']); $sb->load_file('master', "t/lib/samples/char-chunking/ascii.sql", 'test'); - +#1 ok( no_diff( sub { pt_table_checksum::main(@args, @@ -44,14 +44,14 @@ ok( ), "Char chunk ascii, explain" ); - +#2 ok( no_diff( sub { pt_table_checksum::main(@args, qw(--tables test.ascii --chunk-index c --chunk-size 20), qw(--chunk-time 0)) }, "t/pt-table-checksum/samples/char-chunk-ascii.txt", - post_pipe => 'awk \'{print $2 " " $3 " " $4 " " $5 " " $6 " " $8}\'', + post_pipe => 'awk \'{print $2 " " $3 " " $4 " " $6 " " $7 " " $9}\'', ), "Char chunk ascii, chunk size 20" ); diff --git a/t/pt-table-checksum/create_replicate_table.t b/t/pt-table-checksum/create_replicate_table.t index 2a40fb5a..bb2e7977 100644 --- a/t/pt-table-checksum/create_replicate_table.t +++ b/t/pt-table-checksum/create_replicate_table.t @@ -50,6 +50,7 @@ $sb->wipe_clean($master_dbh); eval { pt_table_checksum::main(@args, '--no-create-replicate-table'); }; +#1 like( $EVAL_ERROR, qr/--replicate database percona does not exist/, @@ -61,6 +62,7 @@ $master_dbh->do('use percona'); eval { pt_table_checksum::main(@args, '--no-create-replicate-table'); }; +#2 like( $EVAL_ERROR, qr/--replicate table `percona`.`checksums` does not exist/, @@ -90,11 +92,12 @@ $output = output( sub { pt_table_checksum::main(@args, '--no-create-replicate-table', qw(-t sakila.country)) }, ); +#3 like( $output, - qr/^\S+\s+0\s+0\s+109\s+1\s+0\s+\S+\s+sakila.country$/m, + qr/^\S+\s+0\s+0\s+109\s+0\s+1\s+0\s+\S+\s+sakila.country$/m, "Uses pre-created replicate table" -); +) or diag($output); # ############################################################################ # Issue 1318: mk-tabke-checksum --create-replicate-table doesn't replicate diff --git a/t/pt-table-checksum/error_handling.t b/t/pt-table-checksum/error_handling.t index bcf19045..baf881fb 100644 --- a/t/pt-table-checksum/error_handling.t +++ b/t/pt-table-checksum/error_handling.t @@ -61,13 +61,13 @@ $output = output( qw(--chunk-time 0 --chunk-size 100) ) }, stderr => 1, ); - +#1 like( $output, qr/MySQL error 1265: Data truncated/, "MySQL error 1265: Data truncated for column" ); - +#2 my (@errors) = $output =~ m/error/; is( scalar @errors, @@ -91,16 +91,16 @@ $output = output( my $original_output; ($output, $original_output) = PerconaTest::normalize_checksum_results($output); - +#3 like( $original_output, qr/Lock wait timeout exceeded/, "Warns about lock wait timeout" ); - +#4 like( $output, - qr/^0 0 0 1 1 sakila.city/m, + qr/^0 0 0 0 1 1 sakila.city/m, "Skips chunk that times out" ); @@ -129,7 +129,7 @@ unlike( like( $output, - qr/^0 0 600 1 0 sakila.city/m, + qr/^0 0 600 0 1 0 sakila.city/m, "Checksum retried after lock wait timeout" ); diff --git a/t/pt-table-checksum/issue_388.t b/t/pt-table-checksum/issue_388.t index e2fb24af..830c140d 100644 --- a/t/pt-table-checksum/issue_388.t +++ b/t/pt-table-checksum/issue_388.t @@ -56,7 +56,7 @@ unlike( like( $output, - qr/^\S+\s+0\s+0\s+1\s+1\s+/m, + qr/^\S+\s+0\s+0\s+1\s+0\s+1\s+/m, 'Checksums the table (issue 388)' ); diff --git a/t/pt-table-checksum/pt-131.t b/t/pt-table-checksum/pt-131.t new file mode 100644 index 00000000..5db7c654 --- /dev/null +++ b/t/pt-table-checksum/pt-131.t @@ -0,0 +1,68 @@ +#!/usr/bin/env perl + +BEGIN { + die "The PERCONA_TOOLKIT_BRANCH environment variable is not set.\n" + unless $ENV{PERCONA_TOOLKIT_BRANCH} && -d $ENV{PERCONA_TOOLKIT_BRANCH}; + unshift @INC, "$ENV{PERCONA_TOOLKIT_BRANCH}/lib"; +}; + +use strict; +use warnings FATAL => 'all'; +use English qw(-no_match_vars); +use Test::More; + +use PerconaTest; +use Sandbox; +use SqlModes; +require "$trunk/bin/pt-table-checksum"; + +my $dp = new DSNParser(opts=>$dsn_opts); +my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp); +my $dbh = $sb->get_dbh_for('master'); +my $sb_version = VersionParser->new($dbh); +my $rows = $dbh->selectall_hashref("SHOW VARIABLES LIKE '%version%'", ['variable_name']); + +if ( !$dbh ) { + plan skip_all => 'Cannot connect to sandbox master'; +} elsif ( $sb_version < '5.7.21' || !($rows->{version_comment}->{value} =~ m/percona server/i) ) { + plan skip_all => 'This test file needs Percona Server 5.7.21.21+'; +} else { + plan tests => 3; +} + +eval { + $dbh->selectrow_arrayref('SELECT @@query_response_time_session_stats' ); +}; +if ($EVAL_ERROR) { + $sb->load_file('master', 't/pt-table-checksum/samples/pt-131.sql'); +} +# The sandbox servers run with lock_wait_timeout=3 and it is 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 $output; +my $exit_status; +$ENV{PTDEBUG} = 1; + +my $cmd ="PTDEBUG=1 $trunk/bin/pt-table-checksum $master_dsn --disable-qrt-plugin 2>&1"; + +$output = `$cmd`; +like ( + $output, + qr/Restoring qrt plugin state/, + "QRT plugin status has been restored", +); + +like ( + $output, + qr/Disabling qrt plugin on master server/, + "QRT plugin has been disabled", +); +delete $ENV{PTDEBUG}; + +# ############################################################################# +# Done. +# ############################################################################# +$sb->wipe_clean($dbh); +ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox"); +exit; diff --git a/t/pt-table-checksum/pt-226.t b/t/pt-table-checksum/pt-226.t index 09eb0ae0..55c36d83 100644 --- a/t/pt-table-checksum/pt-226.t +++ b/t/pt-table-checksum/pt-226.t @@ -63,7 +63,7 @@ isnt( like( $output, - qr/1\s+100\s+1\s+0\s+.*test.joinit/, + qr/1\s+100\s+0\s+1\s+0\s+.*test.joinit/, "PT-226 table joinit has differences", ); diff --git a/t/pt-table-checksum/resume.t b/t/pt-table-checksum/resume.t index 90fd4761..42c12b51 100644 --- a/t/pt-table-checksum/resume.t +++ b/t/pt-table-checksum/resume.t @@ -441,10 +441,10 @@ is( "Checking if all tables can be checksummed ... Starting checksum ... Resuming from sakila.rental chunk 11, timestamp 2011-10-15 13:00:49 -ERRORS DIFFS ROWS CHUNKS SKIPPED TABLE -0 0 5044 8 0 sakila.rental -0 0 2 1 0 sakila.staff -0 0 2 1 0 sakila.store +ERRORS DIFFS ROWS DIFF_ROWS CHUNKS SKIPPED TABLE +0 0 5044 0 8 0 sakila.rental +0 0 2 0 1 0 sakila.staff +0 0 2 0 1 0 sakila.store ", "Resumed from last updated chunk" ); @@ -497,8 +497,8 @@ is( $output, "Checking if all tables can be checksummed ... Starting checksum ... -ERRORS DIFFS ROWS CHUNKS SKIPPED TABLE -0 0 26 8 0 test.t3 +ERRORS DIFFS ROWS DIFF_ROWS CHUNKS SKIPPED TABLE +0 0 26 0 8 0 test.t3 ", "Resumed from t3" ); diff --git a/t/pt-table-checksum/samples/char-chunk-ascii.txt b/t/pt-table-checksum/samples/char-chunk-ascii.txt index b698ffb7..000c4bc8 100644 --- a/t/pt-table-checksum/samples/char-chunk-ascii.txt +++ b/t/pt-table-checksum/samples/char-chunk-ascii.txt @@ -1,4 +1,4 @@ -if all tables can be ... +if all tables be checksummed checksum ... ERRORS DIFFS ROWS CHUNKS SKIPPED TABLE 0 0 142 10 0 test.ascii diff --git a/t/pt-table-checksum/samples/default-results-5.5.txt b/t/pt-table-checksum/samples/default-results-5.5.txt index 35b2b3ed..075ab95f 100644 --- a/t/pt-table-checksum/samples/default-results-5.5.txt +++ b/t/pt-table-checksum/samples/default-results-5.5.txt @@ -1,3 +1,5 @@ +if all tables checksummed +checksum ... ERRORS DIFFS ROWS SKIPPED TABLE 0 0 0 0 mysql.columns_priv 0 0 0 0 mysql.db diff --git a/t/pt-table-checksum/samples/default-results-5.6.txt b/t/pt-table-checksum/samples/default-results-5.6.txt index 62e69530..ba8c6bc0 100644 --- a/t/pt-table-checksum/samples/default-results-5.6.txt +++ b/t/pt-table-checksum/samples/default-results-5.6.txt @@ -1,4 +1,4 @@ -if all tables be ... +if all tables checksummed checksum ... ERRORS DIFFS ROWS SKIPPED TABLE 0 0 0 0 mysql.columns_priv diff --git a/t/pt-table-checksum/samples/default-results-5.7.txt b/t/pt-table-checksum/samples/default-results-5.7.txt index ad2d8d54..3bc92c4c 100644 --- a/t/pt-table-checksum/samples/default-results-5.7.txt +++ b/t/pt-table-checksum/samples/default-results-5.7.txt @@ -1,4 +1,4 @@ -if all tables be ... +if all tables checksummed checksum ... ERRORS DIFFS ROWS SKIPPED TABLE 0 0 0 0 mysql.columns_priv diff --git a/t/pt-table-checksum/samples/pt-131.sql b/t/pt-table-checksum/samples/pt-131.sql new file mode 100644 index 00000000..41ad10d8 --- /dev/null +++ b/t/pt-table-checksum/samples/pt-131.sql @@ -0,0 +1,16 @@ +-- See https://www.percona.com/doc/percona-server/LATEST/diagnostics/response_time_distribution.html + +-- This plugin is used for gathering statistics. +INSTALL PLUGIN QUERY_RESPONSE_TIME_AUDIT SONAME 'query_response_time.so'; + +-- This plugin provides the interface (QUERY_RESPONSE_TIME) to output gathered statistics. +INSTALL PLUGIN QUERY_RESPONSE_TIME SONAME 'query_response_time.so'; + +-- This plugin provides the interface (QUERY_RESPONSE_TIME_READ) to output gathered statistics. +INSTALL PLUGIN QUERY_RESPONSE_TIME_READ SONAME 'query_response_time.so'; + +-- This plugin provides the interface (QUERY_RESPONSE_TIME_WRITE) to output gathered statistics. +INSTALL PLUGIN QUERY_RESPONSE_TIME_WRITE SONAME 'query_response_time.so'; + +-- Start collecting query time metrics, +SET GLOBAL query_response_time_stats = on; diff --git a/t/pt-table-checksum/samples/static-chunk-size-results-5.5.txt b/t/pt-table-checksum/samples/static-chunk-size-results-5.5.txt index e9ae9590..c9a5ab57 100644 --- a/t/pt-table-checksum/samples/static-chunk-size-results-5.5.txt +++ b/t/pt-table-checksum/samples/static-chunk-size-results-5.5.txt @@ -1,3 +1,5 @@ +if all tables be checksummed +checksum ... ERRORS DIFFS ROWS CHUNKS SKIPPED TABLE 0 0 0 1 0 mysql.columns_priv 0 0 0 1 0 mysql.db diff --git a/t/pt-table-checksum/samples/static-chunk-size-results-5.6.txt b/t/pt-table-checksum/samples/static-chunk-size-results-5.6.txt index f96ea62b..3b524baa 100644 --- a/t/pt-table-checksum/samples/static-chunk-size-results-5.6.txt +++ b/t/pt-table-checksum/samples/static-chunk-size-results-5.6.txt @@ -1,4 +1,4 @@ -if all tables can be ... +if all tables be checksummed checksum ... ERRORS DIFFS ROWS CHUNKS SKIPPED TABLE 0 0 0 1 0 mysql.columns_priv diff --git a/t/pt-table-checksum/samples/static-chunk-size-results-5.7.txt b/t/pt-table-checksum/samples/static-chunk-size-results-5.7.txt index 47f15d02..ac552497 100644 --- a/t/pt-table-checksum/samples/static-chunk-size-results-5.7.txt +++ b/t/pt-table-checksum/samples/static-chunk-size-results-5.7.txt @@ -1,4 +1,4 @@ -if all tables can be ... +if all tables be checksummed checksum ... ERRORS DIFFS ROWS CHUNKS SKIPPED TABLE 0 0 0 1 0 mysql.columns_priv