MariaDB 10 optional compatibility

MariaDB 10 optional compatibility with mariadb10-compatibility=1
This commit is contained in:
MassimilianoPinto
2015-05-07 15:16:37 +02:00
parent 8afa46b8b2
commit e9391ef486
3 changed files with 68 additions and 53 deletions

View File

@ -448,12 +448,27 @@ char query[128];
GWBUF_CONSUME_ALL(router->saved_master.chksum2);
router->saved_master.chksum2 = buf;
blr_cache_response(router, "chksum2", buf);
//buf = blr_make_query("SELECT @@GLOBAL.GTID_MODE");
buf = blr_make_query("SET @mariadb_slave_capability=4");
router->master_state = BLRM_GTIDMODE;
if (router->mariadb10_compat) {
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->func.write(router->master, buf);
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:
// Response to the GTID_MODE, should be stored
if (router->saved_master.gtid_mode)

View File

@ -366,11 +366,11 @@ int query_len;
free(query_text);
return blr_slave_replay(router, slave, router->saved_master.heartbeat);
}
else if (strcasecmp(word, "@mariadb_slave_capability") == 0)
else if (strcasecmp(word, "@mariadb_slave_capability") == 0)
{
free(query_text);
return blr_slave_replay(router, slave, router->saved_master.gtid_mode);
//return blr_slave_send_ok(router, slave);
if (router->mariadb10_compat)
return blr_slave_replay(router, slave, router->saved_master.mariadb10);
}
else if (strcasecmp(word, "@master_binlog_checksum") == 0)
{