Sleep longer in mysqlmon_* tests

Increased the amount of time that the tests sleep while they wait for
states to change. This should make them more tolerant of server load by
allowing more time for things to settle down.
This commit is contained in:
Markus Mäkelä 2018-06-05 08:03:37 +03:00
parent 994d3bc22d
commit cfe676b1c8
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19
16 changed files with 46 additions and 50 deletions

View File

@ -60,7 +60,7 @@ int main(int argc, char** argv)
test.repl->block_node(1);
test.repl->block_node(2);
test.repl->block_node(3);
sleep(5);
sleep(10);
test.tprintf("Checking that master has stale status");
check_master(test);
@ -78,7 +78,7 @@ int main(int argc, char** argv)
test.repl->unblock_node(1);
test.repl->unblock_node(2);
test.repl->unblock_node(3);
sleep(5);
sleep(10);
test.tprintf("Checking that node 0 is the master and slaves are OK");
check_master(test);
@ -86,7 +86,7 @@ int main(int argc, char** argv)
test.tprintf("Blocking master to trigger stale slave status");
test.repl->block_node(0);
sleep(5);
sleep(10);
test.tprintf("Checking that slaves have stale status");
check_slave(test);
@ -102,7 +102,7 @@ int main(int argc, char** argv)
check_slave(test);
test.repl->unblock_node(0);
sleep(5);
sleep(10);
test.tprintf("Checking that node 0 is the master and slaves are OK");
check_master(test);

View File

@ -63,10 +63,10 @@ void restore_servers(TestConnections& test, bool events_added)
replicate_from(test, 0, 3);
replicate_from(test, 1, 3);
replicate_from(test, 2, 3);
sleep(3);
sleep(10);
o1 = test.maxscales->ssh_node_output(0,
"maxadmin call command mariadbmon switchover MySQL-Monitor server1 server4", true, &dummy);
sleep(2);
sleep(10);
int master_id = get_master_server_id(test);
test.assert(master_id == 1, "Switchover failed to set server1 as master.");
}
@ -106,7 +106,7 @@ int main(int argc, char *argv[])
test.try_query(test.repl->nodes[3], "STOP SLAVE;RESET SLAVE ALL;");
test.tprintf(" Wait for the monitor to detect it ");
sleep(8);
sleep(10);
test.tprintf(" Connect and insert should work ");
get_output(test);
@ -123,7 +123,6 @@ int main(int argc, char *argv[])
test.maxscales->connect_maxscale(0);
test.try_query(test.maxscales->conn_rwsplit[0], "INSERT INTO test.t1 VALUES (1)");
test.maxscales->close_maxscale_connections(0);
sleep(1);
test.repl->connect(3);
char result_tmp[bufsize];
if (find_field(test.repl->nodes[3], GTID_QUERY, GTID_FIELD, result_tmp) == 0)
@ -137,7 +136,7 @@ int main(int argc, char *argv[])
test.repl->unblock_node(2);
test.tprintf(" Wait for the monitor to detect it ");
sleep(8);
sleep(10);
test.tprintf("Check that we are still using the last node to which we failed over "
"to and that the old nodes are in maintenance mode");

View File

@ -60,7 +60,7 @@ int main(int argc, char** argv)
test.tprintf("Start by having the current master replicate from the external server");
test.repl->connect();
test.repl->replicate_from(0, 3);
sleep(5);
sleep(10);
check_status(test, "server1", master_running, "server1 should be the master");
check_status(test, "server2", slave_running, "server2 should be a slave");
check_status(test, "server3", slave_running, "server3 should be a slave");

View File

@ -35,7 +35,7 @@ int main(int argc, char** argv)
sleep(3);
test.maxscales->ssh_node_output(0, FAILOVER_CMD , true, &ec);
sleep(5);
sleep(10);
check_test_1(test, node0_id);
if (test.global_result != 0)
@ -48,7 +48,7 @@ int main(int argc, char** argv)
sleep(3);
test.maxscales->ssh_node_output(0, FAILOVER_CMD, true, &ec);
sleep(5);
sleep(10);
check_test_2(test);
if (test.global_result != 0)
@ -61,7 +61,7 @@ int main(int argc, char** argv)
sleep(3);
test.maxscales->ssh_node_output(0, FAILOVER_CMD, true, &ec);
sleep(5);
sleep(10);
check_test_3(test);
return test.global_result;

View File

@ -122,7 +122,7 @@ void insert_data(TestConnections& test)
void run(TestConnections& test)
{
sleep(5);
sleep(10);
cout << "\nConnecting to MaxScale." << endl;
x::connect_maxscale(test);
@ -162,7 +162,7 @@ void run(TestConnections& test)
cout << "\nClosing connection to MaxScale." << endl;
test.maxscales->close_maxscale_connections(0);
sleep(5);
sleep(10);
cout << "\nConnecting to MaxScale." << endl;
x::connect_maxscale(test);

View File

@ -44,7 +44,7 @@ int main(int argc, char** argv)
test.try_query(nodes[3], CHANGE_CMD);
test.try_query(nodes[3], "START SLAVE;");
sleep(4);
sleep(10);
get_output(test);
test.tprintf(LINE);
@ -56,7 +56,6 @@ int main(int argc, char** argv)
test.assert(master_id == -1, "Master was promoted even when no slave was eligible.");
test.repl->unblock_node(0);
sleep(1);
// Restore normal settings.
test.try_query(nodes[1], "START SLAVE;");

View File

@ -122,7 +122,7 @@ void expect(TestConnections& test, const char* zServer, const char* zState1, con
void run(TestConnections& test)
{
sleep(5);
sleep(10);
int N = test.repl->N;
cout << "Nodes: " << N << endl;
@ -147,7 +147,7 @@ void run(TestConnections& test)
cout << "\nStopping slave " << N - 1 << endl;
test.repl->stop_node(N - 1);
sleep(8);
sleep(10);
// server4 was stopped, so we expect the state of it to be /Down/,
// and the states of the other ones not to have changed.
@ -171,7 +171,7 @@ void run(TestConnections& test)
cout << "\nStopping master." << endl;
test.repl->stop_node(0);
sleep(8);
sleep(10);
// server1 (previous master) was taken down, so its state should be /Down/.
// server2 should have been made into master, and server4 should still be down.
@ -183,7 +183,7 @@ void run(TestConnections& test)
cout << "\nBringing up slave " << N - 1 << endl;
test.repl->start_node(N - 1, (char*)"");
sleep(8);
sleep(10);
// server1 should still be down, server2 still master, and server3 still
// a slave. server4 was brought up, so it should have been rejoined and

View File

@ -204,7 +204,7 @@ void stop_node(XTestConnections& test, int index)
void run(XTestConnections& test)
{
sleep(5);
sleep(10);
int N = test.repl->N;
cout << "Nodes: " << N << endl;
@ -236,7 +236,7 @@ void run(XTestConnections& test)
cout << "\nClosing connection to MaxScale." << endl;
test.maxscales->close_maxscale_connections(0);
sleep(5);
sleep(10);
list_servers(test);

View File

@ -157,7 +157,7 @@ void check_server_status(TestConnections& test, int N, int down = -1)
void run(TestConnections& test)
{
sleep(5);
sleep(10);
int N = test.repl->N;
cout << "Nodes: " << N << endl;
@ -183,14 +183,14 @@ void run(TestConnections& test)
cout << "\nStopping slave " << slave << endl;
test.repl->stop_node(i);
sleep(5);
sleep(10);
check_server_status(test, N, i);
cout << "\nStarting slave " << slave << endl;
test.repl->start_node(i, (char*)"");
sleep(5);
sleep(10);
check_server_status(test, N);
}

View File

@ -98,7 +98,7 @@ int main(int argc, char** argv)
test.assert(false, "Could not start MaxScale.");
return test.global_result;
}
sleep(5);
sleep(10);
get_output(test);
StringSet node2_states = test.get_server_status("server3");
@ -119,7 +119,7 @@ int main(int argc, char** argv)
snprintf(cmd, sizeof(cmd), CHANGE_CMD_FMT, test.repl->IP[3], test.repl->port[3]);
mysql_query(nodes[0], cmd);
mysql_query(nodes[0], "START SLAVE;");
sleep(5);
sleep(10);
get_output(test);
int master_id = get_master_server_id(test);
test.assert(master_id == 4, "Server 4 should be the cluster master.");
@ -132,7 +132,7 @@ int main(int argc, char** argv)
int ec;
test.maxscales->ssh_node_output(0,
"maxadmin call command mysqlmon switchover MySQL-Monitor server1 server4" , true, &ec);
sleep(1);
sleep(10);
master_id = get_master_server_id(test);
test.assert(master_id == 1, "Server 1 should be the cluster master.");
get_output(test);

View File

@ -88,7 +88,7 @@ int main(int argc, char** argv)
cout << "Stopping master, should auto-failover." << endl;
int master_id_old = get_master_server_id(test);
test.repl->stop_node(0);
sleep(5);
sleep(10);
get_output(test);
int master_id_new = get_master_server_id(test);
cout << "Master server id is " << master_id_new << endl;
@ -118,7 +118,7 @@ int main(int argc, char** argv)
test.assert(false, "Could not start MaxScale.");
return test.global_result;
}
sleep(5);
sleep(10);
get_output(test);
expect(test, "server1", "Running");
@ -139,7 +139,7 @@ int main(int argc, char** argv)
MYSQL** nodes = test.repl->nodes;
mysql_query(nodes[ind], cmd);
mysql_query(nodes[ind], "START SLAVE;");
sleep(5);
sleep(10);
get_output(test);
expect(test, "server1", "Running");

View File

@ -81,7 +81,7 @@ int main(int argc, char** argv)
int ec;
test.maxscales->ssh_node_output(0, "maxadmin call command mysqlmon switchover "
"MySQL-Monitor server1 server2" , true, &ec);
sleep(5); // Wait for monitor to update status
sleep(10); // Wait for monitor to update status
get_output(test);
master_id = get_master_server_id(test);
test.assert(master_id == old_master_id, "Switchover back to server1 failed.");

View File

@ -32,7 +32,6 @@ int main(int argc, char** argv)
char result_tmp[bufsize];
// Advance gtid:s a bit to so gtid variables are updated.
generate_traffic_and_check(test, maxconn, 10);
sleep(1);
test.tprintf(LINE);
print_gtids(test);
get_input();
@ -55,7 +54,6 @@ int main(int argc, char** argv)
{
cout << "Sending more inserts." << endl;
generate_traffic_and_check(test, maxconn, 5);
sleep(1);
if (find_field(maxconn, GTID_QUERY, GTID_FIELD, result_tmp) == 0)
{
gtid_final = result_tmp;
@ -63,13 +61,13 @@ int main(int argc, char** argv)
print_gtids(test);
cout << "Bringing old master back online..." << endl;
test.repl->start_node(master_index, (char*) "");
sleep(5);
sleep(10);
test.repl->connect();
get_output(test);
test.tprintf("and manually rejoining it to cluster.");
const char REJOIN_CMD[] = "maxadmin call command mariadbmon rejoin MySQL-Monitor server1";
test.maxscales->ssh_node_output(0, REJOIN_CMD , true, &ec);
sleep(2);
sleep(10);
get_output(test);
string gtid_old_master;
@ -85,7 +83,7 @@ int main(int argc, char** argv)
int ec;
test.maxscales->ssh_node_output(0, "maxadmin call command mysqlmon switchover "
"MySQL-Monitor server1 server2" , true, &ec);
sleep(5); // Wait for monitor to update status
sleep(10); // Wait for monitor to update status
get_output(test);
master_id = get_master_server_id(test);
test.assert(master_id == old_master_id, "Switchover back to server1 failed.");

View File

@ -94,7 +94,7 @@ int main(int argc, char** argv)
string rejoin_s4 = REJOIN_CMD + " server4";
test.maxscales->ssh_node_output(0, rejoin_s3.c_str() , true, &ec);
test.maxscales->ssh_node_output(0, rejoin_s4.c_str() , true, &ec);
sleep(5);
sleep(10);
get_output(test);
StringSet node2_states = test.get_server_status("server3");
@ -115,11 +115,11 @@ int main(int argc, char** argv)
snprintf(cmd, sizeof(cmd), CHANGE_CMD_FMT, test.repl->IP[3], test.repl->port[3]);
mysql_query(nodes[0], cmd);
mysql_query(nodes[0], "START SLAVE;");
sleep(5);
sleep(10);
string rejoin_s2 = REJOIN_CMD + " server2";
test.maxscales->ssh_node_output(0, rejoin_s2.c_str() , true, &ec);
test.maxscales->ssh_node_output(0, rejoin_s3.c_str() , true, &ec);
sleep(2);
sleep(10);
get_output(test);
int master_id = get_master_server_id(test);
test.assert(master_id == 4, "Server 4 should be the cluster master.");
@ -132,7 +132,7 @@ int main(int argc, char** argv)
int ec;
test.maxscales->ssh_node_output(0,
"maxadmin call command mysqlmon switchover MySQL-Monitor server1 server4" , true, &ec);
sleep(1);
sleep(10);
master_id = get_master_server_id(test);
test.assert(master_id == 1, "Server 1 should be the cluster master.");
get_output(test);

View File

@ -122,7 +122,7 @@ void expect(TestConnections& test, const char* zServer, const char* zState1, con
void run(TestConnections& test)
{
sleep(5);
sleep(10);
int N = test.repl->N;
cout << "Nodes: " << N << endl;
@ -149,7 +149,7 @@ void run(TestConnections& test)
zCommand = "call command mysqlmon switchover MySQL-Monitor server2 server1";
test.maxscales->execute_maxadmin_command_print(0, (char*)zCommand);
sleep(5);
sleep(10);
expect(test, "server1", "Slave", "Running");
expect(test, "server2", "Master", "Running");
@ -162,7 +162,7 @@ void run(TestConnections& test)
zCommand = "call command mysqlmon switchover MySQL-Monitor server1 server2";
test.maxscales->execute_maxadmin_command_print(0, (char*)zCommand);
sleep(5);
sleep(10);
expect(test, "server1", "Master", "Running");
expect(test, "server2", "Slave", "Running");

View File

@ -122,7 +122,7 @@ void expect(TestConnections& test, const char* zServer, const char* zState1, con
void run(TestConnections& test)
{
sleep(5);
sleep(10);
int N = test.repl->N;
cout << "Nodes: " << N << endl;
@ -147,7 +147,7 @@ void run(TestConnections& test)
cout << "\nStopping slave " << N - 1 << endl;
test.repl->stop_node(N - 1);
sleep(8);
sleep(10);
// server4 was stopped, so we expect the state of it to be /Down/,
// and the states of the other ones not to have changed.
@ -171,7 +171,7 @@ void run(TestConnections& test)
cout << "\nStopping master." << endl;
test.repl->stop_node(0);
sleep(8);
sleep(10);
// server1 (previous master) was taken down, so its state should be /Down/.
// server2 should have been made into master, and server4 should still be down.
@ -183,7 +183,7 @@ void run(TestConnections& test)
cout << "\nBringing up slave " << N - 1 << endl;
test.repl->start_node(N - 1, (char*)"");
sleep(8);
sleep(10);
// server1 should still be down, server2 still master, and server3 still
// a slave. server4 was brought up, but as auto_rejoin is false, it should
@ -198,7 +198,7 @@ void run(TestConnections& test)
const char* zCommand = "call command mysqlmon switchover MySQL-Monitor server4 server2";
test.maxscales->execute_maxadmin_command_print(0, (char*)zCommand);
sleep(8);
sleep(10);
// The state should not change, as server4 is not good enough as master.
expect(test, "server1", "Down");