Github user fpj commented on a diff in the pull request:
https://github.com/apache/zookeeper/pull/167#discussion_r121006265
--- Diff:
src/java/main/org/apache/zookeeper/server/quorum/CommitProcessor.java ---
@@ -254,24 +254,23 @@ public void run() {
// If session queue != null, then it is also not
empty.
Request topPending = sessionQueue.poll();
if (request.cxid != topPending.cxid) {
- LOG.error(
- "Got cxid 0x"
- +
Long.toHexString(request.cxid)
- + " expected 0x" +
Long.toHexString(
- topPending.cxid)
- + " for client session id "
- + Long.toHexString(request.sessionId));
- throw new IOException("Error: unexpected cxid
for"
- + "client session");
+ // we can get commit requests that is not at
the queue head when
+ // session moves (see ZOOKEEPER-2684). We will
just pass the
+ // commit to the next processor and put the
pending back with
+ // a warning, we should not see this often
under normal load
+ LOG.warn("Got request " + request +
+ " but we are expecting request " +
topPending);
+ sessionQueue.addFirst(topPending);
+ } else {
--- End diff --
Is it the case that for a given session, once we execute the else block
once, executing the if block would be incorrect? If so, would it make sense to
have a flag per session indicating that the else block has not been executed
for the session? It might not even be a flag per session, but perhaps a set of
session ids instead that we remove from once we execute the else block.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---