Use a more intrusive waiting in setup_binlog

As we know that the test doesn't rely on absolute binlog positions, we can
force synchronization by creating a table on the master and waiting until
that table is replicated to all slaves.
This commit is contained in:
Markus Mäkelä 2018-07-18 15:31:32 +03:00
parent 3817960658
commit d6c378187c
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19

View File

@ -134,8 +134,22 @@ void test_binlog(TestConnections* Test)
Test->add_result(insert_into_t1(Test->repl->nodes[0], 4), "Data inserting to t1 failed");
Test->stop_timeout();
Test->tprintf("Waiting for replication to catch up");
Test->set_timeout(500);
Test->repl->sync_slaves();
// Create a table and wait for it to replicate to all servers
Test->try_query(Test->repl->nodes[0], "CREATE TABLE test.t2(id INT)");
for (int i = 1; i < Test->repl->N; i++)
{
// The timeout set before will terminate the loop if a fatal error occurs
while (execute_query_silent(Test->repl->nodes[i], "SELECT * FROM test.t2"))
{
sleep(1);
}
mysql_free_result(mysql_store_result(Test->repl->nodes[i]));
}
Test->try_query(Test->repl->nodes[0], "DROP TABLE test.t2");
for (i = 0; i < Test->repl->N; i++)
{