MXS-3915: Add test case
Extended sanity_check to cover this bug. The test reproduces the bug and verifies that the fix works.
This commit is contained in:
@ -49,6 +49,7 @@ add_subdirectory(cdc_datatypes)
|
|||||||
# MXS-682
|
# MXS-682
|
||||||
# MXS-957
|
# MXS-957
|
||||||
# MXS-1786
|
# MXS-1786
|
||||||
|
# MXS-3915
|
||||||
add_test_executable(sanity_check.cpp sanity_check replication LABELS readwritesplit LIGHT REPL_BACKEND)
|
add_test_executable(sanity_check.cpp sanity_check replication LABELS readwritesplit LIGHT REPL_BACKEND)
|
||||||
|
|
||||||
# Repeatedly connect to maxscale while the backends reject all connections, expect no crash
|
# Repeatedly connect to maxscale while the backends reject all connections, expect no crash
|
||||||
|
|||||||
@ -99,6 +99,20 @@ void test_rwsplit(TestConnections& test)
|
|||||||
test.maxscales->disconnect();
|
test.maxscales->disconnect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void test_mxs3915(TestConnections& test)
|
||||||
|
{
|
||||||
|
auto c = test.maxscale->rwsplit();
|
||||||
|
test.expect(c.connect(), "Failed to connect: %s", c.error());
|
||||||
|
c.query("SET autocommit=0");
|
||||||
|
c.query("COMMIT");
|
||||||
|
c.query("SET autocommit=1");
|
||||||
|
auto id = c.field("SELECT @@server_id");
|
||||||
|
|
||||||
|
test.repl->connect();
|
||||||
|
auto master_id = test.repl->get_server_id_str(0);
|
||||||
|
test.expect(id != master_id, "SELECT was routed to master after re-enabling autocommit");
|
||||||
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv)
|
int main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
TestConnections test(argc, argv);
|
TestConnections test(argc, argv);
|
||||||
@ -127,5 +141,8 @@ int main(int argc, char** argv)
|
|||||||
// Readwritesplit sanity checks
|
// Readwritesplit sanity checks
|
||||||
test_rwsplit(test);
|
test_rwsplit(test);
|
||||||
|
|
||||||
|
// MXS-3915: Autocommit tracking is broken
|
||||||
|
test_mxs3915(test);
|
||||||
|
|
||||||
return test.global_result;
|
return test.global_result;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user