mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-01 18:25:59 +00:00
PT-572 More tests fixed
This commit is contained in:
@@ -27,6 +27,10 @@ innodb_lock_wait_timeout = 3
|
||||
general_log
|
||||
general_log_file = genlog
|
||||
lower_case_table_names = 0
|
||||
slow-query-log = 1
|
||||
slow-query-log-file = /tmp/PORT/data/slow.log
|
||||
log_slow_admin_statements = 1
|
||||
long_query_time = 0
|
||||
|
||||
# fkc test
|
||||
binlog_format = STATEMENT
|
||||
|
@@ -28,10 +28,10 @@ relay_log = mysql-relay-bin
|
||||
report-host = 127.0.0.1
|
||||
report-port = PORT
|
||||
server-id = PORT
|
||||
#slow-query-log = 1
|
||||
#slow-query-log-file = /tmp/PORT/data/slow.log
|
||||
#log_slow_admin_statements = 1
|
||||
#long_query_time = 0
|
||||
slow-query-log = 1
|
||||
slow-query-log-file = /tmp/PORT/data/slow.log
|
||||
log_slow_admin_statements = 1
|
||||
long_query_time = 0
|
||||
default_authentication_plugin=mysql_native_password
|
||||
|
||||
# fkc test
|
||||
|
@@ -38,6 +38,14 @@ if ( !$master_dbh ) {
|
||||
plan skip_all => 'Cannot connect to sandbox master';
|
||||
}
|
||||
|
||||
sub reset_query_cache {
|
||||
my @dbhs = @_;
|
||||
return if ($sandbox_version >= '8.0');
|
||||
foreach my $dbh (@dbhs) {
|
||||
$dbh->do('RESET QUERY CACHE');
|
||||
}
|
||||
}
|
||||
|
||||
# 1) Set the slave delay to 0 just in case we are re-running the tests without restarting the sandbox.
|
||||
# 2) Load sample data
|
||||
# 3) Set the slave delay to 30 seconds to be able to see the 'waiting' message.
|
||||
@@ -60,8 +68,8 @@ diag("Loading $num_rows into the table. This might take some time.");
|
||||
diag(`util/mysql_random_data_load --host=127.1 --port=12345 --user=msandbox --password=msandbox test pt178 $num_rows`);
|
||||
|
||||
# Run a full table scan query to ensure the slave is behind the master
|
||||
$master_dbh->do('RESET QUERY CACHE');
|
||||
$slave_dbh->do('RESET QUERY CACHE');
|
||||
# There is no query cache in MySQL 8.0+
|
||||
reset_query_cache($master_dbh, $master_dbh);
|
||||
$master_dbh->do('UPDATE `test`.`pt178` SET f2 = f2 + 1 WHERE f1 = ""');
|
||||
|
||||
# This is the base test, ust to ensure that without using --check-slave-lag nor --skip-check-slave-lag
|
||||
@@ -84,8 +92,7 @@ $args = "$master_dsn,D=test,t=pt178 --execute --chunk-size 1 --max-lag 5 --alter
|
||||
. "--check-slave-lag h=127.1,P=12346,u=msandbox,p=msandbox,D=test,t=sbtest";
|
||||
|
||||
# Run a full table scan query to ensure the slave is behind the master
|
||||
$master_dbh->do('RESET QUERY CACHE');
|
||||
$slave_dbh->do('RESET QUERY CACHE');
|
||||
reset_query_cache($master_dbh, $master_dbh);
|
||||
$master_dbh->do('UPDATE `test`.`pt178` SET f2 = f2 + 1 WHERE f1 = ""');
|
||||
|
||||
diag("Starting --check-slave-lag test. This is going to take some time due to the delay in the slave");
|
||||
@@ -99,8 +106,7 @@ like(
|
||||
|
||||
# Repeat the test now using --skip-check-slave-lag
|
||||
# Run a full table scan query to ensure the slave is behind the master
|
||||
$master_dbh->do('RESET QUERY CACHE');
|
||||
$slave_dbh->do('RESET QUERY CACHE');
|
||||
reset_query_cache($master_dbh, $master_dbh);
|
||||
$master_dbh->do('UPDATE `test`.`pt178` SET f2 = f2 + 1 WHERE f1 = ""');
|
||||
|
||||
$args = "$master_dsn,D=test,t=pt178 --execute --chunk-size 1 --max-lag 5 --alter 'ENGINE=InnoDB' "
|
@@ -38,11 +38,12 @@ my $output;
|
||||
my $cnf = '/tmp/12346/my.sandbox.cnf';
|
||||
my $cmd = "$trunk/bin/pt-slave-delay -F $cnf h=127.1";
|
||||
|
||||
# 1
|
||||
$output = `$cmd --help`;
|
||||
like($output, qr/Prompt for a password/, 'It compiles');
|
||||
|
||||
# #############################################################################
|
||||
# Issue 149: h is required even with S, for slavehost argument
|
||||
# 2 Issue 149: h is required even with S, for slavehost argument
|
||||
# #############################################################################
|
||||
$output = `$trunk/bin/pt-slave-delay --run-time 1s --delay 1s --interval 1s S=/tmp/12346/mysql_sandbox12346.sock 2>&1`;
|
||||
unlike($output, qr/Missing DSN part 'h'/, 'Does not require h DSN part');
|
||||
@@ -57,8 +58,15 @@ diag(`cp /tmp/12346/my.sandbox.cnf /tmp/12346/my.sandbox.cnf-original`);
|
||||
diag(`sed -i.bak -e '/log-bin/d' -e '/log_slave_updates/d' /tmp/12346/my.sandbox.cnf`);
|
||||
diag(`/tmp/12346/stop >/dev/null`);
|
||||
diag(`/tmp/12346/start >/dev/null`);
|
||||
diag("Sleeping 3 seconds ...");
|
||||
sleep(3);
|
||||
$slave2_dbh->do('STOP SLAVE');
|
||||
$slave2_dbh->do('RESET SLAVE');
|
||||
$slave2_dbh->do('START SLAVE');
|
||||
|
||||
$output = `$trunk/bin/pt-slave-delay --delay 1s h=127.1,P=12346,u=msandbox,p=msandbox h=127.1 2>&1`;
|
||||
# 3
|
||||
# $output = `$trunk/bin/pt-slave-delay --delay 1s h=127.1,P=12346,u=msandbox,p=msandbox h=127.1 2>&1`;
|
||||
$output = `$trunk/bin/pt-slave-delay --delay 1s h=127.1,P=12346,u=msandbox,p=msandbox h=127.1 &>/tmp/c`;
|
||||
like(
|
||||
$output,
|
||||
qr/Binary logging is disabled/,
|
||||
@@ -70,7 +78,10 @@ diag(`mv /tmp/12346/my.sandbox.cnf-original /tmp/12346/my.sandbox.cnf`);
|
||||
diag(`/tmp/12346/start >/dev/null`);
|
||||
diag(`/tmp/12346/use -e "set global read_only=1"`);
|
||||
|
||||
diag("Sleeping 3 seconds ...");
|
||||
sleep(3);
|
||||
$slave2_dbh->do('STOP SLAVE');
|
||||
$slave2_dbh->do('RESET SLAVE');
|
||||
$slave2_dbh->do('START SLAVE');
|
||||
|
||||
# #############################################################################
|
Reference in New Issue
Block a user