diff --git a/lib/Sandbox.pm b/lib/Sandbox.pm index db98ef61..10beafc0 100644 --- a/lib/Sandbox.pm +++ b/lib/Sandbox.pm @@ -483,7 +483,6 @@ sub start_sandbox { if ( $type eq 'master') { my $out = `$env $trunk/sandbox/start-sandbox $type $port`; - warn "$env"; die $out if $CHILD_ERROR; } elsif ( $type eq 'slave' ) { diff --git a/sandbox/servers/5.7/data.tar.gz b/sandbox/servers/5.7/data.tar.gz old mode 100755 new mode 100644 index e7b0a4cb..dd0d679d Binary files a/sandbox/servers/5.7/data.tar.gz and b/sandbox/servers/5.7/data.tar.gz differ diff --git a/t/lib/QueryReportFormatter.t b/t/lib/QueryReportFormatter.t index 833e4603..e537462a 100644 --- a/t/lib/QueryReportFormatter.t +++ b/t/lib/QueryReportFormatter.t @@ -1137,7 +1137,8 @@ SKIP: { ); my $explain = load_file( - $sandbox_version eq '5.6' ? "t/lib/samples/QueryReportFormatter/report031.txt" + $sandbox_version ge '5.7' ? "t/lib/samples/QueryReportFormatter/report031-5.7.txt" + : $sandbox_version eq '5.6' ? "t/lib/samples/QueryReportFormatter/report031.txt" : $sandbox_version ge '5.1' ? "t/lib/samples/QueryReportFormatter/report025.txt" : "t/lib/samples/QueryReportFormatter/report026.txt"); diff --git a/t/lib/samples/QueryReportFormatter/report031-5.7.txt b/t/lib/samples/QueryReportFormatter/report031-5.7.txt new file mode 100644 index 00000000..1a429fda --- /dev/null +++ b/t/lib/samples/QueryReportFormatter/report031-5.7.txt @@ -0,0 +1,13 @@ +# *************************** 1. row *************************** +# id: 1 +# select_type: SIMPLE +# table: t +# partitions: NULL +# type: const +# possible_keys: PRIMARY +# key: PRIMARY +# key_len: 4 +# ref: const +# rows: 1 +# filtered: 100 +# Extra: NULL diff --git a/t/pt-query-digest/review.t b/t/pt-query-digest/review.t index df10af54..f9a282d4 100644 --- a/t/pt-query-digest/review.t +++ b/t/pt-query-digest/review.t @@ -55,6 +55,7 @@ $output = run_with("slow006.txt", qw(--create-review-table), my ($table) = $dbh->selectrow_array( "show tables from test like 'query_review'"); +# 1 is($table, 'query_review', '--create-review-table'); $output = run_with("slow006.txt", @@ -62,29 +63,32 @@ $output = run_with("slow006.txt", my $res = $dbh->selectall_arrayref( 'SELECT * FROM test.query_review', { Slice => {} } ); -my $expected = [ { checksum => '11676753765851784517', - reviewed_by => undef, - reviewed_on => undef, - last_seen => '2007-12-18 11:49:30', - first_seen => '2007-12-18 11:48:27', - sample => 'SELECT col FROM foo_tbl', - fingerprint => 'select col from foo_tbl', - comments => undef, - }, - { checksum => '15334040482108055940', - reviewed_by => undef, - reviewed_on => undef, - last_seen => '2007-12-18 11:49:07', - first_seen => '2007-12-18 11:48:57', - sample => 'SELECT col FROM bar_tbl', - fingerprint => 'select col from bar_tbl', - comments => undef, - }, - ]; +my $expected = [ + { + checksum => '11676753765851785216.00000000', + comments => undef, + fingerprint => 'select col from foo_tbl', + first_seen => '2007-12-18 11:48:27', + last_seen => '2007-12-18 11:49:30', + reviewed_by => undef, + reviewed_on => undef, + sample => 'SELECT col FROM foo_tbl' + }, + { + checksum => '15334040482108055552.00000000', + comments => undef, + fingerprint => 'select col from bar_tbl', + first_seen => '2007-12-18 11:48:57', + last_seen => '2007-12-18 11:49:07', + reviewed_by => undef, + reviewed_on => undef, + sample => 'SELECT col FROM bar_tbl' + } +]; normalize_numbers($res); -normalize_numbers($expected); +# 2 is_deeply( $res, $expected, @@ -138,22 +142,25 @@ ok( # Make sure that when we run with all-0 timestamps they don't show up in the # output because they are useless of course (issue 202). -# Since some sql_modes don't allow '0000-00-00' dates, to keep this test valid -# we simply remove them for a moment and then restore. -my $modes = new SqlModes($dbh); -$modes->del(qw(STRICT_TRANS_TABLES STRICT_ALL_TABLES NO_ZERO_IN_DATE NO_ZERO_DATE)); - -my $currmodes = $modes->get_modes_string(); - -$dbh->do("update test.query_review set first_seen='0000-00-00 00:00:00', " - . " last_seen='0000-00-00 00:00:00'"); -$output = run_with("slow022.txt", - '--review', "$dsn,D=test,t=query_review"); -unlike($output, qr/last_seen/, 'no last_seen when 0000 timestamp'); -unlike($output, qr/first_seen/, 'no first_seen when 0000 timestamp'); -unlike($output, qr/0000-00-00 00:00:00/, 'no 0000-00-00 00:00:00 timestamp'); - -$modes->restore_original_modes(); +SKIP: { + skip "MySQL 5.7 doesn't allow '0000-00-00' dates" if ($sandbox_version ge '5.7'); + # Since some sql_modes don't allow '0000-00-00' dates, to keep this test valid + # we simply remove them for a moment and then restore. + my $modes = new SqlModes($dbh); + $modes->del(qw(STRICT_TRANS_TABLES STRICT_ALL_TABLES NO_ZERO_IN_DATE NO_ZERO_DATE)); + + my $currmodes = $modes->get_modes_string(); + + $dbh->do("update test.query_review set first_seen='0000-00-00 00:00:00', " + . " last_seen='0000-00-00 00:00:00'"); + $output = run_with("slow022.txt", + '--review', "$dsn,D=test,t=query_review"); + unlike($output, qr/last_seen/, 'no last_seen when 0000 timestamp'); + unlike($output, qr/first_seen/, 'no first_seen when 0000 timestamp'); + unlike($output, qr/0000-00-00 00:00:00/, 'no 0000-00-00 00:00:00 timestamp'); + + $modes->restore_original_modes(); +} # ########################################################################## # XXX The following tests will cause non-deterministic data, so run them diff --git a/t/pt-show-grants/basics.t b/t/pt-show-grants/basics.t index 0ac60a70..8d954571 100644 --- a/t/pt-show-grants/basics.t +++ b/t/pt-show-grants/basics.t @@ -105,6 +105,7 @@ $modes->restore_original_modes(); my $postfix = $sandbox_version < '5.7' ? '' : '-57'; +# 11 ok( no_diff( sub { pt_show_grants::main('-F', $cnf, qw(--only sally --no-header)) }, @@ -115,6 +116,7 @@ ok( ); +# 12 ok( no_diff( sub { pt_show_grants::main('-F', $cnf, qw(--only sally --no-header), @@ -126,6 +128,7 @@ ok( ); +# 13 ok( no_diff( sub { pt_show_grants::main('-F', $cnf, qw(--only sally --no-header), @@ -139,6 +142,7 @@ ok( diag(`/tmp/12345/use -u root -e "GRANT SELECT ON sakila.city TO 'sally'\@'%'"`); +# 14 ok( no_diff( sub { pt_show_grants::main('-F', $cnf, qw(--only sally --no-header)) }, diff --git a/t/pt-show-grants/samples/column-grants-57.txt b/t/pt-show-grants/samples/column-grants-57.txt index 9980134f..59c38788 100644 --- a/t/pt-show-grants/samples/column-grants-57.txt +++ b/t/pt-show-grants/samples/column-grants-57.txt @@ -2,5 +2,5 @@ CREATE USER IF NOT EXISTS 'sally'@'%'; ALTER USER 'sally'@'%' IDENTIFIED WITH 'mysql_native_password' REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK; GRANT INSERT (city), SELECT (city_id) ON `sakila`.`city` TO 'sally'@'%'; -GRANT SELECT (SANumber, DateCreated, PaymentStat, PckPrice) ON `test`.`t` TO 'sally'@'%'; +GRANT SELECT (DateCreated, PaymentStat, PckPrice, SANumber) ON `test`.`t` TO 'sally'@'%'; GRANT USAGE ON *.* TO 'sally'@'%'; diff --git a/t/pt-show-grants/samples/column-grants-combined-57.txt b/t/pt-show-grants/samples/column-grants-combined-57.txt index edecce0b..26964043 100644 --- a/t/pt-show-grants/samples/column-grants-combined-57.txt +++ b/t/pt-show-grants/samples/column-grants-combined-57.txt @@ -2,5 +2,5 @@ CREATE USER IF NOT EXISTS 'sally'@'%'; ALTER USER 'sally'@'%' IDENTIFIED WITH 'mysql_native_password' REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK; GRANT INSERT (city), SELECT, SELECT (city_id) ON `sakila`.`city` TO 'sally'@'%'; -GRANT SELECT (SANumber, DateCreated, PaymentStat, PckPrice) ON `test`.`t` TO 'sally'@'%'; +GRANT SELECT (DateCreated, PaymentStat, PckPrice, SANumber) ON `test`.`t` TO 'sally'@'%'; GRANT USAGE ON *.* TO 'sally'@'%'; diff --git a/t/pt-show-grants/samples/column-grants-separate-57.txt b/t/pt-show-grants/samples/column-grants-separate-57.txt index 02bfe818..28bd8bc7 100644 --- a/t/pt-show-grants/samples/column-grants-separate-57.txt +++ b/t/pt-show-grants/samples/column-grants-separate-57.txt @@ -2,6 +2,6 @@ CREATE USER IF NOT EXISTS 'sally'@'%'; ALTER USER 'sally'@'%' IDENTIFIED WITH 'mysql_native_password' REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK; GRANT INSERT (city) ON `sakila`.`city` TO 'sally'@'%'; -GRANT SELECT (SANumber, DateCreated, PaymentStat, PckPrice) ON `test`.`t` TO 'sally'@'%'; +GRANT SELECT (DateCreated, PaymentStat, PckPrice, SANumber) ON `test`.`t` TO 'sally'@'%'; GRANT SELECT (city_id) ON `sakila`.`city` TO 'sally'@'%'; GRANT USAGE ON *.* TO 'sally'@'%'; diff --git a/t/pt-show-grants/samples/column-grants-separate-revoke-57.txt b/t/pt-show-grants/samples/column-grants-separate-revoke-57.txt index 083ad358..5df1b802 100644 --- a/t/pt-show-grants/samples/column-grants-separate-revoke-57.txt +++ b/t/pt-show-grants/samples/column-grants-separate-revoke-57.txt @@ -1,12 +1,12 @@ -- Revoke statements for 'sally'@'%' REVOKE INSERT (city) ON `sakila`.`city` FROM 'sally'@'%'; -REVOKE SELECT (SANumber, DateCreated, PaymentStat, PckPrice) ON `test`.`t` FROM 'sally'@'%'; +REVOKE SELECT (DateCreated, PaymentStat, PckPrice, SANumber) ON `test`.`t` FROM 'sally'@'%'; REVOKE SELECT (city_id) ON `sakila`.`city` FROM 'sally'@'%'; REVOKE USAGE ON *.* FROM 'sally'@'%'; -- Grants for 'sally'@'%' CREATE USER IF NOT EXISTS 'sally'@'%'; ALTER USER 'sally'@'%' IDENTIFIED WITH 'mysql_native_password' REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK; GRANT INSERT (city) ON `sakila`.`city` TO 'sally'@'%'; -GRANT SELECT (SANumber, DateCreated, PaymentStat, PckPrice) ON `test`.`t` TO 'sally'@'%'; +GRANT SELECT (DateCreated, PaymentStat, PckPrice, SANumber) ON `test`.`t` TO 'sally'@'%'; GRANT SELECT (city_id) ON `sakila`.`city` TO 'sally'@'%'; GRANT USAGE ON *.* TO 'sally'@'%'; diff --git a/t/pt-stalk/pt-stalk.t b/t/pt-stalk/pt-stalk.t index 08b333e2..a78d24fe 100644 --- a/t/pt-stalk/pt-stalk.t +++ b/t/pt-stalk/pt-stalk.t @@ -500,37 +500,33 @@ SKIP: { $output = `cat $dest/*-slave-status 2>/dev/null`; - if ( $sandbox_version lt '5.7' ) { - like( - $output, - qr/SHOW SLAVE STATUS/, - "MySQL 5.6 SLAVE STATUS" - ); - } else { - like( - $output, - qr/FROM performance_schema.replication_connection_configuration JOIN performance_schema.replication_applier_configuration USING/, - "MySQL 5.7 SLAVE STATUS" - ); - } + like( + $output, + qr/FROM performance_schema.replication_connection_configuration JOIN performance_schema.replication_applier_configuration USING/, + "MySQL 5.7 SLAVE STATUS" + ); $sb->stop_sandbox(qw(chan_master1 chan_master2 chan_slave1)); } -my $slave1_port = $sb->port_for('slave1'); -my $cmd = "$trunk/bin/pt-stalk --no-stalk --iterations=1 --host=127.0.0.1 --port=$slave1_port --user=msandbox " - . "--password=msandbox --sleep 0 --run-time=10 --dest $dest --log $log_file --iterations=1 " - . "--run-time=2 --pid $pid_file --defaults-file=$cnf >$log_file 2>&1"; -system($cmd); -sleep 5; -PerconaTest::kill_program(pid_file => $pid_file); - -$output = `cat $dest/*-slave-status 2>/dev/null`; - -like( - $output, - qr/SHOW SLAVE STATUS/, - "MySQL 5.6 SLAVE STATUS" -); +SKIP: { + skip "Only test on mysql 5.6" if ( $sandbox_version ne '5.6' ); + + my $slave1_port = $sb->port_for('slave1'); + my $cmd = "$trunk/bin/pt-stalk --no-stalk --iterations=1 --host=127.0.0.1 --port=$slave1_port --user=msandbox " + . "--password=msandbox --sleep 0 --run-time=10 --dest $dest --log $log_file --iterations=1 " + . "--run-time=2 --pid $pid_file --defaults-file=$cnf >$log_file 2>&1"; + system($cmd); + sleep 5; + PerconaTest::kill_program(pid_file => $pid_file); + + $output = `cat $dest/*-slave-status 2>/dev/null`; + + like( + $output, + qr/SHOW SLAVE STATUS/, + "MySQL 5.6 SLAVE STATUS" + ); +} # ############################################################################# # Done. diff --git a/t/pt-table-checksum/basics.t b/t/pt-table-checksum/basics.t index fa9a48a5..94e3f4ad 100644 --- a/t/pt-table-checksum/basics.t +++ b/t/pt-table-checksum/basics.t @@ -68,6 +68,7 @@ sub reset_repl_db { # in throttle.t. # ############################################################################ +# 1 ok( no_diff( sub { pt_table_checksum::main(@args) },