Ensure that slave->cstate contains meaningful value.
In blr_slave_callback the bits of slave->cstate are reset and set as one transaction. Earlier they were reset in one and set in another, leading to a situation where slave->cstate did not contain a sensible value for a short period of time. Further, it is now explicitly checked in blr_distribute_binlog_record that slave->cstate indeed contains a meaningful value.
This commit is contained in:
@ -1602,6 +1602,11 @@ unsigned int cstate;
|
|||||||
/* Slave is in catchup mode */
|
/* Slave is in catchup mode */
|
||||||
action = 3;
|
action = 3;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MXS_ERROR("slave->cstate does not contain a meaningful state %d", slave->cstate);
|
||||||
|
action = 0;
|
||||||
|
}
|
||||||
slave->stats.n_actions[action-1]++;
|
slave->stats.n_actions[action-1]++;
|
||||||
spinlock_release(&slave->catch_lock);
|
spinlock_release(&slave->catch_lock);
|
||||||
|
|
||||||
|
|||||||
@ -1965,6 +1965,7 @@ char read_errmsg[BINLOG_ERROR_MSG_LEN+1];
|
|||||||
|
|
||||||
if (do_return) {
|
if (do_return) {
|
||||||
spinlock_acquire(&slave->catch_lock);
|
spinlock_acquire(&slave->catch_lock);
|
||||||
|
slave->cstate &= ~CS_BUSY;
|
||||||
slave->cstate |= CS_EXPECTCB;
|
slave->cstate |= CS_EXPECTCB;
|
||||||
spinlock_release(&slave->catch_lock);
|
spinlock_release(&slave->catch_lock);
|
||||||
poll_fake_write_event(slave->dcb);
|
poll_fake_write_event(slave->dcb);
|
||||||
@ -1972,15 +1973,6 @@ char read_errmsg[BINLOG_ERROR_MSG_LEN+1];
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
spinlock_acquire(&slave->catch_lock);
|
|
||||||
if (slave->cstate & CS_BUSY)
|
|
||||||
{
|
|
||||||
spinlock_release(&slave->catch_lock);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
slave->cstate |= CS_BUSY;
|
|
||||||
spinlock_release(&slave->catch_lock);
|
|
||||||
|
|
||||||
BLFILE *file;
|
BLFILE *file;
|
||||||
#ifdef BLFILE_IN_SLAVE
|
#ifdef BLFILE_IN_SLAVE
|
||||||
file = slave->file;
|
file = slave->file;
|
||||||
@ -2369,8 +2361,14 @@ unsigned int cstate;
|
|||||||
if (slave->state == BLRS_DUMPING)
|
if (slave->state == BLRS_DUMPING)
|
||||||
{
|
{
|
||||||
spinlock_acquire(&slave->catch_lock);
|
spinlock_acquire(&slave->catch_lock);
|
||||||
|
if (slave->cstate & CS_BUSY)
|
||||||
|
{
|
||||||
|
spinlock_release(&slave->catch_lock);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
cstate = slave->cstate;
|
cstate = slave->cstate;
|
||||||
slave->cstate &= ~(CS_UPTODATE|CS_EXPECTCB);
|
slave->cstate &= ~(CS_UPTODATE|CS_EXPECTCB);
|
||||||
|
slave->cstate |= CS_BUSY;
|
||||||
spinlock_release(&slave->catch_lock);
|
spinlock_release(&slave->catch_lock);
|
||||||
|
|
||||||
if ((cstate & CS_UPTODATE) == CS_UPTODATE)
|
if ((cstate & CS_UPTODATE) == CS_UPTODATE)
|
||||||
|
|||||||
Reference in New Issue
Block a user