Skip to content

Commit

Permalink
[Java] Minor simplification of catch up logic.
Browse files Browse the repository at this point in the history
  • Loading branch information
mjpt777 committed Mar 31, 2018
1 parent fc3a73e commit b5df18a
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions aeron-cluster/src/main/java/io/aeron/cluster/SequencerAgent.java
Original file line number Diff line number Diff line change
Expand Up @@ -1166,15 +1166,14 @@ private void awaitCatchUp()
final RecordingLog.ReplayStep lastStep = recoveryPlan.termSteps.get(lastStepIndex);
final RecordingLog.Entry entry = lastStep.entry;

// TODO: fix up recordingLog entry for last step for on disk in case we recover again

termBaseLogPosition = entry.termBaseLogPosition;
leadershipTermId = entry.leadershipTermId;

final int logSessionId = lastStepIndex + 1;
channelUri.put(CommonContext.SESSION_ID_PARAM_NAME, Integer.toString(logSessionId));
final String channel = channelUri.toString();
final long recordingId = recordingCatchUp.recordingIdToExtend();
recordingCatchUp = null;

try (Counter counter = CommitPos.allocate(aeron, tempBuffer, leadershipTermId, termBaseLogPosition, length))
{
Expand All @@ -1198,17 +1197,11 @@ private void awaitCatchUp()
replayTerm(image, stopPosition, counter);

final long termPosition = image.position();
if (lastStep.entry.termPosition < termPosition)
{
recordingLog.commitLeadershipTermPosition(leadershipTermId, termPosition);
}

recordingLog.commitLeadershipTermPosition(leadershipTermId, termPosition);
termBaseLogPosition = entry.termBaseLogPosition + termPosition;
}
}
}

recordingCatchUp = null;
}
}

Expand Down

0 comments on commit b5df18a

Please sign in to comment.