PMM-1455 pt-osc is stuck when the table that is being altered is filtered out in the slave

This commit is contained in:
Carlos Salguero
2018-02-16 14:27:16 -03:00
parent 943cb68ee0
commit d8ec16f213
8 changed files with 44 additions and 71 deletions

View File

@@ -46,6 +46,11 @@ my $exit_status;
my $sample = "t/pt-online-schema-change/samples/";
$sb->load_file('master', "$sample/issue-1646713.sql");
my $num_rows = 1000;
my $master_port = 12345;
$master_dbh->do("FLUSH TABLES");
$sb->wait_for_slaves();
sub start_thread {
my ($dsn_opts, $sleep_time) = @_;
@@ -53,14 +58,18 @@ sub start_thread {
my $sb = new Sandbox(basedir => '/tmp', DSNParser => $dp);
my $dbh = $sb->get_dbh_for('master');
diag("Thread started: Sleeping $sleep_time seconds before updating the PK field for row with id=1 in test.sbtest");
sleep($sleep_time);
# We need to lock the tables to prevent osc to really start before we are able to write the row to the table
$dbh->do("LOCK TABLES `test`.`o1` WRITE");
select(undef, undef, undef, $sleep_time);
$dbh->do("UPDATE `test`.`o1` SET id=0 WHERE id=1");
$dbh->do("UNLOCK TABLES");
diag("Row updated");
}
my $thr = threads->create('start_thread', $dsn_opts, 1);
my $thr = threads->create('start_thread', $dsn_opts, 0.50);
$thr->detach();
threads->yield();
diag("Starting osc. A row will be updated in a different thread.");
my $dir = tempdir( CLEANUP => 1 );
$output = output(
@@ -71,6 +80,7 @@ $output = output(
),
},
);
diag($output);
like(
$output,