MariaDB 10 master requires MariaDB 10 slaves
Only MariaDB 10 slaves can register to binblog server with a MariaDB 10 Master
This commit is contained in:
@ -24,8 +24,9 @@
|
|||||||
* @verbatim
|
* @verbatim
|
||||||
* Revision History
|
* Revision History
|
||||||
*
|
*
|
||||||
* Date Who Description
|
* Date Who Description
|
||||||
* 02/04/14 Mark Riddoch Initial implementation
|
* 02/04/14 Mark Riddoch Initial implementation
|
||||||
|
* 11/05/15 Massimilaino Pinto Added mariadb10_compat to master and slave structs
|
||||||
*
|
*
|
||||||
* @endverbatim
|
* @endverbatim
|
||||||
*/
|
*/
|
||||||
@ -175,6 +176,7 @@ typedef struct router_slave {
|
|||||||
uint32_t lastEventTimestamp;/*< Last event timestamp sent */
|
uint32_t lastEventTimestamp;/*< Last event timestamp sent */
|
||||||
SPINLOCK catch_lock; /*< Event catchup lock */
|
SPINLOCK catch_lock; /*< Event catchup lock */
|
||||||
unsigned int cstate; /*< Catch up state */
|
unsigned int cstate; /*< Catch up state */
|
||||||
|
bool mariadb10_compat;/*< MariaDB 10.0 compatibility */
|
||||||
SPINLOCK rses_lock; /*< Protects rses_deleted */
|
SPINLOCK rses_lock; /*< Protects rses_deleted */
|
||||||
pthread_t pthread;
|
pthread_t pthread;
|
||||||
struct router_instance
|
struct router_instance
|
||||||
|
@ -498,6 +498,7 @@ ROUTER_SLAVE *slave;
|
|||||||
strcpy(slave->binlogfile, "unassigned");
|
strcpy(slave->binlogfile, "unassigned");
|
||||||
slave->connect_time = time(0);
|
slave->connect_time = time(0);
|
||||||
slave->lastEventTimestamp = 0;
|
slave->lastEventTimestamp = 0;
|
||||||
|
slave->mariadb10_compat = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add this session to the list of active sessions.
|
* Add this session to the list of active sessions.
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
* 18/03/2015 Markus Makela Better detection of CRC32 | NONE checksum
|
* 18/03/2015 Markus Makela Better detection of CRC32 | NONE checksum
|
||||||
* 19/03/2015 Massimiliano Pinto Addition of basic MariaDB 10 compatibility support
|
* 19/03/2015 Massimiliano Pinto Addition of basic MariaDB 10 compatibility support
|
||||||
* 07/05/2015 Massimiliano Pinto Added MariaDB 10 Compatibility
|
* 07/05/2015 Massimiliano Pinto Added MariaDB 10 Compatibility
|
||||||
|
* 11/05/2015 Massimiliano Pinto Only MariaDB 10 Slaves can register to binlog router with a MariaDB 10 Master
|
||||||
*
|
*
|
||||||
* @endverbatim
|
* @endverbatim
|
||||||
*/
|
*/
|
||||||
@ -125,7 +126,27 @@ blr_slave_request(ROUTER_INSTANCE *router, ROUTER_SLAVE *slave, GWBUF *queue)
|
|||||||
return blr_slave_query(router, slave, queue);
|
return blr_slave_query(router, slave, queue);
|
||||||
break;
|
break;
|
||||||
case COM_REGISTER_SLAVE:
|
case COM_REGISTER_SLAVE:
|
||||||
return blr_slave_register(router, slave, queue);
|
/*
|
||||||
|
* If Master is MariaDB10 don't allow registration from
|
||||||
|
* MariaDB/Mysql 5 Slaves
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (router->mariadb10_compat && !slave->mariadb10_compat) {
|
||||||
|
slave->state = BLRS_ERRORED;
|
||||||
|
blr_send_custom_error(slave->dcb, 1, 0,
|
||||||
|
"MariaDB 10 Slave is required for Slave registration");
|
||||||
|
|
||||||
|
LOGIF(LE, (skygw_log_write(
|
||||||
|
LOGFILE_ERROR,
|
||||||
|
"MariaDB 10 Slave is required for Slave registration",
|
||||||
|
MYSQL_COMMAND(queue))));
|
||||||
|
|
||||||
|
dcb_close(slave->dcb);
|
||||||
|
return 1;
|
||||||
|
} else {
|
||||||
|
/* Master and Slave version OK: continue with slave registration */
|
||||||
|
return blr_slave_register(router, slave, queue);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case COM_BINLOG_DUMP:
|
case COM_BINLOG_DUMP:
|
||||||
return blr_slave_binlog_dump(router, slave, queue);
|
return blr_slave_binlog_dump(router, slave, queue);
|
||||||
@ -370,6 +391,9 @@ int query_len;
|
|||||||
}
|
}
|
||||||
else if (strcasecmp(word, "@mariadb_slave_capability") == 0)
|
else if (strcasecmp(word, "@mariadb_slave_capability") == 0)
|
||||||
{
|
{
|
||||||
|
/* mariadb10 compatibility is set for the slave */
|
||||||
|
slave->mariadb10_compat=true;
|
||||||
|
|
||||||
free(query_text);
|
free(query_text);
|
||||||
if (router->mariadb10_compat) {
|
if (router->mariadb10_compat) {
|
||||||
return blr_slave_replay(router, slave, router->saved_master.mariadb10);
|
return blr_slave_replay(router, slave, router->saved_master.mariadb10);
|
||||||
|
Reference in New Issue
Block a user