mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-22 16:18:28 -05:00
PSYNC2: discard pending transactions from cached master.
During the review of the fix for #3899, @yangsiran identified an implementation bug: given that the offset is now relative to the applied part of the replication log, when we cache a master, the successive PSYNC2 request will be made in order to *include* the transaction that was not completely processed. This means that we need to discard any pending transaction from our replication buffer: it will be re-executed.
This commit is contained in:
parent
22be435efe
commit
189a12afb4
@ -2120,10 +2120,12 @@ void replicationCacheMaster(client *c) {
|
||||
unlinkClient(c);
|
||||
|
||||
/* Fix the master specific fields: we want to discard to non processed
|
||||
* query buffers and non processed offsets. */
|
||||
* query buffers and non processed offsets, including pending
|
||||
* transactions. */
|
||||
sdsclear(server.master->querybuf);
|
||||
sdsclear(server.master->pending_querybuf);
|
||||
server.master->read_reploff = server.master->reploff;
|
||||
if (c->flags & CLIENT_MULTI) discardTransaction(c);
|
||||
|
||||
/* Save the master. Server.master will be set to null later by
|
||||
* replicationHandleMasterDisconnection(). */
|
||||
|
Loading…
Reference in New Issue
Block a user