fix for missing crc check in blr_slave_fake_rotate()
fix for missing crc check in blr_slave_fake_rotate()
This commit is contained in:
@ -1693,6 +1693,9 @@ uint32_t chksum;
|
|||||||
|
|
||||||
binlognamelen = strlen(slave->binlogfile);
|
binlognamelen = strlen(slave->binlogfile);
|
||||||
len = 19 + 8 + 4 + binlognamelen;
|
len = 19 + 8 + 4 + binlognamelen;
|
||||||
|
/* no slave crc, remove 4 bytes */
|
||||||
|
if (slave->nocrc)
|
||||||
|
len -= 4;
|
||||||
|
|
||||||
// Build a fake rotate event
|
// Build a fake rotate event
|
||||||
resp = gwbuf_alloc(len + 5);
|
resp = gwbuf_alloc(len + 5);
|
||||||
@ -1711,6 +1714,7 @@ uint32_t chksum;
|
|||||||
memcpy(ptr, slave->binlogfile, binlognamelen);
|
memcpy(ptr, slave->binlogfile, binlognamelen);
|
||||||
ptr += binlognamelen;
|
ptr += binlognamelen;
|
||||||
|
|
||||||
|
if (!slave->nocrc) {
|
||||||
/*
|
/*
|
||||||
* Now add the CRC to the fake binlog rotate event.
|
* Now add the CRC to the fake binlog rotate event.
|
||||||
*
|
*
|
||||||
@ -1722,6 +1726,7 @@ uint32_t chksum;
|
|||||||
chksum = crc32(0L, NULL, 0);
|
chksum = crc32(0L, NULL, 0);
|
||||||
chksum = crc32(chksum, GWBUF_DATA(resp) + 5, hdr.event_size - 4);
|
chksum = crc32(chksum, GWBUF_DATA(resp) + 5, hdr.event_size - 4);
|
||||||
encode_value(ptr, chksum, 32);
|
encode_value(ptr, chksum, 32);
|
||||||
|
}
|
||||||
|
|
||||||
slave->dcb->func.write(slave->dcb, resp);
|
slave->dcb->func.write(slave->dcb, resp);
|
||||||
return 1;
|
return 1;
|
||||||
|
Reference in New Issue
Block a user