diff --git a/maxscale-system-test/CMakeLists.txt b/maxscale-system-test/CMakeLists.txt index 02d9bf536..827a588fc 100644 --- a/maxscale-system-test/CMakeLists.txt +++ b/maxscale-system-test/CMakeLists.txt @@ -922,6 +922,10 @@ add_test_executable(mxs1628_bad_handshake.cpp mxs1628_bad_handshake replication # MXS-1836: MaxInfo "show eventTimes" returns garbage. add_test_executable(mxs1836_show_eventTimes.cpp mxs1836_show_eventTimes mxs1836_show_eventTimes LABELS REPL_BACKEND) + # MXS-1889: A single remaining master is valid for readconnroute configured with 'router_options=slave' + # https://jira.mariadb.org/browse/MXS-1889 +add_test_executable(mxs1889.cpp mxs1889 mxs1889 LABELS REPL_BACKEND) + configure_file(templates.h.in templates.h @ONLY) include(CTest) diff --git a/maxscale-system-test/cnf/maxscale.cnf.template.mxs1889 b/maxscale-system-test/cnf/maxscale.cnf.template.mxs1889 new file mode 100644 index 000000000..e31fc2c9e --- /dev/null +++ b/maxscale-system-test/cnf/maxscale.cnf.template.mxs1889 @@ -0,0 +1,89 @@ +[maxscale] +threads=###threads### +log_info=on + +[MySQL Monitor] +type=monitor +module=mysqlmon +###repl51### +servers=server1,server2,server3,server4 +user=maxskysql +passwd=skysql +monitor_interval=1000 + +[RW Split Router] +type=service +router=readwritesplit +servers=server1,server2,server3,server4 +user=maxskysql +passwd=skysql +router_options=slave_selection_criteria=LEAST_GLOBAL_CONNECTIONS +max_slave_connections=1 + +[Read Connection Router Slave] +type=service +router=readconnroute +router_options=slave +servers=server1,server2,server3,server4 +user=maxskysql +passwd=skysql + +[Read Connection Router Master] +type=service +router=readconnroute +router_options=master +servers=server1,server2,server3,server4 +user=maxskysql +passwd=skysql + +[RW Split Listener] +type=listener +service=RW Split Router +protocol=MySQLClient +port=4006 + +[Read Connection Listener Slave] +type=listener +service=Read Connection Router Slave +protocol=MySQLClient +port=4009 + +[Read Connection Listener Master] +type=listener +service=Read Connection Router Master +protocol=MySQLClient +port=4008 + +[CLI] +type=service +router=cli + +[CLI Listener] +type=listener +service=CLI +protocol=maxscaled +socket=default + +[server1] +type=server +address=###node_server_IP_1### +port=###node_server_port_1### +protocol=MySQLBackend + +[server2] +type=server +address=###node_server_IP_2### +port=###node_server_port_2### +protocol=MySQLBackend + +[server3] +type=server +address=###node_server_IP_3### +port=###node_server_port_3### +protocol=MySQLBackend + +[server4] +type=server +address=###node_server_IP_4### +port=###node_server_port_4### +protocol=MySQLBackend diff --git a/maxscale-system-test/mxs1889.cpp b/maxscale-system-test/mxs1889.cpp new file mode 100644 index 000000000..2a99c38ad --- /dev/null +++ b/maxscale-system-test/mxs1889.cpp @@ -0,0 +1,36 @@ +/** + * MXS-1889: A single remaining master is valid for readconnroute configured with 'router_options=slave' + * + * https://jira.mariadb.org/browse/MXS-1889 + */ + +#include "testconnections.h" + +int main(int argc, char** argv) +{ + TestConnections test(argc, argv); + + // Give some time for things to stabilize. + sleep(2); + + // Take down all slaves. + test.repl->stop_node(1); + test.repl->stop_node(2); + test.repl->stop_node(3); + + // Give the monitor some time to detect it + sleep(5); + + test.maxscales->connect(); + + // Should succeed. + test.try_query(test.maxscales->conn_slave[0], "SELECT 1"); + + int rv = test.global_result; + + test.repl->start_node(3); + test.repl->start_node(2); + test.repl->start_node(1); + + return rv; +}