Add support for select @@max_allowed_packet
This commit is contained in:
@ -230,6 +230,7 @@ typedef struct {
|
|||||||
GWBUF *selectver; /*< select version() */
|
GWBUF *selectver; /*< select version() */
|
||||||
GWBUF *selectvercom; /*< select @@version_comment */
|
GWBUF *selectvercom; /*< select @@version_comment */
|
||||||
GWBUF *selecthostname;/*< select @@hostname */
|
GWBUF *selecthostname;/*< select @@hostname */
|
||||||
|
GWBUF *map; /*< select @@max_allowed_packet */
|
||||||
uint8_t *fde_event; /*< Format Description Event */
|
uint8_t *fde_event; /*< Format Description Event */
|
||||||
int fde_len; /*< Length of fde_event */
|
int fde_len; /*< Length of fde_event */
|
||||||
} MASTER_RESPONSES;
|
} MASTER_RESPONSES;
|
||||||
@ -305,17 +306,18 @@ typedef struct router_instance {
|
|||||||
#define BLRM_SELECTVER 0x000E
|
#define BLRM_SELECTVER 0x000E
|
||||||
#define BLRM_SELECTVERCOM 0x000F
|
#define BLRM_SELECTVERCOM 0x000F
|
||||||
#define BLRM_SELECTHOSTNAME 0x0010
|
#define BLRM_SELECTHOSTNAME 0x0010
|
||||||
#define BLRM_REGISTER 0x0011
|
#define BLRM_MAP 0x0011
|
||||||
#define BLRM_BINLOGDUMP 0x0012
|
#define BLRM_REGISTER 0x0012
|
||||||
|
#define BLRM_BINLOGDUMP 0x0013
|
||||||
|
|
||||||
#define BLRM_MAXSTATE 0x0012
|
#define BLRM_MAXSTATE 0x0013
|
||||||
|
|
||||||
static char *blrm_states[] = { "Unconnected", "Connecting", "Authenticated", "Timestamp retrieval",
|
static char *blrm_states[] = { "Unconnected", "Connecting", "Authenticated", "Timestamp retrieval",
|
||||||
"Server ID retrieval", "HeartBeat Period setup", "binlog checksum config",
|
"Server ID retrieval", "HeartBeat Period setup", "binlog checksum config",
|
||||||
"binlog checksum rerieval", "GTID Mode retrieval", "Master UUID retrieval",
|
"binlog checksum rerieval", "GTID Mode retrieval", "Master UUID retrieval",
|
||||||
"Set Slave UUID", "Set Names latin1", "Set Names utf8", "select 1",
|
"Set Slave UUID", "Set Names latin1", "Set Names utf8", "select 1",
|
||||||
"select version()", "select @@version_comment", "select @@hostname",
|
"select version()", "select @@version_comment", "select @@hostname",
|
||||||
"Register slave", "Binlog Dump" };
|
"select @@mx_allowed_packet", "Register slave", "Binlog Dump" };
|
||||||
|
|
||||||
#define BLRS_CREATED 0x0000
|
#define BLRS_CREATED 0x0000
|
||||||
#define BLRS_UNREGISTERED 0x0001
|
#define BLRS_UNREGISTERED 0x0001
|
||||||
|
@ -452,6 +452,13 @@ char query[128];
|
|||||||
case BLRM_SELECTHOSTNAME:
|
case BLRM_SELECTHOSTNAME:
|
||||||
// Response to SELECT @@hostname should be stored
|
// Response to SELECT @@hostname should be stored
|
||||||
router->saved_master.selecthostname = buf;
|
router->saved_master.selecthostname = buf;
|
||||||
|
buf = blr_make_query("SELECT @@max_allowed_packet;");
|
||||||
|
router->master_state = BLRM_MAP;
|
||||||
|
router->master->func.write(router->master, buf);
|
||||||
|
break;
|
||||||
|
case BLRM_MAP:
|
||||||
|
// Response to SELECT @@max_allowed_packet should be stored
|
||||||
|
router->saved_master.map = buf;
|
||||||
buf = blr_make_registration(router);
|
buf = blr_make_registration(router);
|
||||||
router->master_state = BLRM_REGISTER;
|
router->master_state = BLRM_REGISTER;
|
||||||
router->master->func.write(router->master, buf);
|
router->master->func.write(router->master, buf);
|
||||||
|
@ -141,7 +141,7 @@ blr_slave_request(ROUTER_INSTANCE *router, ROUTER_SLAVE *slave, GWBUF *queue)
|
|||||||
* when MaxScale registered as a slave. The exception to the rule is the
|
* when MaxScale registered as a slave. The exception to the rule is the
|
||||||
* request to obtain the current timestamp value of the server.
|
* request to obtain the current timestamp value of the server.
|
||||||
*
|
*
|
||||||
* Seven select statements are currently supported:
|
* Eight select statements are currently supported:
|
||||||
* SELECT UNIX_TIMESTAMP();
|
* SELECT UNIX_TIMESTAMP();
|
||||||
* SELECT @master_binlog_checksum
|
* SELECT @master_binlog_checksum
|
||||||
* SELECT @@GLOBAL.GTID_MODE
|
* SELECT @@GLOBAL.GTID_MODE
|
||||||
@ -149,6 +149,7 @@ blr_slave_request(ROUTER_INSTANCE *router, ROUTER_SLAVE *slave, GWBUF *queue)
|
|||||||
* SELECT 1
|
* SELECT 1
|
||||||
* SELECT @@version_comment limit 1
|
* SELECT @@version_comment limit 1
|
||||||
* SELECT @@hostname
|
* SELECT @@hostname
|
||||||
|
* SELECT @@max_allowed_packet
|
||||||
*
|
*
|
||||||
* Two show commands are supported:
|
* Two show commands are supported:
|
||||||
* SHOW VARIABLES LIKE 'SERVER_ID'
|
* SHOW VARIABLES LIKE 'SERVER_ID'
|
||||||
@ -228,6 +229,11 @@ int query_len;
|
|||||||
free(query_text);
|
free(query_text);
|
||||||
return blr_slave_replay(router, slave, router->saved_master.selecthostname);
|
return blr_slave_replay(router, slave, router->saved_master.selecthostname);
|
||||||
}
|
}
|
||||||
|
else if (strcasecmp(word, "@@max_allowed_packet") == 0)
|
||||||
|
{
|
||||||
|
free(query_text);
|
||||||
|
return blr_slave_replay(router, slave, router->saved_master.map);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (strcasecmp(word, "SHOW") == 0)
|
else if (strcasecmp(word, "SHOW") == 0)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user