mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-10 13:11:32 +00:00
Merge p:~percona-toolkit-dev/percona-toolkit/fix-1087319-quoter-multiple-nulls
This commit is contained in:
@@ -79,10 +79,10 @@ ok(
|
||||
# Since this varies by default, there's no use checking the checksums
|
||||
# other than to ensure that there's at one for each table.
|
||||
$row = $master_dbh->selectrow_arrayref("select count(*) from percona.checksums");
|
||||
cmp_ok(
|
||||
$row->[0], '>=', ($sandbox_version gt "5.0" ? 37 : 33),
|
||||
'At least 37 checksums'
|
||||
);
|
||||
ok(
|
||||
$row->[0] > 30 && $row->[0] < 50,
|
||||
'Between 30 and 50 chunks'
|
||||
) or diag($row->[0]);
|
||||
|
||||
# ############################################################################
|
||||
# Static chunk size (disable --chunk-time)
|
||||
@@ -97,24 +97,18 @@ ok(
|
||||
"Static chunk size (--chunk-time 0)"
|
||||
);
|
||||
|
||||
my $n_checksums = $sandbox_version eq "5.6" ? 89
|
||||
: $sandbox_version eq "5.5" ? 90
|
||||
: $sandbox_version eq "5.1" ? 89
|
||||
: 85;
|
||||
|
||||
$row = $master_dbh->selectrow_arrayref("select count(*) from percona.checksums");
|
||||
is(
|
||||
$row->[0],
|
||||
$n_checksums,
|
||||
'Expected checksums on master'
|
||||
);
|
||||
ok(
|
||||
$row->[0] >= 85 && $row->[0] <= 90,
|
||||
'Between 85 and 90 chunks on master'
|
||||
) or diag($row->[0]);
|
||||
|
||||
$row = $slave1_dbh->selectrow_arrayref("select count(*) from percona.checksums");
|
||||
my $row2 = $slave1_dbh->selectrow_arrayref("select count(*) from percona.checksums");
|
||||
is(
|
||||
$row2->[0],
|
||||
$row->[0],
|
||||
$n_checksums,
|
||||
'Expected checksums on slave'
|
||||
);
|
||||
'... same number of chunks on slave'
|
||||
) or diag($row->[0], ' ', $row2->[0]);
|
||||
|
||||
# ############################################################################
|
||||
# --[no]replicate-check and, implicitly, the tool's exit status.
|
||||
@@ -361,11 +355,10 @@ $output = output(
|
||||
stderr => 1,
|
||||
);
|
||||
|
||||
# Before 2.2 the exit status was 0, but bug 1087804 changed this to 1.
|
||||
is(
|
||||
$exit_status,
|
||||
1,
|
||||
"No host in DSN, non-zero exit status"
|
||||
0,
|
||||
"No host in DSN, zero exit status"
|
||||
);
|
||||
|
||||
is(
|
||||
@@ -491,55 +484,6 @@ is(
|
||||
"Bug 821675 (dot): 0 errors"
|
||||
);
|
||||
|
||||
# #############################################################################
|
||||
# Bug 1087804: pt-table-checksum doesn't warn if no slaves are found
|
||||
# #############################################################################
|
||||
$sb->load_file('master', "$sample/dsn-table.sql");
|
||||
$master_dbh->do('TRUNCATE TABLE dsns.dsns');
|
||||
$sb->wait_for_slaves;
|
||||
|
||||
my $slave1_dsn = $sb->dsn_for('slave1');
|
||||
|
||||
$output = output(
|
||||
sub { $exit_status = pt_table_checksum::main(@args,
|
||||
qw(-t sakila.country),
|
||||
"--recursion-method", "dsn=$slave1_dsn,t=dsns.dsns")
|
||||
},
|
||||
stderr => 1,
|
||||
);
|
||||
|
||||
like(
|
||||
$output,
|
||||
qr/no slaves were found/,
|
||||
"Warns if no slaves are found"
|
||||
);
|
||||
|
||||
is(
|
||||
$exit_status,
|
||||
1,
|
||||
'...exit status 1'
|
||||
);
|
||||
|
||||
$output = output(
|
||||
sub { $exit_status = pt_table_checksum::main(@args,
|
||||
qw(-t sakila.country),
|
||||
"--recursion-method", "none")
|
||||
},
|
||||
stderr => 1,
|
||||
);
|
||||
|
||||
unlike(
|
||||
$output,
|
||||
qr/no slaves were found/,
|
||||
"No warning if no slaves and --recursion-method=none"
|
||||
);
|
||||
|
||||
is(
|
||||
$exit_status,
|
||||
0,
|
||||
'...exit status 0'
|
||||
);
|
||||
|
||||
# #############################################################################
|
||||
# Done.
|
||||
# #############################################################################
|
||||
|
@@ -195,7 +195,7 @@ is(
|
||||
# #############################################################################
|
||||
|
||||
($output) = output(
|
||||
sub { pt_table_checksum::main(@args, '--tables', 'mysql.user,mysql.host',
|
||||
sub { pt_table_checksum::main(@args, '--tables', 'mysql.user,mysql.db',
|
||||
'--columns', 'some_fale_column') },
|
||||
stderr => 1,
|
||||
);
|
||||
@@ -269,7 +269,7 @@ SKIP: {
|
||||
"...and warns for both level 1 and level 2 slaves"
|
||||
) or diag($output);
|
||||
|
||||
diag(`$trunk/sandbox/stop-sandbox 12348 12349`);
|
||||
diag(`$trunk/sandbox/stop-sandbox 12349 12348`);
|
||||
}
|
||||
|
||||
# #############################################################################
|
||||
@@ -278,4 +278,3 @@ SKIP: {
|
||||
$sb->wipe_clean($master_dbh);
|
||||
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
|
||||
done_testing;
|
||||
exit;
|
||||
|
@@ -73,7 +73,7 @@ is_deeply(
|
||||
$row = $master_dbh->selectrow_arrayref("select lower_boundary, upper_boundary from percona.checksums where db='test' and tbl='ascii' and chunk=10");
|
||||
is_deeply(
|
||||
$row,
|
||||
[ 'ZESUS\!\!\!', undef ],
|
||||
[ 'ZESUS!!!', undef ],
|
||||
"Upper oob boundary"
|
||||
);
|
||||
|
||||
|
@@ -178,8 +178,8 @@ is(
|
||||
# Use the --replicate table created by the previous ^ tests.
|
||||
|
||||
# Create a user that can't create the --replicate table.
|
||||
diag(`/tmp/12345/use -uroot < $trunk/t/lib/samples/ro-checksum-user.sql`);
|
||||
diag(`/tmp/12345/use -uroot -e "GRANT REPLICATION CLIENT, REPLICATION SLAVE ON *.* TO ro_checksum_user\@'%'"`);
|
||||
diag(`/tmp/12345/use -uroot -pmsandbox < $trunk/t/lib/samples/ro-checksum-user.sql 2>&1`);
|
||||
diag(`/tmp/12345/use -uroot -pmsandbox -e "GRANT REPLICATION CLIENT, REPLICATION SLAVE ON *.* TO ro_checksum_user\@'%'" 2>&1`);
|
||||
|
||||
# Remove the --replicate table from slave1 and slave2,
|
||||
# so it's only on the master...
|
||||
@@ -199,7 +199,7 @@ like(
|
||||
"CREATE DATABASE error and db is missing on slaves (bug 1039569)"
|
||||
);
|
||||
|
||||
diag(`/tmp/12345/use -uroot -e "DROP USER ro_checksum_user\@'%'"`);
|
||||
diag(`/tmp/12345/use -uroot -pmsandbox -e "DROP USER ro_checksum_user\@'%'" 2>&1`);
|
||||
|
||||
# #############################################################################
|
||||
# Done.
|
||||
|
@@ -20,7 +20,7 @@ ERRORS DIFFS ROWS SKIPPED TABLE
|
||||
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 39 0 percona_test.checksums
|
||||
0 0 37 0 percona_test.checksums
|
||||
0 0 1 0 percona_test.load_data
|
||||
0 0 1 0 percona_test.sentinel
|
||||
0 0 200 0 sakila.actor
|
||||
|
@@ -21,7 +21,7 @@ ERRORS DIFFS ROWS SKIPPED TABLE
|
||||
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 40 0 percona_test.checksums
|
||||
0 0 38 0 percona_test.checksums
|
||||
0 0 1 0 percona_test.load_data
|
||||
0 0 1 0 percona_test.sentinel
|
||||
0 0 200 0 sakila.actor
|
||||
|
@@ -1,12 +1,12 @@
|
||||
ERRORS DIFFS ROWS SKIPPED TABLE
|
||||
0 0 0 0 mysql.columns_priv
|
||||
0 0 2 0 mysql.db
|
||||
0 0 0 0 mysql.db
|
||||
0 0 0 0 mysql.event
|
||||
0 0 0 0 mysql.func
|
||||
0 0 39 0 mysql.help_category
|
||||
0 0 461 0 mysql.help_keyword
|
||||
0 0 40 0 mysql.help_category
|
||||
0 0 473 0 mysql.help_keyword
|
||||
0 0 1045 0 mysql.help_relation
|
||||
0 0 324 0 mysql.help_topic
|
||||
0 0 529 0 mysql.help_topic
|
||||
0 0 0 0 mysql.ndb_binlog_index
|
||||
0 0 0 0 mysql.plugin
|
||||
0 0 0 0 mysql.proc
|
||||
@@ -20,7 +20,7 @@ ERRORS DIFFS ROWS SKIPPED TABLE
|
||||
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 42 0 percona_test.checksums
|
||||
0 0 37 0 percona_test.checksums
|
||||
0 0 1 0 percona_test.load_data
|
||||
0 0 1 0 percona_test.sentinel
|
||||
0 0 200 0 sakila.actor
|
||||
|
@@ -20,7 +20,7 @@ ERRORS DIFFS ROWS CHUNKS SKIPPED TABLE
|
||||
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 39 1 0 percona_test.checksums
|
||||
0 0 37 1 0 percona_test.checksums
|
||||
0 0 1 1 0 percona_test.load_data
|
||||
0 0 1 1 0 percona_test.sentinel
|
||||
0 0 200 1 0 sakila.actor
|
||||
|
@@ -21,7 +21,7 @@ ERRORS DIFFS ROWS CHUNKS SKIPPED TABLE
|
||||
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 40 1 0 percona_test.checksums
|
||||
0 0 38 1 0 percona_test.checksums
|
||||
0 0 1 1 0 percona_test.load_data
|
||||
0 0 1 1 0 percona_test.sentinel
|
||||
0 0 200 1 0 sakila.actor
|
||||
|
@@ -1,12 +1,12 @@
|
||||
ERRORS DIFFS ROWS CHUNKS SKIPPED TABLE
|
||||
0 0 0 1 0 mysql.columns_priv
|
||||
0 0 2 1 0 mysql.db
|
||||
0 0 0 1 0 mysql.db
|
||||
0 0 0 1 0 mysql.event
|
||||
0 0 0 1 0 mysql.func
|
||||
0 0 39 1 0 mysql.help_category
|
||||
0 0 461 1 0 mysql.help_keyword
|
||||
0 0 40 1 0 mysql.help_category
|
||||
0 0 473 1 0 mysql.help_keyword
|
||||
0 0 1045 1 0 mysql.help_relation
|
||||
0 0 324 1 0 mysql.help_topic
|
||||
0 0 529 1 0 mysql.help_topic
|
||||
0 0 0 1 0 mysql.ndb_binlog_index
|
||||
0 0 0 1 0 mysql.plugin
|
||||
0 0 0 1 0 mysql.proc
|
||||
@@ -20,7 +20,7 @@ ERRORS DIFFS ROWS CHUNKS SKIPPED TABLE
|
||||
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 42 1 0 percona_test.checksums
|
||||
0 0 37 1 0 percona_test.checksums
|
||||
0 0 1 1 0 percona_test.load_data
|
||||
0 0 1 1 0 percona_test.sentinel
|
||||
0 0 200 1 0 sakila.actor
|
||||
|
@@ -15,12 +15,15 @@ use PerconaTest;
|
||||
use Sandbox;
|
||||
require "$trunk/bin/pt-table-checksum";
|
||||
|
||||
if ( $sandbox_version eq '5.6' ) {
|
||||
plan skip_all => 'http://bugs.mysql.com/67798';
|
||||
if ( $sandbox_version ge '5.6' ) {
|
||||
plan skip_all => 'Cannot disable InnoDB in MySQL 5.6';
|
||||
}
|
||||
|
||||
diag(`$trunk/sandbox/stop-sandbox 12348 12349 >/dev/null`);
|
||||
diag("Stopping/reconfiguring/restarting sandboxes 12348 and 12349");
|
||||
diag(`$trunk/sandbox/stop-sandbox 12348 >/dev/null`);
|
||||
diag(`SKIP_INNODB=1 $trunk/sandbox/start-sandbox master 12348 >/dev/null`);
|
||||
|
||||
diag(`$trunk/sandbox/stop-sandbox 12349 >/dev/null`);
|
||||
diag(`SKIP_INNODB=1 $trunk/sandbox/start-sandbox slave 12349 12348 >/dev/null`);
|
||||
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
@@ -43,26 +46,6 @@ my @args = ($master_dsn, qw(--lock-wait-timeout 3), '--max-load', '');
|
||||
my $output;
|
||||
my $retval;
|
||||
|
||||
if ( $sandbox_version ge '5.6' ) {
|
||||
# Before MySQL 5.6, even with the InnoDB engine off, creating an InnoDB
|
||||
# table would simply result in:
|
||||
#
|
||||
# mysql> create table t (i int) engine=innodb;
|
||||
# Query OK, 0 rows affected, 2 warnings (0.01 sec)
|
||||
#
|
||||
# mysql> show warnings;
|
||||
# +---------+------+-------------------------------------------+
|
||||
# | Level | Code | Message |
|
||||
# +---------+------+-------------------------------------------+
|
||||
# | Warning | 1286 | Unknown table engine 'innodb' |
|
||||
# | Warning | 1266 | Using storage engine MyISAM for table 't' |
|
||||
# +---------+------+-------------------------------------------+
|
||||
#
|
||||
# But 5.6 throws an error. So we have to create the table manually.
|
||||
$sb->load_file('master1', "t/pt-table-checksum/samples/repl-table-myisam.sql");
|
||||
$sb->wait_for_slaves(master => 'master1', slave => 'master2');
|
||||
}
|
||||
|
||||
$output = output(
|
||||
sub { $retval = pt_table_checksum::main(@args) },
|
||||
stderr => 1,
|
||||
@@ -78,12 +61,11 @@ is(
|
||||
$retval,
|
||||
0,
|
||||
"0 exit status (bug 996110)"
|
||||
) or diag($output);
|
||||
);
|
||||
|
||||
# #############################################################################
|
||||
# Done.
|
||||
# #############################################################################
|
||||
$sb->wipe_clean($master_dbh);
|
||||
diag(`$trunk/sandbox/stop-sandbox 12349 12348 >/dev/null`);
|
||||
ok($sb->ok(), "Sandbox servers") or BAIL_OUT(__FILE__ . " broke the sandbox");
|
||||
done_testing;
|
||||
|
Reference in New Issue
Block a user