Added variables for MariaDB 10 compatibility.

This commit is contained in:
Markus Makela
2015-05-07 12:56:58 +03:00
parent 5c7b2a68e5
commit bc7cc2a466
3 changed files with 11 additions and 3 deletions

View File

@ -233,6 +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 */
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;
@ -252,6 +253,7 @@ typedef struct router_instance {
char *password; /*< Password to use with master */ char *password; /*< Password to use with master */
char *fileroot; /*< Root of binlog filename */ char *fileroot; /*< Root of binlog filename */
bool master_chksum;/*< Does the master provide checksums */ bool master_chksum;/*< Does the master provide checksums */
bool mariadb10_compat; /*< MariaDB 10.0 compatibility */
char *master_uuid; /*< UUID of the master */ char *master_uuid; /*< UUID of the master */
DCB *master; /*< DCB for master connection */ DCB *master; /*< DCB for master connection */
DCB *client; /*< DCB for dummy client */ DCB *client; /*< DCB for dummy client */
@ -314,15 +316,16 @@ typedef struct router_instance {
#define BLRM_MAP 0x0011 #define BLRM_MAP 0x0011
#define BLRM_REGISTER 0x0012 #define BLRM_REGISTER 0x0012
#define BLRM_BINLOGDUMP 0x0013 #define BLRM_BINLOGDUMP 0x0013
#define BLRM_MARIADB10 0x0014
#define BLRM_MAXSTATE 0x0013 #define BLRM_MAXSTATE 0x0013
#define BLRM_MAXSTATE_MARIADB10 0x0014
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",
"select @@mx_allowed_packet", "Register slave", "Binlog Dump" }; "select @@mx_allowed_packet", "Register slave", "Binlog Dump","Set MariaDB slave capability" };
#define BLRS_CREATED 0x0000 #define BLRS_CREATED 0x0000
#define BLRS_UNREGISTERED 0x0001 #define BLRS_UNREGISTERED 0x0001

View File

@ -195,6 +195,7 @@ unsigned char *defuuid;
inst->retry_backoff = 1; inst->retry_backoff = 1;
inst->binlogdir = NULL; inst->binlogdir = NULL;
inst->heartbeat = 300; // Default is every 5 minutes inst->heartbeat = 300; // Default is every 5 minutes
inst->mariadb10_compat = false;
inst->user = strdup(service->credentials.name); inst->user = strdup(service->credentials.name);
inst->password = strdup(service->credentials.authdata); inst->password = strdup(service->credentials.authdata);
@ -282,6 +283,10 @@ unsigned char *defuuid;
{ {
inst->masterid = atoi(value); inst->masterid = atoi(value);
} }
else if (strcmp(options[i], "mariadb10-compatibility") == 0)
{
inst->mariadb10_compat = config_truth_value(value);
}
else if (strcmp(options[i], "filestem") == 0) else if (strcmp(options[i], "filestem") == 0)
{ {
inst->fileroot = strdup(value); inst->fileroot = strdup(value);

View File

@ -449,7 +449,7 @@ char query[128];
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"); //buf = blr_make_query("SELECT @@GLOBAL.GTID_MODE");
buf = blr_make_query("SET @mariadb_slave_capability=4); buf = blr_make_query("SET @mariadb_slave_capability=4");
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;