MariaDB 10 optional compatibility
MariaDB 10 optional compatibility with mariadb10-compatibility=1
This commit is contained in:
@ -233,7 +233,7 @@ typedef struct {
|
|||||||
GWBUF *selectvercom; /*< select @@version_comment */
|
GWBUF *selectvercom; /*< select @@version_comment */
|
||||||
GWBUF *selecthostname;/*< select @@hostname */
|
GWBUF *selecthostname;/*< select @@hostname */
|
||||||
GWBUF *map; /*< select @@max_allowed_packet */
|
GWBUF *map; /*< select @@max_allowed_packet */
|
||||||
GWBUF *mariadb10; /*< set @mariadb_slave_capability=4 */
|
GWBUF *mariadb10; /*< set @mariadb_slave_capability */
|
||||||
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;
|
||||||
@ -289,8 +289,7 @@ typedef struct router_instance {
|
|||||||
int retry_backoff;
|
int retry_backoff;
|
||||||
time_t connect_time;
|
time_t connect_time;
|
||||||
int handling_threads;
|
int handling_threads;
|
||||||
struct router_instance
|
struct router_instance *next;
|
||||||
*next;
|
|
||||||
} ROUTER_INSTANCE;
|
} ROUTER_INSTANCE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -317,6 +316,7 @@ typedef struct router_instance {
|
|||||||
#define BLRM_REGISTER 0x0012
|
#define BLRM_REGISTER 0x0012
|
||||||
#define BLRM_BINLOGDUMP 0x0013
|
#define BLRM_BINLOGDUMP 0x0013
|
||||||
#define BLRM_MARIADB10 0x0014
|
#define BLRM_MARIADB10 0x0014
|
||||||
|
|
||||||
#define BLRM_MAXSTATE 0x0014
|
#define BLRM_MAXSTATE 0x0014
|
||||||
|
|
||||||
static char *blrm_states[] = { "Unconnected", "Connecting", "Authenticated", "Timestamp retrieval",
|
static char *blrm_states[] = { "Unconnected", "Connecting", "Authenticated", "Timestamp retrieval",
|
||||||
|
|||||||
@ -448,12 +448,27 @@ char query[128];
|
|||||||
GWBUF_CONSUME_ALL(router->saved_master.chksum2);
|
GWBUF_CONSUME_ALL(router->saved_master.chksum2);
|
||||||
router->saved_master.chksum2 = buf;
|
router->saved_master.chksum2 = buf;
|
||||||
blr_cache_response(router, "chksum2", buf);
|
blr_cache_response(router, "chksum2", buf);
|
||||||
//buf = blr_make_query("SELECT @@GLOBAL.GTID_MODE");
|
|
||||||
|
if (router->mariadb10_compat) {
|
||||||
buf = blr_make_query("SET @mariadb_slave_capability=4");
|
buf = blr_make_query("SET @mariadb_slave_capability=4");
|
||||||
|
router->master_state = BLRM_MARIADB10;
|
||||||
|
} else {
|
||||||
|
buf = blr_make_query("SELECT @@GLOBAL.GTID_MODE");
|
||||||
router->master_state = BLRM_GTIDMODE;
|
router->master_state = BLRM_GTIDMODE;
|
||||||
|
}
|
||||||
router->master->func.write(router->master, buf);
|
router->master->func.write(router->master, buf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case BLRM_MARIADB10:
|
||||||
|
// Response to the SET @mariadb_slave_capability=4, should be stored
|
||||||
|
if (router->saved_master.mariadb10)
|
||||||
|
GWBUF_CONSUME_ALL(router->saved_master.mariadb10);
|
||||||
|
router->saved_master.mariadb10 = buf;
|
||||||
|
blr_cache_response(router, "mariadb10", buf);
|
||||||
|
buf = blr_make_registration(router);
|
||||||
|
router->master_state = BLRM_REGISTER;
|
||||||
|
router->master->func.write(router->master, buf);
|
||||||
|
break;
|
||||||
case BLRM_GTIDMODE:
|
case BLRM_GTIDMODE:
|
||||||
// Response to the GTID_MODE, should be stored
|
// Response to the GTID_MODE, should be stored
|
||||||
if (router->saved_master.gtid_mode)
|
if (router->saved_master.gtid_mode)
|
||||||
|
|||||||
@ -369,8 +369,8 @@ int query_len;
|
|||||||
else if (strcasecmp(word, "@mariadb_slave_capability") == 0)
|
else if (strcasecmp(word, "@mariadb_slave_capability") == 0)
|
||||||
{
|
{
|
||||||
free(query_text);
|
free(query_text);
|
||||||
return blr_slave_replay(router, slave, router->saved_master.gtid_mode);
|
if (router->mariadb10_compat)
|
||||||
//return blr_slave_send_ok(router, slave);
|
return blr_slave_replay(router, slave, router->saved_master.mariadb10);
|
||||||
}
|
}
|
||||||
else if (strcasecmp(word, "@master_binlog_checksum") == 0)
|
else if (strcasecmp(word, "@master_binlog_checksum") == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user