Github user shralex commented on a diff in the pull request: https://github.com/apache/zookeeper/pull/167#discussion_r100486359 --- Diff: src/java/main/org/apache/zookeeper/server/quorum/CommitProcessor.java --- @@ -251,27 +252,29 @@ public void run() { LinkedList<Request> sessionQueue = pendingRequests .get(request.sessionId); if (sessionQueue != null) { + Request topPending = sessionQueue.peekFirst(); // 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 for requests before we even get this session + //(see ZOOKEEPER-2684). We will just pass those commits to the next processor. + if(request.cxid < topPending.cxid) { + LOG.warn("Got commit request " + request + + " that is less than our queue head " + topPending); + } else { + topPending = sessionQueue.poll(); --- End diff -- Do you mind separating the if into 3 cases instead of 2 ? here's a suggestion: if ( < ) // comment here about this case, pointing to the JIRA. Log.warn else if ( > ) Log error, throw exception else poll and do what the old code does.
--- 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 infrastruct...@apache.org or file a JIRA ticket with INFRA. ---