MXS-1344: Binlog server reports real master id and its server id in monitor queries

MXS-1344: Binlog server reports the real master id in SHOW SLAVE STATUS
| SHOW ALL SLAVES STATUS, no matter the value of ‘master_id’ identity
parameter.

Binlog server report its own server id or the identity value of
‘master_id’ in MySQL monitor query SELECT @@global.server_id,
@@read_only;

Note: SELECT @@global.server_id (no other fields) still reports the
real master server id or the value set in ‘master_id’
This commit is contained in:
MassimilianoPinto 2017-08-22 12:26:36 +02:00
parent cbe58b5355
commit 965173dd88

View File

@ -1572,7 +1572,7 @@ blr_slave_send_slave_status(ROUTER_INSTANCE *router,
*ptr++ = 0;
/* Master_Server_Id */
sprintf(column, "%d", router->masterid);
sprintf(column, "%d", router->orig_masterid);
col_len = strlen(column);
*ptr++ = col_len; // Length of result string
memcpy((char *)ptr, column, col_len); // Result string
@ -6496,14 +6496,6 @@ static bool blr_handle_simple_select_stmt(ROUTER_INSTANCE *router,
sprintf(server_id, "%d", router->masterid);
strcpy(heading, word);
if (strcasecmp(brkb, "@@read_only") == 0 ||
strcasecmp(brkb, "@@global.read_only") == 0)
{
blr_slave_send_id_ro(router, slave);
return true;
}
blr_slave_send_var_value(router,
slave,
heading,
@ -8510,7 +8502,13 @@ static int blr_slave_send_id_ro(ROUTER_INSTANCE *router,
/* Create the MySQL Result Set row */
char server_id[40] = "";
sprintf(server_id, "%d", router->serverid);
/* Set identy for MySQL replication monitor */
sprintf(server_id,
"%d",
router->set_master_server_id ?
router->masterid :
router->serverid);
if ((pkt = blr_create_result_row(server_id, // File name
"0", // o = OFF
seqno++)) != NULL)