Skip to content

Commit

Permalink
HDDS-11785. DataNode aborts ContainerStateMachine if it does not know…
Browse files Browse the repository at this point in the history
… any follower next index (#7480)
  • Loading branch information
jojochuang authored Nov 26, 2024
1 parent f0a2c87 commit 3f92663
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1005,12 +1005,15 @@ private void removeStateMachineDataIfNeeded(long index) {
try {
RaftServer.Division division = ratisServer.getServer().getDivision(getGroupId());
if (division.getInfo().isLeader()) {
long minIndex = Arrays.stream(division.getInfo()
.getFollowerNextIndices()).min().getAsLong();
LOG.debug("Removing data corresponding to log index {} min index {} "
+ "from cache", index, minIndex);
removeCacheDataUpTo(Math.min(minIndex, index));
Arrays.stream(division.getInfo()
.getFollowerNextIndices()).min().ifPresent(minIndex -> {
removeCacheDataUpTo(Math.min(minIndex, index));
LOG.debug("Removing data corresponding to log index {} min index {} "
+ "from cache", index, minIndex);
});
}
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new RuntimeException(e);
}
Expand Down

0 comments on commit 3f92663

Please sign in to comment.