MXS-1075: MariaDB 10 GTID stored and shown only for transaction safety on

MariaDB 10 GTID is detected and stored only if transaction_safety
option is on.

SELECT @@gtid_current_pos and “maxadmin show service $service_name” can
return it
This commit is contained in:
MassimilianoPinto
2017-02-28 15:19:57 +01:00
parent 054ddcb3dd
commit 304b5ced29
2 changed files with 67 additions and 53 deletions

View File

@ -646,15 +646,19 @@ blr_slave_query(ROUTER_INSTANCE *router, ROUTER_SLAVE *slave, GWBUF *queue)
}
else if ((strcasecmp(word, "@@gtid_current_pos") == 0) || (strcasecmp(word, "@@global.gtid_current_pos") == 0))
{
char heading[40]; /* to ensure we match the case in query and response */
char heading[40];
char mariadb_gtid[GTID_MAX_LEN + 1];
mariadb_gtid[0] = '\0';
strcpy(heading, word);
MXS_FREE(query_text);
/* Safely get router->mariadb_gtid */
spinlock_acquire(&router->binlog_lock);
strcpy(mariadb_gtid, router->mariadb_gtid);
spinlock_release(&router->binlog_lock);
if (router->mariadb10_compat)
{
spinlock_acquire(&router->binlog_lock);
strcpy(mariadb_gtid, router->mariadb_gtid);
spinlock_release(&router->binlog_lock);
}
return blr_slave_send_var_value(router, slave, heading, mariadb_gtid, BLR_TYPE_STRING);
}