When a slave has more than one configured replication source, mariadbmon will use the last one that is returned by SHOW ALL SLAVES STATUS. This causes various problems which would all be solved by only inspecting the default replication source (i.e. @@default_master_connection).
{"report":{"fcp":1257.1000000238419,"ttfb":271.10000002384186,"pageVisibility":"visible","entityId":68583,"key":"jira.project.issue.view-issue","isInitial":true,"threshold":1000,"elementTimings":{},"userDeviceMemory":8,"userDeviceProcessors":64,"apdex":0.5,"journeyId":"53986241-7673-4b08-ade7-5fbc2f8bcfcb","navigationType":0,"readyForUser":1317.8000000715256,"redirectCount":0,"resourceLoadedEnd":840.5,"resourceLoadedStart":279.60000002384186,"resourceTiming":[{"duration":49.89999997615814,"initiatorType":"link","name":"https://jira.mariadb.org/s/2c21342762a6a02add1c328bed317ffd-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/css/_super/batch.css","startTime":279.60000002384186,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":279.60000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":329.5,"responseStart":0,"secureConnectionStart":0},{"duration":49.800000071525574,"initiatorType":"link","name":"https://jira.mariadb.org/s/7ebd35e77e471bc30ff0eba799ebc151-CDN/lu2cib/820016/12ta74/2bf333562ca6724060a9d5f1535471f6/_/download/contextbatch/css/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.css?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&slack-enabled=true","startTime":280,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":280,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":329.8000000715256,"responseStart":0,"secureConnectionStart":0},{"duration":466.39999997615814,"initiatorType":"script","name":"https://jira.mariadb.org/s/0917945aaa57108d00c5076fea35e069-CDN/lu2cib/820016/12ta74/0a8bac35585be7fc6c9cc5a0464cd4cf/_/download/contextbatch/js/_super/batch.js?locale=en","startTime":280.10000002384186,"connectEnd":280.10000002384186,"connectStart":280.10000002384186,"domainLookupEnd":280.10000002384186,"domainLookupStart":280.10000002384186,"fetchStart":280.10000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":552.1000000238419,"responseEnd":746.5,"responseStart":579.8999999761581,"secureConnectionStart":280.10000002384186},{"duration":560.1000000238419,"initiatorType":"script","name":"https://jira.mariadb.org/s/2d8175ec2fa4c816e8023260bd8c1786-CDN/lu2cib/820016/12ta74/2bf333562ca6724060a9d5f1535471f6/_/download/contextbatch/js/jira.browse.project,project.issue.navigator,jira.view.issue,jira.general,jira.global,atl.general,-_super/batch.js?agile_global_admin_condition=true&jag=true&jira.create.linked.issue=true&locale=en&slack-enabled=true","startTime":280.39999997615814,"connectEnd":280.39999997615814,"connectStart":280.39999997615814,"domainLookupEnd":280.39999997615814,"domainLookupStart":280.39999997615814,"fetchStart":280.39999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":553.8999999761581,"responseEnd":840.5,"responseStart":576.8999999761581,"secureConnectionStart":280.39999997615814},{"duration":333.7999999523163,"initiatorType":"script","name":"https://jira.mariadb.org/s/a9324d6758d385eb45c462685ad88f1d-CDN/lu2cib/820016/12ta74/c92c0caa9a024ae85b0ebdbed7fb4bd7/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en","startTime":280.60000002384186,"connectEnd":280.60000002384186,"connectStart":280.60000002384186,"domainLookupEnd":280.60000002384186,"domainLookupStart":280.60000002384186,"fetchStart":280.60000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":554.5,"responseEnd":614.3999999761581,"responseStart":613.2000000476837,"secureConnectionStart":280.60000002384186},{"duration":298.5,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-en/jira.webresources:calendar-en.js","startTime":280.7000000476837,"connectEnd":280.7000000476837,"connectStart":280.7000000476837,"domainLookupEnd":280.7000000476837,"domainLookupStart":280.7000000476837,"fetchStart":280.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":553.5,"responseEnd":579.2000000476837,"responseStart":578.7000000476837,"secureConnectionStart":280.7000000476837},{"duration":298.90000009536743,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:calendar-localisation-moment/jira.webresources:calendar-localisation-moment.js","startTime":280.89999997615814,"connectEnd":280.89999997615814,"connectStart":280.89999997615814,"domainLookupEnd":280.89999997615814,"domainLookupStart":280.89999997615814,"fetchStart":280.89999997615814,"redirectEnd":0,"redirectStart":0,"requestStart":552.1000000238419,"responseEnd":579.8000000715256,"responseStart":579.3000000715256,"secureConnectionStart":280.89999997615814},{"duration":48.89999997615814,"initiatorType":"link","name":"https://jira.mariadb.org/s/b04b06a02d1959df322d9cded3aeecc1-CDN/lu2cib/820016/12ta74/a2ff6aa845ffc9a1d22fe23d9ee791fc/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css","startTime":281,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":281,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":329.89999997615814,"responseStart":0,"secureConnectionStart":0},{"duration":326.2999999523163,"initiatorType":"script","name":"https://jira.mariadb.org/rest/api/1.0/shortcuts/820016/47140b6e0a9bc2e4913da06536125810/shortcuts.js?context=issuenavigation&context=issueaction","startTime":281.2000000476837,"connectEnd":281.2000000476837,"connectStart":281.2000000476837,"domainLookupEnd":281.2000000476837,"domainLookupStart":281.2000000476837,"fetchStart":281.2000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":557.8999999761581,"responseEnd":607.5,"responseStart":605.8000000715256,"secureConnectionStart":281.2000000476837},{"duration":48.39999997615814,"initiatorType":"link","name":"https://jira.mariadb.org/s/3ac36323ba5e4eb0af2aa7ac7211b4bb-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/css/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.css?jira.create.linked.issue=true","startTime":281.60000002384186,"connectEnd":0,"connectStart":0,"domainLookupEnd":0,"domainLookupStart":0,"fetchStart":281.60000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":0,"responseEnd":330,"responseStart":0,"secureConnectionStart":0},{"duration":331.1999999284744,"initiatorType":"script","name":"https://jira.mariadb.org/s/5d5e8fe91fbc506585e83ea3b62ccc4b-CDN/lu2cib/820016/12ta74/d176f0986478cc64f24226b3d20c140d/_/download/contextbatch/js/com.atlassian.jira.projects.sidebar.init,-_super,-project.issue.navigator,-jira.view.issue/batch.js?jira.create.linked.issue=true&locale=en","startTime":281.8000000715256,"connectEnd":281.8000000715256,"connectStart":281.8000000715256,"domainLookupEnd":281.8000000715256,"domainLookupStart":281.8000000715256,"fetchStart":281.8000000715256,"redirectEnd":0,"redirectStart":0,"requestStart":557.8000000715256,"responseEnd":613,"responseStart":607.8000000715256,"secureConnectionStart":281.8000000715256},{"duration":316.39999997615814,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-js/jira.webresources:bigpipe-js.js","startTime":288.7000000476837,"connectEnd":288.7000000476837,"connectStart":288.7000000476837,"domainLookupEnd":288.7000000476837,"domainLookupStart":288.7000000476837,"fetchStart":288.7000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":565,"responseEnd":605.1000000238419,"responseStart":578.1000000238419,"secureConnectionStart":288.7000000476837},{"duration":280.89999997615814,"initiatorType":"script","name":"https://jira.mariadb.org/s/d41d8cd98f00b204e9800998ecf8427e-CDN/lu2cib/820016/12ta74/1.0/_/download/batch/jira.webresources:bigpipe-init/jira.webresources:bigpipe-init.js","startTime":297.10000002384186,"connectEnd":564.3000000715256,"connectStart":564.3000000715256,"domainLookupEnd":564.3000000715256,"domainLookupStart":564.3000000715256,"fetchStart":297.10000002384186,"redirectEnd":0,"redirectStart":0,"requestStart":564.7000000476837,"responseEnd":578,"responseStart":576.2000000476837,"secureConnectionStart":564.3000000715256},{"duration":178.39999997615814,"initiatorType":"xmlhttprequest","name":"https://jira.mariadb.org/rest/webResources/1.0/resources","startTime":977.2000000476837,"connectEnd":977.2000000476837,"connectStart":977.2000000476837,"domainLookupEnd":977.2000000476837,"domainLookupStart":977.2000000476837,"fetchStart":977.2000000476837,"redirectEnd":0,"redirectStart":0,"requestStart":1117.8999999761581,"responseEnd":1155.6000000238419,"responseStart":1154.8999999761581,"secureConnectionStart":977.2000000476837}],"fetchStart":0,"domainLookupStart":66,"domainLookupEnd":73,"connectStart":73,"connectEnd":109,"secureConnectionStart":81,"requestStart":110,"responseStart":271,"responseEnd":297,"domLoading":275,"domInteractive":1385,"domContentLoadedEventStart":1385,"domContentLoadedEventEnd":1442,"domComplete":1743,"loadEventStart":1743,"loadEventEnd":1744,"userAgent":"Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)","marks":[{"name":"bigPipe.sidebar-id.start","time":1350.3999999761581},{"name":"bigPipe.sidebar-id.end","time":1351.1000000238419},{"name":"bigPipe.activity-panel-pipe-id.start","time":1351.3000000715256},{"name":"bigPipe.activity-panel-pipe-id.end","time":1354.3999999761581},{"name":"activityTabFullyLoaded","time":1455.8999999761581}],"measures":[],"correlationId":"efa6ed34780bd","effectiveType":"4g","downlink":9,"rtt":0,"serverDuration":99,"dbReadsTimeInMs":10,"dbConnsTimeInMs":18,"applicationHash":"9d11dbea5f4be3d4cc21f03a88dd11d8c8687422","experiments":[]}}
The following patch would ignore all non-default replication configurations.
diff --git a/server/modules/monitor/mariadbmon/mariadbmon.cc b/server/modules/monitor/mariadbmon/mariadbmon.cc
index 8d9fe779e..dc2972db4 100644
--- a/server/modules/monitor/mariadbmon/mariadbmon.cc
+++ b/server/modules/monitor/mariadbmon/mariadbmon.cc
@@ -1407,6 +1407,29 @@ static enum mysql_server_version get_server_version(MXS_MONITORED_SERVER* db)
return MYSQL_SERVER_VERSION_51;
}
+std::string get_result(MYSQL* conn, const char* query)
+{
+ std::string rval;
+
+ if (mxs_mysql_query(conn, query) == 0)
+ {
+ if (MYSQL_RES* result = mysql_store_result(conn))
+ {
+ if (MYSQL_ROW row = mysql_fetch_row(result))
+ {
+ if (row[0])
+ {
+ rval = row[0];
+ }
+ }
+
+ mysql_free_result(result);
+ }
+ }
+
+ return rval;
+}
+
static bool do_show_slave_status(MYSQL_MONITOR* mon,
MySqlServerInfo* serv_info,
MXS_MONITORED_SERVER* database)
@@ -1443,6 +1466,8 @@ static bool do_show_slave_status(MYSQL_MONITOR* mon,
int nconfigured = 0;
int nrunning = 0;
+ std::string source_name = get_result(database->con, "SELECT @@default_master_connection");
+
if (mxs_mysql_query(database->con, query) == 0
&& (result = mysql_store_result(database->con)) != NULL)
{
@@ -1454,14 +1479,20 @@ static bool do_show_slave_status(MYSQL_MONITOR* mon,
return false;
}
- MYSQL_ROW row = mysql_fetch_row(result);
-
- if (row)
+ if (mysql_num_rows(result) > 0)
{
serv_info->slave_configured = true;
- do
+ while (MYSQL_ROW row = mysql_fetch_row(result))
{
+ ss_dassert(row[0]);
+
+ if (source_name != row[0])
+ {
+ // Not the default replication configuration, skip it
+ continue;
+ }
+
/* get Slave_IO_Running and Slave_SQL_Running values*/
serv_info->slave_status.slave_io_running = strncmp(row[i_slave_io_running], "Yes", 3) == 0;
serv_info->slave_status.slave_sql_running = strncmp(row[i_slave_sql_running], "Yes", 3) == 0;
@@ -1542,9 +1573,7 @@ static bool do_show_slave_status(MYSQL_MONITOR* mon,
}
nconfigured++;
- row = mysql_fetch_row(result);
}
- while (row);
}
else
As a side-effect, stopping non-default slaves would have no effect on the slave's status in MaxScale. Currently the slave would be considered broken as not all replication sources would be running. This behavior can be considered as a bug as one could expect only the default master connection to be used.