Reorder pending queue clean checks

This commit is contained in:
Jason Tedor 2016-04-05 15:59:54 -04:00
parent 3abf8177e8
commit c2ed5a1c9e
1 changed files with 4 additions and 7 deletions

View File

@ -164,10 +164,11 @@ public class PendingClusterStatesQueue {
currentMaster currentMaster
); );
} }
} else if (pendingState.stateUUID().equals(state.stateUUID())) {
assert pendingContext.committed() : "processed cluster state is not committed " + state;
contextsToRemove.add(pendingContext);
pendingContext.listener.onNewClusterStateProcessed();
} else if (state.version() >= pendingState.version()) { } else if (state.version() >= pendingState.version()) {
assert state.supersedes(pendingState) || (
state.nodes().getMasterNodeId() != null &&
state.nodes().getMasterNodeId().equals(pendingState.nodes().getMasterNodeId()));
logger.trace("processing pending state uuid[{}]/v[{}] together with state uuid[{}]/v[{}]", logger.trace("processing pending state uuid[{}]/v[{}] together with state uuid[{}]/v[{}]",
pendingState.stateUUID(), pendingState.version(), state.stateUUID(), state.version() pendingState.stateUUID(), pendingState.version(), state.stateUUID(), state.version()
); );
@ -175,10 +176,6 @@ public class PendingClusterStatesQueue {
if (pendingContext.committed()) { if (pendingContext.committed()) {
pendingContext.listener.onNewClusterStateProcessed(); pendingContext.listener.onNewClusterStateProcessed();
} }
} else if (pendingState.stateUUID().equals(state.stateUUID())) {
assert pendingContext.committed() : "processed cluster state is not committed " + state;
contextsToRemove.add(pendingContext);
pendingContext.listener.onNewClusterStateProcessed();
} }
} }
// now ack the processed state // now ack the processed state