MXS-1530: check ANNOTATE_ROWS flag in connecting slave
MXS-1530: check ANNOTATE_ROWS flag in connecting slave. In MariaDB 10.2.4 replicate_annotate_row_events and binlog_annotate_row_events have default to ON: this change checks whether the connecting slave is not has ANNOTATE_ROWS in blr_slave_binlog_dump(), those ANNOTATE_ROWS events can be sent or not to the slave.
This commit is contained in:
parent
4cb50f48ad
commit
d4c0d74ab4
@ -1922,6 +1922,18 @@ blr_slave_binlog_dump(ROUTER_INSTANCE *router, ROUTER_SLAVE *slave, GWBUF *queue
|
||||
|
||||
/* Go ahead: after 4 bytes pos, 2 bytes flag and 4 bytes serverid */
|
||||
ptr += 4;
|
||||
|
||||
uint16_t flags = gw_mysql_get_byte2(ptr);
|
||||
/* Check whether connected slave is asking for ANNOTATE_ROWS events */
|
||||
if (flags & BLR_REQUEST_ANNOTATE_ROWS_EVENT)
|
||||
{
|
||||
slave->annotate_rows = true;
|
||||
MXS_INFO("Registering slave (server-id %d) asks "
|
||||
"for ANNOTATE_ROWS events.",
|
||||
slave->serverid);
|
||||
}
|
||||
|
||||
/* Go ahead: after 2 bytes flags and 4 bytes serverid */
|
||||
ptr += 2;
|
||||
ptr += 4;
|
||||
|
||||
@ -2398,9 +2410,12 @@ blr_slave_catchup(ROUTER_INSTANCE *router, ROUTER_SLAVE *slave, bool large)
|
||||
strcpy(binlog_name, slave->binlogfile);
|
||||
binlog_pos = slave->binlog_pos;
|
||||
|
||||
/* Don't sent special events generated by MaxScale */
|
||||
/* Don't sent special events generated by MaxScale
|
||||
* or ANNOTATE_ROWS events if not requested */
|
||||
if (hdr.event_type == MARIADB10_START_ENCRYPTION_EVENT ||
|
||||
hdr.event_type == IGNORABLE_EVENT)
|
||||
hdr.event_type == IGNORABLE_EVENT ||
|
||||
(!slave->annotate_rows &&
|
||||
hdr.event_type == MARIADB_ANNOTATE_ROWS_EVENT))
|
||||
{
|
||||
/* In case of file rotation or pos = 4 the events
|
||||
* are sent from position 4 and the new FDE at pos 4 is read.
|
||||
@ -2441,6 +2456,16 @@ blr_slave_catchup(ROUTER_INSTANCE *router, ROUTER_SLAVE *slave, bool large)
|
||||
slave->binlogfile,
|
||||
(unsigned long)hdr.next_pos);
|
||||
}
|
||||
/* MARIADB_ANNOTATE_ROWS_EVENT is skipped: just log that */
|
||||
else if (hdr.event_type == MARIADB_ANNOTATE_ROWS_EVENT)
|
||||
{
|
||||
MXS_INFO("Skipping ANNOTATE_ROWS event [%s] of size %lu while "
|
||||
"reading binlog %s at %lu",
|
||||
blr_get_event_description(router, hdr.event_type),
|
||||
(unsigned long)hdr.event_size,
|
||||
slave->binlogfile,
|
||||
(unsigned long)slave->binlog_pos);
|
||||
}
|
||||
else
|
||||
{
|
||||
MXS_INFO("Found ignorable event [%s] of size %lu while "
|
||||
|
Loading…
x
Reference in New Issue
Block a user