diff --git a/maxscale-system-test/bug673.cpp b/maxscale-system-test/bug673.cpp index 235fd9769..b3d792ef9 100644 --- a/maxscale-system-test/bug673.cpp +++ b/maxscale-system-test/bug673.cpp @@ -18,9 +18,9 @@ int main(int argc, char *argv[]) for (int i = 0; i < 2; i++) { char result[1024]; - test.add_result(test.maxscales->get_maxadmin_param(0, "show dbusers \"RW Split Router\"", "User names:", result), + test.add_result(test.maxscales->ssh_node_f(0, true, "maxadmin show dbusers \"RW Split Router\"|grep 'User names'"), "Old style objects in maxadmin commands should succeed"); - test.add_result(test.maxscales->get_maxadmin_param(0, "show dbusers RW-Split-Router", "User names:", result), + test.add_result(test.maxscales->ssh_node_f(0, true, "maxadmin show dbusers RW-Split-Router|grep 'User names'"), "New style objects in maxadmin commands should succeed"); } diff --git a/maxscale-system-test/rwsplit_readonly.cpp b/maxscale-system-test/rwsplit_readonly.cpp index d405fc435..3c7b72617 100644 --- a/maxscale-system-test/rwsplit_readonly.cpp +++ b/maxscale-system-test/rwsplit_readonly.cpp @@ -259,10 +259,14 @@ int main(int argc, char *argv[]) /** Prepare for tests */ Test->stop_timeout(); Test->maxscales->connect_maxscale(0); - execute_query_silent(Test->maxscales->conn_rwsplit[0], "DROP TABLE IF EXISTS test.readonly\n"); - execute_query_silent(Test->maxscales->conn_rwsplit[0], "CREATE TABLE test.readonly(id int)\n"); + execute_query_silent(Test->maxscales->conn_rwsplit[0], "DROP TABLE IF EXISTS test.readonly"); + execute_query_silent(Test->maxscales->conn_rwsplit[0], "CREATE TABLE test.readonly(id int)"); Test->maxscales->close_maxscale_connections(0); + Test->repl->connect(); + Test->repl->sync_slaves(); + Test->repl->disconnect(); + /** Basic tests */ test_basic(Test); diff --git a/server/core/adminusers.cc b/server/core/adminusers.cc index 4f96d6408..dd8d807b2 100644 --- a/server/core/adminusers.cc +++ b/server/core/adminusers.cc @@ -523,10 +523,7 @@ void dcb_PrintAdminUsers(DCB *dcb) { users_diagnostic(dcb, linux_users); } - else - { - dcb_printf(dcb, "\n"); - } + dcb_printf(dcb, "\n"); dcb_printf(dcb, "Created network accounts (insecure): "); @@ -534,8 +531,5 @@ void dcb_PrintAdminUsers(DCB *dcb) { users_diagnostic(dcb, inet_users); } - else - { - dcb_printf(dcb, "\n"); - } + dcb_printf(dcb, "\n"); } diff --git a/server/modules/monitor/mariadbmon/mariadbmon.cc b/server/modules/monitor/mariadbmon/mariadbmon.cc index 782d17d99..ff571f8fe 100644 --- a/server/modules/monitor/mariadbmon/mariadbmon.cc +++ b/server/modules/monitor/mariadbmon/mariadbmon.cc @@ -1939,49 +1939,50 @@ void check_maxscale_schema_replication(MXS_MONITOR *monitor) bool MariaDBMonitor::mon_process_failover(bool* cluster_modified_out) { ss_dassert(*cluster_modified_out == false); + if (config_get_global_options()->passive || + (master && SERVER_IS_MASTER(master->server))) + { + return true; + } bool rval = true; - MXS_CONFIG* cnf = config_get_global_options(); MXS_MONITORED_SERVER* failed_master = NULL; - if (!cnf->passive) + for (MXS_MONITORED_SERVER *ptr = m_monitor_base->monitored_servers; ptr; ptr = ptr->next) { - for (MXS_MONITORED_SERVER *ptr = m_monitor_base->monitored_servers; ptr; ptr = ptr->next) + if (ptr->new_event && ptr->server->last_event == MASTER_DOWN_EVENT) { - if (ptr->new_event && ptr->server->last_event == MASTER_DOWN_EVENT) + if (failed_master) { - if (failed_master) - { - MXS_ALERT("Multiple failed master servers detected: " - "'%s' is the first master to fail but server " - "'%s' has also triggered a master_down event.", - failed_master->server->unique_name, - ptr->server->unique_name); - return false; - } + MXS_ALERT("Multiple failed master servers detected: " + "'%s' is the first master to fail but server " + "'%s' has also triggered a master_down event.", + failed_master->server->unique_name, + ptr->server->unique_name); + return false; + } - if (ptr->server->active_event) + if (ptr->server->active_event) + { + // MaxScale was active when the event took place + failed_master = ptr; + } + else if (m_monitor_base->master_has_failed) + { + /** + * If a master_down event was triggered when this MaxScale was + * passive, we need to execute the failover script again if no new + * masters have appeared. + */ + int64_t timeout = SEC_TO_HB(m_failover_timeout); + int64_t t = hkheartbeat - ptr->server->triggered_at; + + if (t > timeout) { - // MaxScale was active when the event took place + MXS_WARNING("Failover of server '%s' did not take place within " + "%u seconds, failover needs to be re-triggered", + ptr->server->unique_name, m_failover_timeout); failed_master = ptr; } - else if (m_monitor_base->master_has_failed) - { - /** - * If a master_down event was triggered when this MaxScale was - * passive, we need to execute the failover script again if no new - * masters have appeared. - */ - int64_t timeout = SEC_TO_HB(m_failover_timeout); - int64_t t = hkheartbeat - ptr->server->triggered_at; - - if (t > timeout) - { - MXS_WARNING("Failover of server '%s' did not take place within " - "%u seconds, failover needs to be re-triggered", - ptr->server->unique_name, m_failover_timeout); - failed_master = ptr; - } - } } } }