From 9c08d78304dbb495f877b872fca00caa7c550eef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Mon, 10 Sep 2018 21:42:18 +0300 Subject: [PATCH 01/12] Add missing error messages If tee filter creation fails, it would not log an error message. --- server/core/filter.cc | 2 ++ server/core/session.cc | 1 + server/modules/filter/tee/teesession.cc | 4 ++++ 3 files changed, 7 insertions(+) diff --git a/server/core/filter.cc b/server/core/filter.cc index 0fc53ca5f..88d38e9ba 100644 --- a/server/core/filter.cc +++ b/server/core/filter.cc @@ -420,6 +420,7 @@ filter_apply(MXS_FILTER_DEF *filter, MXS_SESSION *session, MXS_DOWNSTREAM *downs if ((me = (MXS_DOWNSTREAM *)MXS_CALLOC(1, sizeof(MXS_DOWNSTREAM))) == NULL) { + MXS_OOM(); return NULL; } me->instance = filter->filter; @@ -427,6 +428,7 @@ filter_apply(MXS_FILTER_DEF *filter, MXS_SESSION *session, MXS_DOWNSTREAM *downs if ((me->session = filter->obj->newSession(me->instance, session)) == NULL) { + MXS_ERROR("Failed to create filter session for '%s'", filter->name); MXS_FREE(me); return NULL; } diff --git a/server/core/session.cc b/server/core/session.cc index 9ea030cc2..4ae62812e 100644 --- a/server/core/session.cc +++ b/server/core/session.cc @@ -628,6 +628,7 @@ session_setup_filters(MXS_SESSION *session) if ((session->filters = (SESSION_FILTER*)MXS_CALLOC(service->n_filters, sizeof(SESSION_FILTER))) == NULL) { + MXS_OOM(); return 0; } session->n_filters = service->n_filters; diff --git a/server/modules/filter/tee/teesession.cc b/server/modules/filter/tee/teesession.cc index 5f83cce19..487baca9a 100644 --- a/server/modules/filter/tee/teesession.cc +++ b/server/modules/filter/tee/teesession.cc @@ -98,6 +98,7 @@ TeeSession* TeeSession::create(Tee* my_instance, MXS_SESSION* session) if ((match && (md_match = pcre2_match_data_create_from_pattern(match, NULL)) == NULL) || (exclude && (md_exclude = pcre2_match_data_create_from_pattern(exclude, NULL)) == NULL)) { + MXS_OOM(); return NULL; } @@ -105,6 +106,9 @@ TeeSession* TeeSession::create(Tee* my_instance, MXS_SESSION* session) (MySQLProtocol*)session->client_dcb->protocol, my_instance->get_service())) == NULL) { + MXS_ERROR("Failed to create local client connection to '%s'%s", + my_instance->get_service()->name, + my_instance->get_service()->ports ? "" : ": Service has no network listeners"); return NULL; } } From e15b0e214748d839594c35b6eaa54e038f6209b9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Mon, 10 Sep 2018 22:07:34 +0300 Subject: [PATCH 02/12] MXS-2041: Fix crash on failed schemarouter session When the setting up of filters for a session fails, the DCB is closed and the client DCB's session pointer is set to NULL. This needs to be checked in the schemarouter before the `m_client->session` pointer is used. The act of setting the session pointer to NULL should not be necessary as the session is freed once the reference count drops down to zero. Due to the fact that changing this would require moderate changes in session code means that it should not be done in a patch release as the risks are too high. --- server/modules/routing/schemarouter/schemaroutersession.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/modules/routing/schemarouter/schemaroutersession.cc b/server/modules/routing/schemarouter/schemaroutersession.cc index dd77f2d91..e7044829b 100644 --- a/server/modules/routing/schemarouter/schemaroutersession.cc +++ b/server/modules/routing/schemarouter/schemaroutersession.cc @@ -610,7 +610,8 @@ void SchemaRouterSession::handleError(GWBUF* pMessage, break; case ERRACT_REPLY_CLIENT: - if (m_client->session->state == SESSION_STATE_ROUTER_READY) + // The session pointer can be NULL if the creation fails when filters are being set up + if (m_client->session && m_client->session->state == SESSION_STATE_ROUTER_READY) { m_client->func.write(m_client, gwbuf_clone(pMessage)); } From d7b7f43efb9d1569aaad0c528915dae52406da6a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Tue, 11 Sep 2018 08:07:22 +0300 Subject: [PATCH 03/12] Rename misleading function The expecting resultset function does not expect a resultset but a text protocol result. --- server/modules/protocol/MySQL/mariadbbackend/mysql_backend.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.c b/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.c index 983175c0e..16df96206 100644 --- a/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.c +++ b/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.c @@ -640,7 +640,7 @@ static inline bool session_ok_to_route(DCB *dcb) return rval; } -static inline bool expecting_resultset(MySQLProtocol *proto) +static inline bool expecting_text_result(MySQLProtocol *proto) { return proto->current_command == MXS_COM_QUERY || proto->current_command == MXS_COM_STMT_FETCH; @@ -818,7 +818,7 @@ gw_read_and_write(DCB *dcb) if (collecting_resultset(proto, capabilities)) { - if (expecting_resultset(proto)) + if (expecting_text_result(proto)) { if (mxs_mysql_is_result_set(read_buffer)) { From d04c7135b00c601605a8e11cca65caa528e3b97d Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Wed, 12 Sep 2018 09:43:36 +0300 Subject: [PATCH 04/12] Update change log and release notes --- Documentation/Changelog.md | 1 + .../Release-Notes/MaxScale-2.2.14-Release-Notes.md | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Documentation/Changelog.md b/Documentation/Changelog.md index c47b69a55..e35e9221c 100644 --- a/Documentation/Changelog.md +++ b/Documentation/Changelog.md @@ -28,6 +28,7 @@ the master. There is also limited capability for rejoining nodes. For more details, please refer to: +* [MariaDB MaxScale 2.2.14 Release Notes](Release-Notes/MaxScale-2.2.14-Release-Notes.md) * [MariaDB MaxScale 2.2.13 Release Notes](Release-Notes/MaxScale-2.2.13-Release-Notes.md) * [MariaDB MaxScale 2.2.12 Release Notes](Release-Notes/MaxScale-2.2.12-Release-Notes.md) * [MariaDB MaxScale 2.2.11 Release Notes](Release-Notes/MaxScale-2.2.11-Release-Notes.md) diff --git a/Documentation/Release-Notes/MaxScale-2.2.14-Release-Notes.md b/Documentation/Release-Notes/MaxScale-2.2.14-Release-Notes.md index 94dd21839..edbc84b88 100644 --- a/Documentation/Release-Notes/MaxScale-2.2.14-Release-Notes.md +++ b/Documentation/Release-Notes/MaxScale-2.2.14-Release-Notes.md @@ -2,8 +2,8 @@ Release 2.2.14 is a GA release. -This document describes the changes in release 2.2.14, when compared to the -previous release in the same series. +This document describes the changes in release 2.2.14, when compared to +release 2.2.13. For any problems you encounter, please consider submitting a bug report on [our Jira](https://jira.mariadb.org/projects/MXS). @@ -14,7 +14,10 @@ report on [our Jira](https://jira.mariadb.org/projects/MXS). ## Bug fixes +* [MXS-2041](https://jira.mariadb.org/browse/MXS-2041) Crash on failure to create schemarouter session +* [MXS-2040](https://jira.mariadb.org/browse/MXS-2040) Default monitor timeouts are too short * [MXS-2037](https://jira.mariadb.org/browse/MXS-2037) % wildcards not working with source in Named Server Filter +* [MXS-2036](https://jira.mariadb.org/browse/MXS-2036) A slave with sql thread stopped causes wrong master after failover * [MXS-2034](https://jira.mariadb.org/browse/MXS-2034) query_retry_timeout was not set * [MXS-2027](https://jira.mariadb.org/browse/MXS-2027) LOAD DATA LOCAL INFILE is not ignored by protocol modules * [MXS-2024](https://jira.mariadb.org/browse/MXS-2024) Crash in reauthenticate_client From 1bffb1c26da611e79de8dec14378373b86ca5564 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Wed, 12 Sep 2018 09:46:35 +0300 Subject: [PATCH 05/12] Fix release note generation script The CMake command that reads the VERSION.cmake file needs to be executed in the source root. --- Documentation/Release-Notes/generate_release_notes.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Documentation/Release-Notes/generate_release_notes.sh b/Documentation/Release-Notes/generate_release_notes.sh index 125cba202..905e90476 100755 --- a/Documentation/Release-Notes/generate_release_notes.sh +++ b/Documentation/Release-Notes/generate_release_notes.sh @@ -1,11 +1,11 @@ #!/bin/bash -major=`cmake -P ../../VERSION.cmake -L|grep 'MAXSCALE_VERSION_MAJOR'|sed 's/.*=//'` -minor=`cmake -P ../../VERSION.cmake -L|grep 'MAXSCALE_VERSION_MINOR'|sed 's/.*=//'` -patch=`cmake -P ../../VERSION.cmake -L|grep 'MAXSCALE_VERSION_PATCH'|sed 's/.*=//'` -maturity=`cmake -P ../../VERSION.cmake -L|grep 'MAXSCALE_MATURITY'|sed 's/.*=//'` +major="`cd ../../ && cmake -P ./VERSION.cmake -L|grep 'MAXSCALE_VERSION_MAJOR'|sed 's/.*=//'`" +minor="`cd ../../ && cmake -P ./VERSION.cmake -L|grep 'MAXSCALE_VERSION_MINOR'|sed 's/.*=//'`" +patch="`cd ../../ && cmake -P ./VERSION.cmake -L|grep 'MAXSCALE_VERSION_PATCH'|sed 's/.*=//'`" +maturity="`cd ../../ && cmake -P ./VERSION.cmake -L|grep 'MAXSCALE_MATURITY'|sed 's/.*=//'`" -VERSION=${major}.${minor}.${patch} +VERSION="${major}.${minor}.${patch}" cat < MaxScale-$VERSION-Release-Notes.md # MariaDB MaxScale ${VERSION} Release Notes From 077f344a206461eb5434cbe84bbe1ca68ddb366d Mon Sep 17 00:00:00 2001 From: Marko Date: Thu, 6 Sep 2018 17:59:18 +0300 Subject: [PATCH 06/12] MXS-2037 Add test case --- maxscale-system-test/CMakeLists.txt | 4 + ...cnf.template.mxs2037_namedserver_wildcards | 95 +++++++++++++++++++ .../mxs2037_namedserver_wildcards.cpp | 23 +++++ 3 files changed, 122 insertions(+) create mode 100644 maxscale-system-test/cnf/maxscale.cnf.template.mxs2037_namedserver_wildcards create mode 100644 maxscale-system-test/mxs2037_namedserver_wildcards.cpp diff --git a/maxscale-system-test/CMakeLists.txt b/maxscale-system-test/CMakeLists.txt index a2bbbc342..4bb197822 100644 --- a/maxscale-system-test/CMakeLists.txt +++ b/maxscale-system-test/CMakeLists.txt @@ -969,6 +969,10 @@ add_test_executable(mxs1961_standalone_rejoin.cpp mxs1961_standalone_rejoin mxs1 # https://jira.mariadb.org/browse/MXS-1985 add_test_executable(mxs1985_kill_hang.cpp mxs1985_kill_hang replication LABELS REPL_BACKEND) +# MXS-2037: Wildcards not working with source in Named Server Filter +# https://jira.mariadb.org/browse/MXS-2037 +add_test_executable(mxs2037_namedserver_wildcards.cpp mxs2037_namedserver_wildcards mxs2037_namedserver_wildcards LABELS namedserverfilter LIGHT REPL_BACKEND) + configure_file(templates.h.in templates.h @ONLY) include(CTest) diff --git a/maxscale-system-test/cnf/maxscale.cnf.template.mxs2037_namedserver_wildcards b/maxscale-system-test/cnf/maxscale.cnf.template.mxs2037_namedserver_wildcards new file mode 100644 index 000000000..831d968a4 --- /dev/null +++ b/maxscale-system-test/cnf/maxscale.cnf.template.mxs2037_namedserver_wildcards @@ -0,0 +1,95 @@ +[maxscale] +threads=###threads### +log_warning=1 + +[namedserverfilter] +type=filter +module=namedserverfilter +match01=SELECT +target01=server1 +source=127.%.%.% + +[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 +filters=namedserverfilter + +[CLI] +type=service +router=cli + +[CLI Listener] +type=listener +service=CLI +protocol=maxscaled +socket=default + +[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 + +[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/mxs2037_namedserver_wildcards.cpp b/maxscale-system-test/mxs2037_namedserver_wildcards.cpp new file mode 100644 index 000000000..a3e7ab649 --- /dev/null +++ b/maxscale-system-test/mxs2037_namedserver_wildcards.cpp @@ -0,0 +1,23 @@ +/** + * MXS-2037: Wildcards not working with source in NamedServerFilter + * + * https://jira.mariadb.org/browse/MXS-2037 + * + * This test only tests that ip addresses with wildcards are accepted by + * NamedServerFilter. The actual matching functionality is not tested + * because the client IPs can change with the different test environments + * and that would make it complicated to check if the matching is correct. + */ + + +#include "testconnections.h" + +int main(int argc, char **argv) +{ + TestConnections test(argc, argv); + test.set_timeout(10); + test.maxscales->connect_maxscale(0); + test.add_result(execute_query(test.maxscales->conn_rwsplit[0], "select 1"), "Can't connect to backend"); + test.maxscales->close_maxscale_connections(0); + return test.global_result; +} From 643480240c90ebda22d1f9259b358a27dbb9e55a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Wed, 12 Sep 2018 10:19:08 +0300 Subject: [PATCH 07/12] Simplify MaxCtrl version extraction Instead of using the correct version in in-source builds, a dummy file is copied in place. This removes the need to explicitly include the VERSION.cmake file. --- maxctrl/CMakeLists.txt | 2 +- maxctrl/configure_version.cmake | 2 -- maxctrl/package.json | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) delete mode 100644 maxctrl/configure_version.cmake diff --git a/maxctrl/CMakeLists.txt b/maxctrl/CMakeLists.txt index 4ab468542..67fe828e0 100644 --- a/maxctrl/CMakeLists.txt +++ b/maxctrl/CMakeLists.txt @@ -4,7 +4,7 @@ if (BUILD_MAXCTRL) if (NPM_FOUND AND NODEJS_FOUND AND NODEJS_VERSION VERSION_GREATER "6.0.0") - include(configure_version.cmake) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/lib/version.js.in ${CMAKE_CURRENT_BINARY_DIR}/lib/version.js @ONLY) add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/maxctrl/maxctrl COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build.sh ${CMAKE_SOURCE_DIR} diff --git a/maxctrl/configure_version.cmake b/maxctrl/configure_version.cmake deleted file mode 100644 index cba3ce999..000000000 --- a/maxctrl/configure_version.cmake +++ /dev/null @@ -1,2 +0,0 @@ -include(../VERSION.cmake) -configure_file(${CMAKE_CURRENT_SOURCE_DIR}/lib/version.js.in ${CMAKE_CURRENT_BINARY_DIR}/lib/version.js @ONLY) diff --git a/maxctrl/package.json b/maxctrl/package.json index 43c11bbd5..de5ff996d 100644 --- a/maxctrl/package.json +++ b/maxctrl/package.json @@ -6,7 +6,7 @@ "main": "maxctrl.js", "scripts": { "test": "nyc mocha --timeout 15000 --slow 10000", - "preinstall": "cmake -P configure_version.cmake" + "preinstall": "test -f lib/version.js || cp lib/version.js.in lib/version.js" }, "keywords": [ "maxscale" From f6840fbded340781ca3b1ffe0eb85c06c7936b69 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Wed, 12 Sep 2018 10:24:34 +0300 Subject: [PATCH 08/12] Remove implicit initialization of all maxscales The extra maxscale instances are only started if the test explicitly requests it. --- maxscale-system-test/keepalived.cpp | 1 + maxscale-system-test/keepalived_masterdown.cpp | 1 + maxscale-system-test/testconnections.cpp | 16 ++++++++++++++-- maxscale-system-test/testconnections.h | 3 +++ 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/maxscale-system-test/keepalived.cpp b/maxscale-system-test/keepalived.cpp index 985ef7c5d..b5935e35e 100644 --- a/maxscale-system-test/keepalived.cpp +++ b/maxscale-system-test/keepalived.cpp @@ -22,6 +22,7 @@ int main(int argc, char *argv[]) char * version; + TestConnections::multiple_maxscales(true); TestConnections * Test = new TestConnections(argc, argv); Test->set_timeout(10); diff --git a/maxscale-system-test/keepalived_masterdown.cpp b/maxscale-system-test/keepalived_masterdown.cpp index e5314d93c..902c84feb 100644 --- a/maxscale-system-test/keepalived_masterdown.cpp +++ b/maxscale-system-test/keepalived_masterdown.cpp @@ -38,6 +38,7 @@ int main(int argc, char *argv[]) bool passive; char str[1024]; + TestConnections::multiple_maxscales(true); TestConnections * Test = new TestConnections(argc, argv); //Test->set_timeout(10); diff --git a/maxscale-system-test/testconnections.cpp b/maxscale-system-test/testconnections.cpp index 7767b7c1e..d172832f2 100644 --- a/maxscale-system-test/testconnections.cpp +++ b/maxscale-system-test/testconnections.cpp @@ -21,6 +21,7 @@ static bool check_nodes = true; static bool manual_debug = false; static std::string required_repl_version; static std::string required_galera_version; +static bool multiple_maxscales = false; } static void signal_set(int sig, void (*handler)(int)) @@ -55,6 +56,11 @@ void TestConnections::skip_maxscale_start(bool value) maxscale::start = !value; } +void TestConnections::multiple_maxscales(bool value) +{ + maxscale::multiple_maxscales = value; +} + void TestConnections::require_repl_version(const char *version) { maxscale::required_repl_version = version; @@ -648,9 +654,15 @@ void TestConnections::process_template(int m, const char *template_name, const c void TestConnections::init_maxscales() { - for (int i = 0; i < maxscales->N; i++) + // Always initialize the first MaxScale + init_maxscale(0); + + if (maxscale::multiple_maxscales) { - init_maxscale(i); + for (int i = 1; i < maxscales->N; i++) + { + init_maxscale(i); + } } } diff --git a/maxscale-system-test/testconnections.h b/maxscale-system-test/testconnections.h index fc217a934..7d92a8b8d 100644 --- a/maxscale-system-test/testconnections.h +++ b/maxscale-system-test/testconnections.h @@ -240,6 +240,9 @@ public: /** Skip initial start of MaxScale */ static void skip_maxscale_start(bool value); + /** Prepare multiple maxscale instances */ + static void multiple_maxscales(bool value); + /** Test requires a certain backend version */ static void require_repl_version(const char *version); static void require_galera_version(const char *version); From 96a78685bc1e89997318ffd558c54df46ef0da57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Wed, 12 Sep 2018 10:26:57 +0300 Subject: [PATCH 09/12] Fix possible buffer overrun in readwritesplit If the GWBUF length was larger than the stack buffer length, the code would write past the buffer. --- server/modules/routing/readwritesplit/rwsplit_session_cmd.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/server/modules/routing/readwritesplit/rwsplit_session_cmd.cc b/server/modules/routing/readwritesplit/rwsplit_session_cmd.cc index 0e6cbf3c7..f9bb2684e 100644 --- a/server/modules/routing/readwritesplit/rwsplit_session_cmd.cc +++ b/server/modules/routing/readwritesplit/rwsplit_session_cmd.cc @@ -35,7 +35,7 @@ static std::string extract_error(GWBUF* buffer) { size_t replylen = MYSQL_GET_PAYLOAD_LEN(GWBUF_DATA(buffer)); char replybuf[replylen]; - gwbuf_copy_data(buffer, 0, gwbuf_length(buffer), (uint8_t*)replybuf); + gwbuf_copy_data(buffer, 0, sizeof(replybuf), (uint8_t*)replybuf); std::string err; std::string msg; err.append(replybuf + 8, 5); From 6f5d0891319c04593ac88a1d7109d9ec5cdc4908 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Wed, 12 Sep 2018 11:10:17 +0300 Subject: [PATCH 10/12] Use `expect` in mxs1947_composite_roles `assert` was renamed to `expect`. --- maxscale-system-test/mxs1947_composite_roles.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maxscale-system-test/mxs1947_composite_roles.cpp b/maxscale-system-test/mxs1947_composite_roles.cpp index 70c90b6b7..9272e9434 100644 --- a/maxscale-system-test/mxs1947_composite_roles.cpp +++ b/maxscale-system-test/mxs1947_composite_roles.cpp @@ -35,7 +35,7 @@ int main(int argc, char** argv) test.tprintf("Connect with a user that has a composite role as the default role"); MYSQL* conn = open_conn_db(test.maxscales->rwsplit_port[0], test.maxscales->IP[0], "db", "test", "test"); - test.assert(mysql_errno(conn) == 0, "Connection failed: %s", mysql_error(conn)); + test.expect(mysql_errno(conn) == 0, "Connection failed: %s", mysql_error(conn)); mysql_close(conn); auto cleanup = From b3e2bf58d91a1bbe09ac3c7fc57199747a0cbc17 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Wed, 12 Sep 2018 14:02:48 +0300 Subject: [PATCH 11/12] Wait two monitor intervals in mysqlmon_failover_auto The master failover require two monitor intervals to complete. --- maxscale-system-test/mysqlmon_failover_auto.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/maxscale-system-test/mysqlmon_failover_auto.cpp b/maxscale-system-test/mysqlmon_failover_auto.cpp index 6767b6e7e..a911a79d4 100644 --- a/maxscale-system-test/mysqlmon_failover_auto.cpp +++ b/maxscale-system-test/mysqlmon_failover_auto.cpp @@ -21,13 +21,13 @@ int main(int argc, char** argv) test.repl->connect(); delete_slave_binlogs(test); - test.maxscales->wait_for_monitor(); + test.maxscales->wait_for_monitor(2); basic_test(test); print_gtids(test); // Part 1 int node0_id = prepare_test_1(test); - test.maxscales->wait_for_monitor(); + test.maxscales->wait_for_monitor(2); check_test_1(test, node0_id); if (test.global_result != 0) @@ -37,7 +37,7 @@ int main(int argc, char** argv) // Part 2 prepare_test_2(test); - test.maxscales->wait_for_monitor(); + test.maxscales->wait_for_monitor(2); check_test_2(test); if (test.global_result != 0) @@ -47,7 +47,7 @@ int main(int argc, char** argv) // Part 3 prepare_test_3(test); - test.maxscales->wait_for_monitor(); + test.maxscales->wait_for_monitor(2); check_test_3(test); return test.global_result; From e1f2b817340e50eea5492f694c42dadccfa8fc42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20M=C3=A4kel=C3=A4?= Date: Wed, 12 Sep 2018 14:23:57 +0300 Subject: [PATCH 12/12] Wait for monitor in bug547 The test expects the monitor to respond within 5 seconds. This is not guaranteed to happen so waiting for a monitor interval instead of a hard-coded duration provides for a more stable test. --- maxscale-system-test/bug547.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maxscale-system-test/bug547.cpp b/maxscale-system-test/bug547.cpp index 3f301df31..c451ae090 100644 --- a/maxscale-system-test/bug547.cpp +++ b/maxscale-system-test/bug547.cpp @@ -35,7 +35,7 @@ int main(int argc, char *argv[]) } Test->set_timeout(30); - sleep(5); + Test->maxscales->wait_for_monitor(); Test->set_timeout(30); Test->tprintf("Connecting to all MaxScale services, expecting error\n");