mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
Bug#31702 (Missing row on slave causes assertion failure under row-based replication):
When replicating an update pair (before image, after image) under row-based replication, and the before image is not found on the slave, the after image was not discared, and was hence read as a before image for the next row. Eventually, this lead to an after image being read outside the block of rows in the event, causing an assertion to fire. This patch fixes this by reading the after image in the event that the row was not found on the slave, adds some extra debug assertion to catch future errors earlier, and also adds a few non-debug checks to prevent reading outside the block of the event.
This commit is contained in:
@ -37,6 +37,23 @@
|
||||
#include "rpl_reporting.h"
|
||||
#endif
|
||||
|
||||
/**
|
||||
Either assert or return an error.
|
||||
|
||||
In debug build, the condition will be checked, but in non-debug
|
||||
builds, the error code given will be returned instead.
|
||||
|
||||
@param COND Condition to check
|
||||
@param ERRNO Error number to return in non-debug builds
|
||||
*/
|
||||
#ifdef DBUG_OFF
|
||||
#define ASSERT_OR_RETURN_ERROR(COND, ERRNO) \
|
||||
do { if (!(COND)) return ERRNO; } while (0)
|
||||
#else
|
||||
#define ASSERT_OR_RETURN_ERROR(COND, ERRNO) \
|
||||
DBUG_ASSERT(COND)
|
||||
#endif
|
||||
|
||||
#define LOG_READ_EOF -1
|
||||
#define LOG_READ_BOGUS -2
|
||||
#define LOG_READ_IO -3
|
||||
@ -2316,8 +2333,11 @@ protected:
|
||||
int unpack_current_row(const Relay_log_info *const rli)
|
||||
{
|
||||
DBUG_ASSERT(m_table);
|
||||
return ::unpack_row(rli, m_table, m_width, m_curr_row, &m_cols,
|
||||
&m_curr_row_end, &m_master_reclength);
|
||||
ASSERT_OR_RETURN_ERROR(m_curr_row < m_rows_end, HA_ERR_CORRUPT_EVENT);
|
||||
int const result= ::unpack_row(rli, m_table, m_width, m_curr_row, &m_cols,
|
||||
&m_curr_row_end, &m_master_reclength);
|
||||
ASSERT_OR_RETURN_ERROR(m_curr_row_end <= m_rows_end, HA_ERR_CORRUPT_EVENT);
|
||||
return result;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Reference in New Issue
Block a user