MXS-1466: Add support for new variables: @@log_bin, @@max_connections, @@gtid_strict_mode etc
MXS-1466: Add support for new variables: @log_bin, @@max_connections, @@gtid_strict_mode etc
This commit is contained in:
@ -229,6 +229,9 @@ typedef enum
|
|||||||
#define BLR_MASTER_CONNECT_RETRY "60"
|
#define BLR_MASTER_CONNECT_RETRY "60"
|
||||||
#define BLR_MASTER_RETRY_COUNT "1000"
|
#define BLR_MASTER_RETRY_COUNT "1000"
|
||||||
|
|
||||||
|
/* Default value for @@max_connections SQL var */
|
||||||
|
#define BLR_DEFAULT_MAX_CONNS 151
|
||||||
|
|
||||||
/* max size for error message returned to client */
|
/* max size for error message returned to client */
|
||||||
#define BINLOG_ERROR_MSG_LEN 700
|
#define BINLOG_ERROR_MSG_LEN 700
|
||||||
|
|
||||||
|
@ -6393,12 +6393,17 @@ static bool blr_handle_simple_select_stmt(ROUTER_INSTANCE *router,
|
|||||||
BLR_TYPE_INT);
|
BLR_TYPE_INT);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
/* Handle MariaDB 10 GTID vars */
|
||||||
else if ((strcasecmp(word, "@@gtid_current_pos") == 0) ||
|
else if ((strcasecmp(word, "@@gtid_current_pos") == 0) ||
|
||||||
(strcasecmp(word, "@@global.gtid_current_pos") == 0))
|
(strcasecmp(word, "@@global.gtid_current_pos") == 0) ||
|
||||||
|
(strcasecmp(word, "@@gtid_binlog_pos") == 0) ||
|
||||||
|
(strcasecmp(word, "@@global.gtid_binlog_pos") == 0) ||
|
||||||
|
(strcasecmp(word, "@@gtid_slave_pos") == 0) ||
|
||||||
|
(strcasecmp(word, "@@global.gtid_slave_pos") == 0))
|
||||||
{
|
{
|
||||||
char heading[40];
|
char heading[40];
|
||||||
char mariadb_gtid[GTID_MAX_LEN + 1];
|
char mariadb_gtid[GTID_MAX_LEN + 1];
|
||||||
mariadb_gtid[0] = '\0';
|
mariadb_gtid[0] = 0;
|
||||||
strcpy(heading, word);
|
strcpy(heading, word);
|
||||||
|
|
||||||
if (router->mariadb10_compat &&
|
if (router->mariadb10_compat &&
|
||||||
@ -6409,6 +6414,13 @@ static bool blr_handle_simple_select_stmt(ROUTER_INSTANCE *router,
|
|||||||
spinlock_release(&router->binlog_lock);
|
spinlock_release(&router->binlog_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Return empty gtid_slave_pos if master GTID registration is off */
|
||||||
|
if (!router->mariadb10_master_gtid &&
|
||||||
|
strcasestr(word, "gtid_slave_pos" ) != NULL)
|
||||||
|
{
|
||||||
|
mariadb_gtid[0] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
blr_slave_send_var_value(router,
|
blr_slave_send_var_value(router,
|
||||||
slave,
|
slave,
|
||||||
heading,
|
heading,
|
||||||
@ -6437,6 +6449,50 @@ static bool blr_handle_simple_select_stmt(ROUTER_INSTANCE *router,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if ((strcasecmp(word, "@@global.max_connections") == 0) ||
|
||||||
|
(strcasecmp(word, "@@max_connections") == 0))
|
||||||
|
{
|
||||||
|
char max_conns[40];
|
||||||
|
/* to ensure we match the case in query and response */
|
||||||
|
char heading[40];
|
||||||
|
|
||||||
|
sprintf(max_conns, "%d", !router->service->max_connections ?
|
||||||
|
BLR_DEFAULT_MAX_CONNS :
|
||||||
|
router->service->max_connections);
|
||||||
|
strcpy(heading, word);
|
||||||
|
|
||||||
|
blr_slave_send_var_value(router,
|
||||||
|
slave,
|
||||||
|
heading,
|
||||||
|
max_conns,
|
||||||
|
BLR_TYPE_INT);
|
||||||
|
}
|
||||||
|
else if ((strcasecmp(word, "@@global.read_only") == 0) ||
|
||||||
|
(strcasecmp(word, "@@read_only") == 0))
|
||||||
|
{
|
||||||
|
/* to ensure we match the case in query and response */
|
||||||
|
char heading[40];
|
||||||
|
strcpy(heading, word);
|
||||||
|
|
||||||
|
blr_slave_send_var_value(router,
|
||||||
|
slave,
|
||||||
|
heading,
|
||||||
|
"0",
|
||||||
|
BLR_TYPE_INT);
|
||||||
|
}
|
||||||
|
else if ((strcasecmp(word, "@@global.log_bin") == 0) ||
|
||||||
|
(strcasecmp(word, "@@log_bin") == 0))
|
||||||
|
{
|
||||||
|
/* to ensure we match the case in query and response */
|
||||||
|
char heading[40];
|
||||||
|
strcpy(heading, word);
|
||||||
|
|
||||||
|
blr_slave_send_var_value(router,
|
||||||
|
slave,
|
||||||
|
heading,
|
||||||
|
"1",
|
||||||
|
BLR_TYPE_INT);
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -7463,7 +7519,7 @@ static bool blr_handle_set_stmt(ROUTER_INSTANCE *router,
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (strstr(word, "@slave_connect_state") != NULL)
|
else if (strcasestr(word, "@slave_connect_state") != NULL)
|
||||||
{
|
{
|
||||||
/* If not mariadb an error message will be returned */
|
/* If not mariadb an error message will be returned */
|
||||||
if (slave->mariadb10_compat &&
|
if (slave->mariadb10_compat &&
|
||||||
|
Reference in New Issue
Block a user