mirror of
https://github.com/percona/percona-toolkit.git
synced 2025-09-04 19:37:49 +00:00
PT-1637 Added tests and exit code
This commit is contained in:
@@ -6591,7 +6591,6 @@ sub next {
|
||||
}
|
||||
$self->{rowno} = 0;
|
||||
$self->{have_rows} = 0;
|
||||
|
||||
}
|
||||
|
||||
PTDEBUG && _d('Done nibbling');
|
||||
@@ -11510,6 +11509,9 @@ sub main {
|
||||
}
|
||||
};
|
||||
if ( $EVAL_ERROR ) {
|
||||
if ($EVAL_ERROR =~ m/replication/) {
|
||||
exit($PTC_EXIT_STATUS{REPLICATION_STOPPED});
|
||||
}
|
||||
# This should not happen. If it does, it's probably some bug
|
||||
# or error that we're not catching.
|
||||
warn ts(($oktorun ? "Error " : "Fatal error ")
|
||||
|
@@ -39,7 +39,7 @@ my ($slave2_dbh, $slave2_dsn) = $sb->start_sandbox(
|
||||
master => 'chan_master1',
|
||||
);
|
||||
|
||||
my $dbh = $sb->get_dbh_for('chan_master1');
|
||||
my $dbh = $sb->get_dbh_for('master');
|
||||
|
||||
if ( !$dbh ) {
|
||||
plan skip_all => 'Cannot connect to sandbox master';
|
||||
@@ -59,31 +59,29 @@ my @args = ($master1_dsn,
|
||||
"--run-time", "5", "--fail-on-stopped-replication",
|
||||
);
|
||||
|
||||
diag(join(" ", @args));
|
||||
|
||||
# The sandbox servers run with lock_wait_timeout=3 and it's not dynamic
|
||||
# so we need to specify --set-vars innodb_lock_wait_timeout=3 else the tool will die.
|
||||
my $master_dsn = $sb->dsn_for('master');
|
||||
$sb->do_as_root("chan_slave1", 'stop slave IO_thread;');
|
||||
|
||||
my $output;
|
||||
my $exit_status;
|
||||
|
||||
$output = output(
|
||||
($output, $exit_status) = full_output(
|
||||
sub { $exit_status = pt_table_checksum::main(@args) },
|
||||
stderr => 1,
|
||||
);
|
||||
diag($output);
|
||||
|
||||
is(
|
||||
$exit_status,
|
||||
0,
|
||||
"PT-1616 pt-table-cheksum before --resume with binary fields exit status",
|
||||
128,
|
||||
"PT-1637 exist status 128 if replication is stopped and --fail-on-replication-stopped",
|
||||
);
|
||||
|
||||
$sb->stop_sandbox('chan_master1');
|
||||
$sb->stop_sandbox('chan_slave1');
|
||||
$sb->stop_sandbox('chan_slave2');
|
||||
$sb->do_as_root("chan_slave1", 'start slave IO_thread;');
|
||||
sleep(2);
|
||||
|
||||
$sb->stop_sandbox(qw(chan_master1 chan_slave2 chan_slave1));
|
||||
|
||||
# #############################################################################
|
||||
# Done.
|
||||
# #############################################################################
|
||||
|
Reference in New Issue
Block a user