-
Notifications
You must be signed in to change notification settings - Fork 7.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ZOOKEEPER-3023: Sync and commit diff log entries before NEWLEADER ack #1848
ZOOKEEPER-3023: Sync and commit diff log entries before NEWLEADER ack #1848
Conversation
50af53f
to
838c941
Compare
838c941
to
f4b0b76
Compare
ZOOKEEPER-2678 could skip snapshot in diff sync, but diff txns are logged and committed after NEWLEADER ack. ZOOKEEPER-3911 moves txn logging before NEWLEADER ack, but the txn logging is asynchronous. So it is indeterminate whether diff txns have been persisted to disk or not after NEWLEADER ack. This commit try to sync and commit txn logs synchronously before ack to NEWLEADER thus provides strong guarantee that follower is in sync with leader after NEWLEADER ack received. This behavior is consistent with pre ZOOKEEPER-2678 and easy to test.
f4b0b76
to
b0608e0
Compare
I have updated this pr with a fixup commit to remove #1445's effect, but I still leave room for ZOOKEEPER-4643. See #1925 (comment). |
Hi . I use the TLA+ specifications to verify the correctness of the fix in this pr. It can avoid the issues of ZOOKEEPER-3023, ZOOKEEPER-4394, ZOOKEEPER-4646 and ZOOKEEPER-4685. Besides, I really like this fix. It is really simple and easy to understand. |
This should be superceded by #2111. Both try to log diff entries synchronous before NEWLEADER ack and #2028 is similar. Additionally, #2111 should fix ZOOKEEPER-4643 also. I am not sure |
That's cool. The code fix of #2111 is basically the same as that of #2028. It should fix ZOOKEEPER-4643, ZOOKEEPER-4646 and ZOOKEEPER-4685.
In my understanding, #2111 cannot avoid the issue ZOOKEEPER-4394, right? Not all the pending requests need to be logged before the follower replies ACK of NEWLEADER. |
ZOOKEEPER-2678 could skip snapshot in diff sync, but diff txns are
logged and committed after NEWLEADER ack. ZOOKEEPER-3911 moves txn
logging before NEWLEADER ack, but the txn logging is asynchronous. So it
is indeterminate whether diff txns have been persisted to disk or not
after NEWLEADER ack.
This commit try to sync and commit txn logs synchronously before ack to
NEWLEADER thus provides strong guarantee that follower is in sync with
leader after NEWLEADER ack received.
This behavior is consistent with pre ZOOKEEPER-2678 and easy to test.