MXS-1889 Add test

If all slaves are down, a connection should be created to the
master.
This commit is contained in:
Johan Wikman
2018-06-01 09:22:29 +03:00
parent d77a9a3040
commit a319c5ad19
3 changed files with 129 additions and 0 deletions

View File

@ -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)

View File

@ -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

View File

@ -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;
}