More tests for 5.7 fixed

This commit is contained in:
Carlos Salguero
2017-04-28 17:15:53 -03:00
parent fcd1cb173f
commit e6e54839bf
14 changed files with 67 additions and 45 deletions

View File

@@ -814,10 +814,11 @@ sub tables_used {
while ( defined(my $chunk = <$fh>) ) { while ( defined(my $chunk = <$fh>) ) {
map { map {
my $db_tbl = $_; my $db_tbl = $_;
$db_tbl =~ s/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d\.\d+Z?//; # strip leading timestamp (MySQL 5.7+)
$db_tbl =~ s/^\s*`?//; # strip leading space and ` $db_tbl =~ s/^\s*`?//; # strip leading space and `
$db_tbl =~ s/\s*`?$//; # strip trailing space and ` $db_tbl =~ s/\s*`?$//; # strip trailing space and `
$db_tbl =~ s/`\.`/./; # strip inner `.` $db_tbl =~ s/`\.`/./; # strip inner `.`
$tables{$db_tbl} = 1; $tables{$db_tbl} = 1 if !($db_tbl =~ m/^\s*$/);
} }
grep { grep {
m/(?:\w\.\w|`\.`)/ # only db.tbl, not just db m/(?:\w\.\w|`\.`)/ # only db.tbl, not just db

View File

@@ -26,8 +26,9 @@ my $dbh = $sb->get_dbh_for('master', {no_lc=>1});
if ( !$dbh ) { if ( !$dbh ) {
plan skip_all => "Cannot connect to sandbox master"; plan skip_all => "Cannot connect to sandbox master";
} } elsif ($sandbox_version ge '5.7') {
else { plan skip_all => "MySQL 5.7 use a more strict sql_mode";
} else {
plan tests => 21; plan tests => 21;
} }

View File

@@ -82,6 +82,7 @@ ok(
# large that all tables will be done in a single chunk without an index. # large that all tables will be done in a single chunk without an index.
# Since this varies by default, there's no use checking the checksums # Since this varies by default, there's no use checking the checksums
# other than to ensure that there's at least one for each table. # other than to ensure that there's at least one for each table.
# 2
$row = $master_dbh->selectrow_arrayref("select count(*) from percona.checksums"); $row = $master_dbh->selectrow_arrayref("select count(*) from percona.checksums");
my $max_chunks = $sandbox_version < '5.7' ? 60 : 100; my $max_chunks = $sandbox_version < '5.7' ? 60 : 100;
ok( ok(
@@ -92,7 +93,7 @@ ok(
# ############################################################################ # ############################################################################
# Static chunk size (disable --chunk-time) # Static chunk size (disable --chunk-time)
# ############################################################################ # ############################################################################
# 3
ok( ok(
no_diff( no_diff(
sub { pt_table_checksum::main(@args, qw(--chunk-time 0)) }, sub { pt_table_checksum::main(@args, qw(--chunk-time 0)) },

View File

@@ -42,7 +42,7 @@ $output = output(
is( is(
PerconaTest::count_checksum_results($output, 'rows'), PerconaTest::count_checksum_results($output, 'rows'),
24, $sandbox_version lt '5.7' ? 24 : 25,
"Large BLOB/TEXT/BINARY Checksum" "Large BLOB/TEXT/BINARY Checksum"
); );

View File

@@ -42,23 +42,15 @@ $sb->do_as_root("slave1", q/GRANT REPLICATION CLIENT ON *.* TO 'slave_user'@'loc
$sb->do_as_root("slave1", q/GRANT ALL ON *.* TO 'slave_user'@'localhost'/); $sb->do_as_root("slave1", q/GRANT ALL ON *.* TO 'slave_user'@'localhost'/);
$sb->do_as_root("slave1", q/FLUSH PRIVILEGES/); $sb->do_as_root("slave1", q/FLUSH PRIVILEGES/);
$sb->do_as_root("slave2", q/GRANT REPLICATION CLIENT ON *.* TO 'slave_user'@'localhost' IDENTIFIED BY 'slave_password'/);
$sb->do_as_root("slave2", q/GRANT ALL ON *.* TO 'slave_user'@'localhost'/);
$sb->do_as_root("slave2", q/FLUSH PRIVILEGES/);
$sb->wait_for_slaves(); $sb->wait_for_slaves();
# Run these commands inside issue_1651002.sql to delete the sandbox user ONLY from master
# These command must be in the .sql file because all of them need to run in the same session
# set sql_log_bin=0;
# DROP USER 'slave_user';
# set sql_log_bin=1;
$sb->load_file('master', 't/pt-table-checksum/samples/issue_1651002.sql'); $sb->load_file('master', 't/pt-table-checksum/samples/issue_1651002.sql');
# Ensure we cannot connect to slaves using standard credentials # Ensure we cannot connect to slaves using standard credentials
# Since slave2 is a slave of slave1, removing the user from the slave1 will remove # Since slave2 is a slave of slave1, removing the user from the slave1 will remove
# the user also from slave2 # the user also from slave2
$sb->do_as_root("slave1", q/DROP USER 'msandbox'@'%'/); $sb->do_as_root("slave1", q/RENAME USER 'msandbox'@'%' TO 'msandbox_old'@'%'/);
$sb->do_as_root("slave1", q/FLUSH PRIVILEGES/); $sb->do_as_root("slave1", q/FLUSH PRIVILEGES/);
$sb->do_as_root("slave1", q/FLUSH TABLES/);
$output = output( $output = output(
@@ -71,19 +63,19 @@ is(
"Large BLOB/TEXT/BINARY Checksum" "Large BLOB/TEXT/BINARY Checksum"
); );
# Restore privilegs for the other test files
$sb->do_as_root("master", q/GRANT ALL PRIVILEGES ON *.* TO 'msandbox'@'%' IDENTIFIED BY 'msandbox'/);
$sb->do_as_root("master", q/FLUSH PRIVILEGES/);
$sb->do_as_root("slave1", q/GRANT ALL PRIVILEGES ON *.* TO 'msandbox'@'%' IDENTIFIED BY 'msandbox'/);
$sb->do_as_root("slave1", q/FLUSH PRIVILEGES/);
# ############################################################################# # #############################################################################
# Done. # Done.
# ############################################################################# # #############################################################################
diag("Stopping the sandbox to leave a clean sandbox for the next test file"); diag("Stopping the sandbox to leave a clean sandbox for the next test file");
$sb->do_as_root("slave1", q/DROP USER 'slave_user'@'localhost'/); $sb->do_as_root("slave1", q/DROP USER 'slave_user'@'localhost'/);
$sb->do_as_root("slave1", q/FLUSH PRIVILEGES/); $sb->do_as_root("slave1", q/FLUSH PRIVILEGES/);
# Restore privilegs for the other test files
$sb->do_as_root("slave1", q/RENAME USER 'msandbox_old'@'%' TO 'msandbox'@'%'/);
$sb->do_as_root("master", q/FLUSH PRIVILEGES/);
$sb->do_as_root("master", q/FLUSH TABLES/);
$sb->wipe_clean($dbh); $sb->wipe_clean($dbh);
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox"); ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");

View File

@@ -1,14 +1,27 @@
ERRORS DIFFS ROWS SKIPPED TABLE ERRORS DIFFS ROWS SKIPPED TABLE
0 0 0 0 mysql.columns_priv 0 0 0 0 mysql.columns_priv
0 0 0 0 mysql.db 0 0 0 0 mysql.db
0 0 2 0 mysql.engine_cost
0 0 0 0 mysql.event 0 0 0 0 mysql.event
0 0 0 0 mysql.func 0 0 0 0 mysql.func
0 0 0 0 mysql.gtid_executed
0 0 40 0 mysql.help_category
0 0 682 0 mysql.help_keyword
0 0 1340 0 mysql.help_relation
0 0 637 0 mysql.help_topic
0 0 0 0 mysql.ndb_binlog_index 0 0 0 0 mysql.ndb_binlog_index
0 0 0 0 mysql.procs_priv 0 0 0 0 mysql.procs_priv
0 0 0 0 mysql.proxies_priv 0 0 0 0 mysql.proxies_priv
0 0 6 0 mysql.server_cost
0 0 0 0 mysql.servers
0 0 0 0 mysql.tables_priv 0 0 0 0 mysql.tables_priv
0 0 5 0 mysql.user 0 0 0 0 mysql.time_zone
0 0 17 0 percona_test.checksums 0 0 0 0 mysql.time_zone_leap_second
0 0 0 0 mysql.time_zone_name
0 0 0 0 mysql.time_zone_transition
0 0 0 0 mysql.time_zone_transition_type
0 0 2 0 mysql.user
0 0 23 0 percona_test.checksums
0 0 1 0 percona_test.load_data 0 0 1 0 percona_test.load_data
0 0 1 0 percona_test.sentinel 0 0 1 0 percona_test.sentinel
0 0 200 0 sakila.actor 0 0 200 0 sakila.actor

View File

@@ -49,7 +49,3 @@ create table test4 (
insert into test3(id, name) values(15034, '51707'),(1, '001'); insert into test3(id, name) values(15034, '51707'),(1, '001');
insert into test4(id, name) values(15034, '051707'),(1, '1'); insert into test4(id, name) values(15034, '051707'),(1, '1');
-- set sql_log_bin=0;
-- DROP USER 'slave_user';
-- set sql_log_bin=1;
-- FLUSH PRIVILEGES;

View File

@@ -1,14 +1,27 @@
ERRORS DIFFS ROWS CHUNKS SKIPPED TABLE ERRORS DIFFS ROWS CHUNKS SKIPPED TABLE
0 0 0 1 0 mysql.columns_priv 0 0 0 1 0 mysql.columns_priv
0 0 0 1 0 mysql.db 0 0 0 1 0 mysql.db
0 0 2 1 0 mysql.engine_cost
0 0 0 1 0 mysql.event 0 0 0 1 0 mysql.event
0 0 0 1 0 mysql.func 0 0 0 1 0 mysql.func
0 0 0 1 0 mysql.gtid_executed
0 0 40 1 0 mysql.help_category
0 0 682 1 0 mysql.help_keyword
0 0 1340 1 0 mysql.help_relation
0 0 637 1 0 mysql.help_topic
0 0 0 1 0 mysql.ndb_binlog_index 0 0 0 1 0 mysql.ndb_binlog_index
0 0 0 1 0 mysql.procs_priv 0 0 0 1 0 mysql.procs_priv
0 0 0 1 0 mysql.proxies_priv 0 0 0 1 0 mysql.proxies_priv
0 0 6 1 0 mysql.server_cost
0 0 0 1 0 mysql.servers
0 0 0 1 0 mysql.tables_priv 0 0 0 1 0 mysql.tables_priv
0 0 5 1 0 mysql.user 0 0 0 1 0 mysql.time_zone
0 0 17 1 0 percona_test.checksums 0 0 0 1 0 mysql.time_zone_leap_second
0 0 0 1 0 mysql.time_zone_name
0 0 0 1 0 mysql.time_zone_transition
0 0 0 1 0 mysql.time_zone_transition_type
0 0 2 1 0 mysql.user
0 0 23 1 0 percona_test.checksums
0 0 1 1 0 percona_test.load_data 0 0 1 1 0 percona_test.load_data
0 0 1 1 0 percona_test.sentinel 0 0 1 1 0 percona_test.sentinel
0 0 200 1 0 sakila.actor 0 0 200 1 0 sakila.actor

View File

@@ -1,31 +1,31 @@
$rows = [ $rows = [
[ [
'1', 1,
'a', 'a',
'2013-01-01 00:00:01' '2013-01-01 00:00:01'
], ],
[ [
'2', 2,
'b', 'b',
'2013-01-01 00:00:02' '2013-01-01 00:00:02'
], ],
[ [
'3', 3,
'c', 'c',
'2013-01-01 00:00:03' '2013-01-01 00:00:03'
], ],
[ [
'4', 4,
'd', 'd',
'2013-01-01 00:00:04' '2013-01-01 00:00:04'
], ],
[ [
'5', 5,
'e', 'e',
'2013-01-01 00:00:05' '2013-01-01 00:00:05'
], ],
[ [
'6', 6,
'f', 'f',
'2013-01-01 00:00:06' '2013-01-01 00:00:06'
] ]

View File

@@ -1,31 +1,31 @@
$rows = [ $rows = [
[ [
'1', 1,
'a', 'a',
'2013-01-01 00:00:01' '2013-01-01 00:00:01'
], ],
[ [
'2', 2,
'b', 'b',
'2013-01-01 00:00:02' '2013-01-01 00:00:02'
], ],
[ [
'3', 3,
'c', 'c',
'2013-01-01 00:00:03' '2013-01-01 00:00:03'
], ],
[ [
'4', 4,
'd', 'd',
'2013-01-01 00:00:04' '2013-01-01 00:00:04'
], ],
[ [
'5', 5,
'e', 'e',
'2013-01-01 00:00:05' '2013-01-01 00:00:05'
], ],
[ [
'6', 6,
'f', 'f',
'2013-01-01 00:00:06' '2013-01-01 00:00:06'
] ]

View File

@@ -2,7 +2,7 @@ $results = {
query_time => '0', query_time => '0',
warnings => { warnings => {
1265 => { 1265 => {
code => '1265', code => 1265,
level => 'Warning', level => 'Warning',
message => 'Data truncated for column \'username\' at row 1' message => 'Data truncated for column \'username\' at row 1'
} }

View File

@@ -1,6 +1,6 @@
$rows = [ $rows = [
[ [
'1' 1
] ]
]; ];

View File

@@ -1,10 +1,10 @@
$rows = [ $rows = [
[ [
'1', 1,
'a' 'a'
], ],
[ [
'2', 2,
undef undef
] ]
]; ];

View File

@@ -82,6 +82,11 @@ while ( my $sampleno = readdir $dh ) {
foreach my $file ( glob("$results_dir/*") ) { foreach my $file ( glob("$results_dir/*") ) {
my $result = basename($file); my $result = basename($file);
if ($sandbox_version ge '5.7' && "${basename}_results" eq 'insert_truncate_warning_results' &&
($result eq 'query' || $result eq 'results')) {
diag ("Skipping insert_truncate_warning_results. MySQL 5.7+ strict produces errors instead of warnings");
next;
}
ok( ok(
no_diff( no_diff(
"$tmpdir/$result", "$tmpdir/$result",