Merge remote-tracking branch 'origin/2.3' into 2.4
This commit is contained in:
commit
4d51342561
@ -18,36 +18,50 @@
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
TestConnections test(argc, argv);
|
||||
printf("Connecting to RWSplit");
|
||||
|
||||
test.set_timeout(60);
|
||||
test.add_result(test.maxscales->connect_rwsplit(0), "Error connection to RWSplit! Exiting");
|
||||
test.maxscales->wait_for_monitor();
|
||||
test.repl->connect();
|
||||
auto ids = test.repl->get_all_server_ids();
|
||||
test.repl->disconnect();
|
||||
|
||||
test.tprintf("Checking current slave");
|
||||
int res = 0;
|
||||
int old_slave = test.find_connected_slave(0, &res);
|
||||
test.add_result(res, "no current slave");
|
||||
auto conn = test.maxscales->rwsplit();
|
||||
test.expect(conn.connect(), "Connection to rwsplit should work: %s", conn.error());
|
||||
|
||||
test.tprintf("Setup firewall to block mysql on old slave (oldslave is node %d)", old_slave);
|
||||
auto first_slave = conn.field("SELECT @@server_id");
|
||||
conn.disconnect();
|
||||
|
||||
test.add_result((old_slave < 0) || (old_slave >= test.repl->N), "Active slave is not found");
|
||||
test.repl->block_node(old_slave);
|
||||
test.expect(!first_slave.empty(), "Result should not be empty");
|
||||
int slave = std::stoi(first_slave);
|
||||
test.expect(slave != ids[0], "The result should not be from the master");
|
||||
|
||||
test.tprintf("Waiting for MaxScale to find a new slave");
|
||||
test.stop_timeout();
|
||||
test.maxscales->wait_for_monitor();
|
||||
test.set_timeout(60);
|
||||
for (int i = 1; i < test.repl->N; i++)
|
||||
{
|
||||
if (ids[i] == slave)
|
||||
{
|
||||
test.repl->block_node(i);
|
||||
test.maxscales->wait_for_monitor();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
test.set_timeout(20);
|
||||
int current_slave = test.find_connected_slave(0, &res);
|
||||
test.add_result((current_slave == old_slave) || (current_slave < 0), "No failover happened");
|
||||
test.set_timeout(60);
|
||||
test.expect(conn.connect(), "Connection to rwsplit should work: %s", conn.error());
|
||||
auto second_slave = conn.field("SELECT @@server_id");
|
||||
|
||||
test.tprintf("Unblock old node");
|
||||
test.repl->unblock_node(old_slave);
|
||||
test.maxscales->close_rwsplit(0);
|
||||
test.expect(!second_slave.empty(), "Second result should not be empty");
|
||||
test.expect(first_slave != second_slave, "The slave should change");
|
||||
slave = std::stoi(second_slave);
|
||||
test.expect(slave != ids[0], "The result should not be from the master");
|
||||
|
||||
test.check_maxscale_alive(0);
|
||||
test.stop_timeout();
|
||||
test.repl->fix_replication();
|
||||
for (int i = 1; i < test.repl->N; i++)
|
||||
{
|
||||
if (ids[i] == slave)
|
||||
{
|
||||
test.repl->unblock_node(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return test.global_result;
|
||||
}
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include <maxscale/maxscale.h>
|
||||
#include <maxscale/pcre2.h>
|
||||
#include <maxscale/utils.h>
|
||||
#include <maxscale/routingworker.hh>
|
||||
|
||||
static const char* statefile_section = "avro-conversion";
|
||||
|
||||
@ -531,6 +532,7 @@ bool read_fde(Avro* router)
|
||||
*/
|
||||
avro_binlog_end_t avro_read_all_events(Avro* router)
|
||||
{
|
||||
mxs::WatchdogWorkaround workaround;
|
||||
mxb_assert(router->binlog_fd != -1);
|
||||
|
||||
if (!read_fde(router))
|
||||
|
Loading…
x
Reference in New Issue
Block a user