Use MASTER_GTID_WAIT in binlog tests

This should help with the slave synchronization problem.
This commit is contained in:
Markus Mäkelä 2018-08-03 17:00:48 +03:00
parent 0a81f78442
commit 0795d60007
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19

View File

@ -134,23 +134,14 @@ 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);
// 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)");
Row row = get_row(Test->repl->nodes[0], "SELECT @@gtid_current_pos");
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]));
std::string query = "SELECT MASTER_GTID_WAIT('" + row[0] + "', 120)";
get_row(Test->repl->nodes[i], query);
}
Test->try_query(Test->repl->nodes[0], "DROP TABLE test.t2");
for (i = 0; i < Test->repl->N; i++)
{
Test->tprintf("Checking data from node %d (%s)", i, Test->repl->IP[i]);