MXS-1530: stop replication unsupported binlog events
Stop replicating from master if unsupported binlog events are seen. Also report error message for unsupported events (blr_read_events_all_events) at maxscale start-up and with maxbinlogcheck utility
This commit is contained in:
@ -1563,10 +1563,12 @@ blr_read_events_all_events(ROUTER_INSTANCE *router, int fix, int debug)
|
|||||||
router->current_pos = pos;
|
router->current_pos = pos;
|
||||||
|
|
||||||
MXS_WARNING("an error has been found in %s. "
|
MXS_WARNING("an error has been found in %s. "
|
||||||
"Setting safe pos to %lu, current pos %lu",
|
"Setting safe pos to %lu, current pos %lu. "
|
||||||
|
"ErrMsg [%s]",
|
||||||
router->binlog_name,
|
router->binlog_name,
|
||||||
router->binlog_position,
|
router->binlog_position,
|
||||||
router->current_pos);
|
router->current_pos,
|
||||||
|
errmsg);
|
||||||
|
|
||||||
if (fix)
|
if (fix)
|
||||||
{
|
{
|
||||||
|
@ -1430,7 +1430,12 @@ blr_handle_binlog_record(ROUTER_INSTANCE *router, GWBUF *pkt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Gather statistics about the replication event types */
|
/**
|
||||||
|
* Check Event Type limit:
|
||||||
|
* If supported, gather statistics about
|
||||||
|
* the replication event types
|
||||||
|
* else stop replication from master
|
||||||
|
*/
|
||||||
int event_limit = router->mariadb10_compat ?
|
int event_limit = router->mariadb10_compat ?
|
||||||
MAX_EVENT_TYPE_MARIADB10 : MAX_EVENT_TYPE;
|
MAX_EVENT_TYPE_MARIADB10 : MAX_EVENT_TYPE;
|
||||||
|
|
||||||
@ -1438,6 +1443,38 @@ blr_handle_binlog_record(ROUTER_INSTANCE *router, GWBUF *pkt)
|
|||||||
{
|
{
|
||||||
router->stats.events[hdr.event_type]++;
|
router->stats.events[hdr.event_type]++;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
char errmsg[BINLOG_ERROR_MSG_LEN + 1];
|
||||||
|
sprintf(errmsg,
|
||||||
|
"Event type [%d] not supported yet. "
|
||||||
|
"Check master server configuration and "
|
||||||
|
"disable any new feature. "
|
||||||
|
"Replication from master has been stopped.",
|
||||||
|
hdr.event_type);
|
||||||
|
MXS_ERROR(errmsg);
|
||||||
|
gwbuf_free(pkt);
|
||||||
|
pkt = NULL;
|
||||||
|
|
||||||
|
spinlock_acquire(&router->lock);
|
||||||
|
|
||||||
|
/* Handle error messages */
|
||||||
|
char* old_errmsg = router->m_errmsg;
|
||||||
|
router->m_errmsg = MXS_STRDUP_A(errmsg);
|
||||||
|
router->m_errno = 1235;
|
||||||
|
|
||||||
|
/* Set state to stopped */
|
||||||
|
router->master_state = BLRM_SLAVE_STOPPED;
|
||||||
|
router->stats.n_binlog_errors++;
|
||||||
|
|
||||||
|
spinlock_release(&router->lock);
|
||||||
|
|
||||||
|
MXS_FREE(old_errmsg);
|
||||||
|
|
||||||
|
/* Stop replication */
|
||||||
|
blr_master_close(router);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (hdr.event_type == FORMAT_DESCRIPTION_EVENT && hdr.next_pos == 0)
|
if (hdr.event_type == FORMAT_DESCRIPTION_EVENT && hdr.next_pos == 0)
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user