mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-09 18:30:16 +00:00
More 5.7 tests fixed
This commit is contained in:
@@ -483,7 +483,6 @@ sub start_sandbox {
|
|||||||
|
|
||||||
if ( $type eq 'master') {
|
if ( $type eq 'master') {
|
||||||
my $out = `$env $trunk/sandbox/start-sandbox $type $port`;
|
my $out = `$env $trunk/sandbox/start-sandbox $type $port`;
|
||||||
warn "$env";
|
|
||||||
die $out if $CHILD_ERROR;
|
die $out if $CHILD_ERROR;
|
||||||
}
|
}
|
||||||
elsif ( $type eq 'slave' ) {
|
elsif ( $type eq 'slave' ) {
|
||||||
|
BIN
sandbox/servers/5.7/data.tar.gz
Executable file → Normal file
BIN
sandbox/servers/5.7/data.tar.gz
Executable file → Normal file
Binary file not shown.
@@ -1137,7 +1137,8 @@ SKIP: {
|
|||||||
);
|
);
|
||||||
|
|
||||||
my $explain = load_file(
|
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"
|
: $sandbox_version ge '5.1' ? "t/lib/samples/QueryReportFormatter/report025.txt"
|
||||||
: "t/lib/samples/QueryReportFormatter/report026.txt");
|
: "t/lib/samples/QueryReportFormatter/report026.txt");
|
||||||
|
|
||||||
|
13
t/lib/samples/QueryReportFormatter/report031-5.7.txt
Normal file
13
t/lib/samples/QueryReportFormatter/report031-5.7.txt
Normal file
@@ -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
|
@@ -55,6 +55,7 @@ $output = run_with("slow006.txt", qw(--create-review-table),
|
|||||||
|
|
||||||
my ($table) = $dbh->selectrow_array(
|
my ($table) = $dbh->selectrow_array(
|
||||||
"show tables from test like 'query_review'");
|
"show tables from test like 'query_review'");
|
||||||
|
# 1
|
||||||
is($table, 'query_review', '--create-review-table');
|
is($table, 'query_review', '--create-review-table');
|
||||||
|
|
||||||
$output = run_with("slow006.txt",
|
$output = run_with("slow006.txt",
|
||||||
@@ -62,29 +63,32 @@ $output = run_with("slow006.txt",
|
|||||||
my $res = $dbh->selectall_arrayref( 'SELECT * FROM test.query_review',
|
my $res = $dbh->selectall_arrayref( 'SELECT * FROM test.query_review',
|
||||||
{ Slice => {} } );
|
{ Slice => {} } );
|
||||||
|
|
||||||
my $expected = [ { checksum => '11676753765851784517',
|
my $expected = [
|
||||||
reviewed_by => undef,
|
{
|
||||||
reviewed_on => undef,
|
checksum => '11676753765851785216.00000000',
|
||||||
last_seen => '2007-12-18 11:49:30',
|
comments => undef,
|
||||||
first_seen => '2007-12-18 11:48:27',
|
fingerprint => 'select col from foo_tbl',
|
||||||
sample => 'SELECT col FROM foo_tbl',
|
first_seen => '2007-12-18 11:48:27',
|
||||||
fingerprint => 'select col from foo_tbl',
|
last_seen => '2007-12-18 11:49:30',
|
||||||
comments => undef,
|
reviewed_by => undef,
|
||||||
},
|
reviewed_on => undef,
|
||||||
{ checksum => '15334040482108055940',
|
sample => 'SELECT col FROM foo_tbl'
|
||||||
reviewed_by => undef,
|
},
|
||||||
reviewed_on => undef,
|
{
|
||||||
last_seen => '2007-12-18 11:49:07',
|
checksum => '15334040482108055552.00000000',
|
||||||
first_seen => '2007-12-18 11:48:57',
|
comments => undef,
|
||||||
sample => 'SELECT col FROM bar_tbl',
|
fingerprint => 'select col from bar_tbl',
|
||||||
fingerprint => 'select col from bar_tbl',
|
first_seen => '2007-12-18 11:48:57',
|
||||||
comments => undef,
|
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($res);
|
||||||
normalize_numbers($expected);
|
|
||||||
|
|
||||||
|
# 2
|
||||||
is_deeply(
|
is_deeply(
|
||||||
$res,
|
$res,
|
||||||
$expected,
|
$expected,
|
||||||
@@ -138,22 +142,25 @@ ok(
|
|||||||
# Make sure that when we run with all-0 timestamps they don't show up in the
|
# 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).
|
# 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
|
SKIP: {
|
||||||
# we simply remove them for a moment and then restore.
|
skip "MySQL 5.7 doesn't allow '0000-00-00' dates" if ($sandbox_version ge '5.7');
|
||||||
my $modes = new SqlModes($dbh);
|
# Since some sql_modes don't allow '0000-00-00' dates, to keep this test valid
|
||||||
$modes->del(qw(STRICT_TRANS_TABLES STRICT_ALL_TABLES NO_ZERO_IN_DATE NO_ZERO_DATE));
|
# 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();
|
my $currmodes = $modes->get_modes_string();
|
||||||
|
|
||||||
$dbh->do("update test.query_review set first_seen='0000-00-00 00:00:00', "
|
$dbh->do("update test.query_review set first_seen='0000-00-00 00:00:00', "
|
||||||
. " last_seen='0000-00-00 00:00:00'");
|
. " last_seen='0000-00-00 00:00:00'");
|
||||||
$output = run_with("slow022.txt",
|
$output = run_with("slow022.txt",
|
||||||
'--review', "$dsn,D=test,t=query_review");
|
'--review', "$dsn,D=test,t=query_review");
|
||||||
unlike($output, qr/last_seen/, 'no last_seen when 0000 timestamp');
|
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/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');
|
unlike($output, qr/0000-00-00 00:00:00/, 'no 0000-00-00 00:00:00 timestamp');
|
||||||
|
|
||||||
$modes->restore_original_modes();
|
$modes->restore_original_modes();
|
||||||
|
}
|
||||||
|
|
||||||
# ##########################################################################
|
# ##########################################################################
|
||||||
# XXX The following tests will cause non-deterministic data, so run them
|
# XXX The following tests will cause non-deterministic data, so run them
|
||||||
|
@@ -105,6 +105,7 @@ $modes->restore_original_modes();
|
|||||||
|
|
||||||
my $postfix = $sandbox_version < '5.7' ? '' : '-57';
|
my $postfix = $sandbox_version < '5.7' ? '' : '-57';
|
||||||
|
|
||||||
|
# 11
|
||||||
ok(
|
ok(
|
||||||
no_diff(
|
no_diff(
|
||||||
sub { pt_show_grants::main('-F', $cnf, qw(--only sally --no-header)) },
|
sub { pt_show_grants::main('-F', $cnf, qw(--only sally --no-header)) },
|
||||||
@@ -115,6 +116,7 @@ ok(
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
# 12
|
||||||
ok(
|
ok(
|
||||||
no_diff(
|
no_diff(
|
||||||
sub { pt_show_grants::main('-F', $cnf, qw(--only sally --no-header),
|
sub { pt_show_grants::main('-F', $cnf, qw(--only sally --no-header),
|
||||||
@@ -126,6 +128,7 @@ ok(
|
|||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
# 13
|
||||||
ok(
|
ok(
|
||||||
no_diff(
|
no_diff(
|
||||||
sub { pt_show_grants::main('-F', $cnf, qw(--only sally --no-header),
|
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'\@'%'"`);
|
diag(`/tmp/12345/use -u root -e "GRANT SELECT ON sakila.city TO 'sally'\@'%'"`);
|
||||||
|
|
||||||
|
# 14
|
||||||
ok(
|
ok(
|
||||||
no_diff(
|
no_diff(
|
||||||
sub { pt_show_grants::main('-F', $cnf, qw(--only sally --no-header)) },
|
sub { pt_show_grants::main('-F', $cnf, qw(--only sally --no-header)) },
|
||||||
|
@@ -2,5 +2,5 @@
|
|||||||
CREATE USER IF NOT EXISTS 'sally'@'%';
|
CREATE USER IF NOT EXISTS 'sally'@'%';
|
||||||
ALTER USER 'sally'@'%' IDENTIFIED WITH 'mysql_native_password' REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK;
|
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 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'@'%';
|
GRANT USAGE ON *.* TO 'sally'@'%';
|
||||||
|
@@ -2,5 +2,5 @@
|
|||||||
CREATE USER IF NOT EXISTS 'sally'@'%';
|
CREATE USER IF NOT EXISTS 'sally'@'%';
|
||||||
ALTER USER 'sally'@'%' IDENTIFIED WITH 'mysql_native_password' REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK;
|
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 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'@'%';
|
GRANT USAGE ON *.* TO 'sally'@'%';
|
||||||
|
@@ -2,6 +2,6 @@
|
|||||||
CREATE USER IF NOT EXISTS 'sally'@'%';
|
CREATE USER IF NOT EXISTS 'sally'@'%';
|
||||||
ALTER USER 'sally'@'%' IDENTIFIED WITH 'mysql_native_password' REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK;
|
ALTER USER 'sally'@'%' IDENTIFIED WITH 'mysql_native_password' REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK;
|
||||||
GRANT INSERT (city) ON `sakila`.`city` TO 'sally'@'%';
|
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 SELECT (city_id) ON `sakila`.`city` TO 'sally'@'%';
|
||||||
GRANT USAGE ON *.* TO 'sally'@'%';
|
GRANT USAGE ON *.* TO 'sally'@'%';
|
||||||
|
@@ -1,12 +1,12 @@
|
|||||||
-- Revoke statements for 'sally'@'%'
|
-- Revoke statements for 'sally'@'%'
|
||||||
REVOKE INSERT (city) ON `sakila`.`city` FROM '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 SELECT (city_id) ON `sakila`.`city` FROM 'sally'@'%';
|
||||||
REVOKE USAGE ON *.* FROM 'sally'@'%';
|
REVOKE USAGE ON *.* FROM 'sally'@'%';
|
||||||
-- Grants for 'sally'@'%'
|
-- Grants for 'sally'@'%'
|
||||||
CREATE USER IF NOT EXISTS 'sally'@'%';
|
CREATE USER IF NOT EXISTS 'sally'@'%';
|
||||||
ALTER USER 'sally'@'%' IDENTIFIED WITH 'mysql_native_password' REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK;
|
ALTER USER 'sally'@'%' IDENTIFIED WITH 'mysql_native_password' REQUIRE NONE PASSWORD EXPIRE DEFAULT ACCOUNT UNLOCK;
|
||||||
GRANT INSERT (city) ON `sakila`.`city` TO 'sally'@'%';
|
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 SELECT (city_id) ON `sakila`.`city` TO 'sally'@'%';
|
||||||
GRANT USAGE ON *.* TO 'sally'@'%';
|
GRANT USAGE ON *.* TO 'sally'@'%';
|
||||||
|
@@ -500,37 +500,33 @@ SKIP: {
|
|||||||
|
|
||||||
$output = `cat $dest/*-slave-status 2>/dev/null`;
|
$output = `cat $dest/*-slave-status 2>/dev/null`;
|
||||||
|
|
||||||
if ( $sandbox_version lt '5.7' ) {
|
like(
|
||||||
like(
|
$output,
|
||||||
$output,
|
qr/FROM performance_schema.replication_connection_configuration JOIN performance_schema.replication_applier_configuration USING/,
|
||||||
qr/SHOW SLAVE STATUS/,
|
"MySQL 5.7 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"
|
|
||||||
);
|
|
||||||
}
|
|
||||||
$sb->stop_sandbox(qw(chan_master1 chan_master2 chan_slave1));
|
$sb->stop_sandbox(qw(chan_master1 chan_master2 chan_slave1));
|
||||||
}
|
}
|
||||||
|
|
||||||
my $slave1_port = $sb->port_for('slave1');
|
SKIP: {
|
||||||
my $cmd = "$trunk/bin/pt-stalk --no-stalk --iterations=1 --host=127.0.0.1 --port=$slave1_port --user=msandbox "
|
skip "Only test on mysql 5.6" if ( $sandbox_version ne '5.6' );
|
||||||
. "--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`;
|
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);
|
||||||
|
|
||||||
like(
|
$output = `cat $dest/*-slave-status 2>/dev/null`;
|
||||||
$output,
|
|
||||||
qr/SHOW SLAVE STATUS/,
|
like(
|
||||||
"MySQL 5.6 SLAVE STATUS"
|
$output,
|
||||||
);
|
qr/SHOW SLAVE STATUS/,
|
||||||
|
"MySQL 5.6 SLAVE STATUS"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
# #############################################################################
|
# #############################################################################
|
||||||
# Done.
|
# Done.
|
||||||
|
@@ -68,6 +68,7 @@ sub reset_repl_db {
|
|||||||
# in throttle.t.
|
# in throttle.t.
|
||||||
# ############################################################################
|
# ############################################################################
|
||||||
|
|
||||||
|
# 1
|
||||||
ok(
|
ok(
|
||||||
no_diff(
|
no_diff(
|
||||||
sub { pt_table_checksum::main(@args) },
|
sub { pt_table_checksum::main(@args) },
|
||||||
|
Reference in New Issue
Block a user