mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-17 17:27:57 +00:00
Merge pull request #71 from percona/pt-table-checksum-5.7-compat
misc test fixes for pt-table-checksum 5.7 compat
This commit is contained in:
@@ -9042,6 +9042,10 @@ my %warn_code = (
|
||||
# any pattern
|
||||
# use MySQL's message for this warning
|
||||
},
|
||||
1406 => {
|
||||
# any pattern
|
||||
# use MySQL's message for this warning
|
||||
},
|
||||
);
|
||||
|
||||
sub main {
|
||||
|
@@ -56,6 +56,26 @@ sub new {
|
||||
return $self;
|
||||
}
|
||||
|
||||
|
||||
# Sub: set_mode_string
|
||||
# sets sql_mode in traditional csv format
|
||||
#
|
||||
# Required Arguments:
|
||||
# string of valid formats in csv formta (or null string)
|
||||
#
|
||||
# Returns:
|
||||
# 1 if successful, 0 if error.
|
||||
sub set_mode_string {
|
||||
my ( $self, $sql_mode_string ) = @_;
|
||||
|
||||
die "I need a string" unless defined $sql_mode_string;
|
||||
|
||||
$self->{dbh}->do("set $self->{global} sql_mode = '$sql_mode_string'") || return 0;
|
||||
|
||||
PTDEBUG && _d('sql_mode changed to: ', $sql_mode_string);
|
||||
return 1;
|
||||
}
|
||||
|
||||
# Sub: add
|
||||
# adds one or more modes
|
||||
#
|
||||
|
@@ -27,3 +27,6 @@ innodb_lock_wait_timeout = 3
|
||||
general_log
|
||||
general_log_file = genlog
|
||||
lower_case_table_names = 0
|
||||
|
||||
# fkc test
|
||||
binlog_format = STATEMENT
|
||||
|
@@ -75,14 +75,14 @@ ok(
|
||||
),
|
||||
"Default checksum"
|
||||
);
|
||||
|
||||
# On fast machines, the chunk size will probably be be auto-adjusted so
|
||||
# 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
|
||||
# other than to ensure that there's at least one for each table.
|
||||
$row = $master_dbh->selectrow_arrayref("select count(*) from percona.checksums");
|
||||
my $max_chunks = $sandbox_version < '5.7' ? 60 : 100;
|
||||
ok(
|
||||
$row->[0] > 30 && $row->[0] < 60,
|
||||
$row->[0] > 30 && $row->[0] < $max_chunks,
|
||||
'Between 30 and 60 chunks'
|
||||
) or diag($row->[0]);
|
||||
|
||||
@@ -99,13 +99,15 @@ ok(
|
||||
"Static chunk size (--chunk-time 0)"
|
||||
);
|
||||
|
||||
|
||||
$row = $master_dbh->selectrow_arrayref("select count(*) from percona.checksums");
|
||||
|
||||
my $max_rows = $sandbox_version < '5.7' ? 90 : 100;
|
||||
ok(
|
||||
$row->[0] >= 85 && $row->[0] <= 90,
|
||||
$row->[0] >= 85 && $row->[0] <= $max_rows,
|
||||
'Between 85 and 90 chunks on master'
|
||||
) or diag($row->[0]);
|
||||
|
||||
|
||||
my $row2 = $slave1_dbh->selectrow_arrayref("select count(*) from percona.checksums");
|
||||
is(
|
||||
$row2->[0],
|
||||
@@ -553,6 +555,7 @@ is(
|
||||
"sql_mode ONLY_FULL_GROUP_BY is overidden"
|
||||
);
|
||||
|
||||
DONE:
|
||||
# #############################################################################
|
||||
# Done.
|
||||
# #############################################################################
|
||||
|
@@ -15,6 +15,7 @@ $ENV{PERCONA_TOOLKIT_TEST_USE_DSN_NAMES} = 1;
|
||||
|
||||
use PerconaTest;
|
||||
use Sandbox;
|
||||
use SqlModes;
|
||||
require "$trunk/bin/pt-table-checksum";
|
||||
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
@@ -42,6 +43,16 @@ $sb->create_dbs($master_dbh, [qw(test)]);
|
||||
# #############################################################################
|
||||
# Issue 81: put some data that's too big into the boundaries table
|
||||
# #############################################################################
|
||||
|
||||
# Frank : not sure what this test is trying to do.
|
||||
# Inserting a truncated value in the boundary column should be fatal...no?
|
||||
# It actually IS fatal with STRICT tables mode (mysql 5.7+)
|
||||
# Since the idea is probably to test warning handling, we'll turn off STRICT
|
||||
# for the next two tests.
|
||||
|
||||
my $modes = new SqlModes($master_dbh, global=>1);
|
||||
$modes->del('STRICT_TRANS_TABLES','STRICT_ALL_TABLES');
|
||||
|
||||
$sb->load_file('master', 't/pt-table-checksum/samples/checksum_tbl_truncated.sql');
|
||||
|
||||
$output = output(
|
||||
@@ -64,6 +75,8 @@ is(
|
||||
"Only one warning for MySQL error 1265"
|
||||
);
|
||||
|
||||
$modes->restore_original_modes();
|
||||
|
||||
# ############################################################################
|
||||
# Lock wait timeout
|
||||
# ############################################################################
|
||||
|
@@ -13,6 +13,7 @@ use Test::More;
|
||||
|
||||
use PerconaTest;
|
||||
use Sandbox;
|
||||
use SqlModes;
|
||||
require "$trunk/bin/pt-table-checksum";
|
||||
|
||||
my $dp = new DSNParser(opts=>$dsn_opts);
|
||||
@@ -33,8 +34,11 @@ my $master_dsn = 'h=127.1,P=12345,u=msandbox,p=msandbox';
|
||||
my @args = ($master_dsn, qw(--set-vars innodb_lock_wait_timeout=3), '--max-load', '');
|
||||
my $output;
|
||||
|
||||
# We test that checksum works with invalid dates,
|
||||
# but for that we need to turn off MySQL's NO_ZERO_IN_DATE mode
|
||||
my $modes = new SqlModes($dbh, global=>1);
|
||||
$modes->del('NO_ZERO_IN_DATE');
|
||||
$sb->load_file('master', 't/pt-table-checksum/samples/issue_602.sql');
|
||||
|
||||
# #############################################################################
|
||||
# Issue 602: mk-table-checksum issue with invalid dates
|
||||
# #############################################################################
|
||||
@@ -50,6 +54,7 @@ is(
|
||||
"Checksums table despite invalid datetime"
|
||||
);
|
||||
|
||||
$modes->restore_original_modes();
|
||||
# #############################################################################
|
||||
# Done.
|
||||
# #############################################################################
|
||||
|
@@ -68,7 +68,11 @@ $sb->wait_for_slaves();
|
||||
# then starts it again.
|
||||
# TEST_WISHLIST PLUGIN_WISHLIST: do this with a plugin to the tool itself,
|
||||
# not in this unreliable fashion.
|
||||
system("$trunk/util/wait-to-exec '$scripts/wait-for-chunk.sh 12345 sakila city 1' '$scripts/exec-wait-exec.sh 12347 \"stop slave sql_thread\" 4 \"start slave sql_thread\"' 4 >/dev/null &");
|
||||
|
||||
# Frank: this command makes my head hurt. :-)
|
||||
# notice there are 3 *different* wait type commands involved
|
||||
# notice final number in the line is the run-time allowed for the "outermost" wait (wait-to-exec). If it is absent it defaults to 1, which may not be enough for sakila.city chunk to appear (at least on my system and for MySQL 5.7
|
||||
system("$trunk/util/wait-to-exec '$scripts/wait-for-chunk.sh 12345 sakila city 1' '$scripts/exec-wait-exec.sh 12347 \"stop slave sql_thread\" 6 \"start slave sql_thread\"' 8 >/dev/null &");
|
||||
|
||||
$output = output(
|
||||
sub { pt_table_checksum::main(@args, qw(-d sakila)); },
|
||||
|
@@ -44,11 +44,11 @@ $exit_status = pt_table_checksum::main(@args,
|
||||
my $t = time - $t0;
|
||||
|
||||
ok(
|
||||
$t >= 1.0 && $t <= 2.5 + ($ENV{'PERCONA_SLOW_BOX'} || 0) ,
|
||||
$t >= 1.0 && $t <= 2.5 + $ENV{'PERCONA_SLOW_BOX'}*3,
|
||||
"Ran in roughly --run-time 1 second"
|
||||
) or diag("Actual run time: $t");
|
||||
|
||||
my $rows = $master_dbh->selectall_arrayref("SELECT DISTINCT CONCAT(db, '.', tbl) FROM percona.checksums ORDER by db, tbl");
|
||||
my $rows = $master_dbh->selectall_arrayref("SELECT DISTINCT CONCAT(db, '.', tbl) FROM percona.checksums ORDER by CONCAT(db, '.', tbl)");
|
||||
my $sakila_finished = grep { $_->[0] eq 'sakila.store' } @$rows;
|
||||
ok(
|
||||
!$sakila_finished,
|
||||
@@ -57,9 +57,9 @@ ok(
|
||||
|
||||
# Add --resume to complete the run.
|
||||
$exit_status = pt_table_checksum::main(@args,
|
||||
qw(--quiet --quiet -d sakila --chunk-size 100));
|
||||
qw(--resume --quiet --quiet -d sakila --chunk-size 100));
|
||||
|
||||
$rows = $master_dbh->selectall_arrayref("SELECT DISTINCT CONCAT(db, '.', tbl) FROM percona.checksums ORDER by db, tbl");
|
||||
$rows = $master_dbh->selectall_arrayref("SELECT DISTINCT CONCAT(db, '.', tbl) FROM percona.checksums ORDER by CONCAT(db, '.', tbl)");
|
||||
$sakila_finished = grep { $_->[0] eq 'sakila.store' } @$rows;
|
||||
ok(
|
||||
$sakila_finished,
|
||||
|
@@ -1,17 +1,20 @@
|
||||
ERRORS DIFFS ROWS SKIPPED TABLE
|
||||
0 0 0 0 mysql.columns_priv
|
||||
0 0 0 0 mysql.db
|
||||
0 0 0 0 mysql.engine_cost
|
||||
0 0 0 0 mysql.event
|
||||
0 0 0 0 mysql.func
|
||||
0 0 0 0 mysql.gtid_executed
|
||||
0 0 0 0 mysql.help_category
|
||||
0 0 0 0 mysql.help_keyword
|
||||
0 0 0 0 mysql.help_relation
|
||||
0 0 0 0 mysql.help_topic
|
||||
0 0 0 0 mysql.ndb_binlog_index
|
||||
0 0 0 0 mysql.plugin
|
||||
0 0 0 0 mysql.proc
|
||||
0 0 36 0 mysql.proc
|
||||
0 0 0 0 mysql.procs_priv
|
||||
0 0 1 0 mysql.proxies_priv
|
||||
0 0 0 0 mysql.server_cost
|
||||
0 0 0 0 mysql.servers
|
||||
0 0 0 0 mysql.tables_priv
|
||||
0 0 0 0 mysql.time_zone
|
||||
@@ -19,8 +22,8 @@ ERRORS DIFFS ROWS SKIPPED TABLE
|
||||
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 8 0 mysql.user
|
||||
0 0 18 0 percona_test.checksums
|
||||
0 0 2 0 mysql.user
|
||||
0 0 19 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,17 +1,20 @@
|
||||
ERRORS DIFFS ROWS CHUNKS SKIPPED TABLE
|
||||
0 0 0 1 0 mysql.columns_priv
|
||||
0 0 0 1 0 mysql.db
|
||||
0 0 0 1 0 mysql.engine_cost
|
||||
0 0 0 1 0 mysql.event
|
||||
0 0 0 1 0 mysql.func
|
||||
0 0 0 1 0 mysql.gtid_executed
|
||||
0 0 0 1 0 mysql.help_category
|
||||
0 0 0 1 0 mysql.help_keyword
|
||||
0 0 0 1 0 mysql.help_relation
|
||||
0 0 0 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
|
||||
0 0 36 1 0 mysql.proc
|
||||
0 0 0 1 0 mysql.procs_priv
|
||||
0 0 1 1 0 mysql.proxies_priv
|
||||
0 0 0 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.time_zone
|
||||
@@ -19,8 +22,8 @@ ERRORS DIFFS ROWS CHUNKS SKIPPED TABLE
|
||||
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 8 1 0 mysql.user
|
||||
0 0 18 1 0 percona_test.checksums
|
||||
0 0 2 1 0 mysql.user
|
||||
0 0 19 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
|
||||
|
Reference in New Issue
Block a user