This is an automated email from the ASF dual-hosted git repository.
weichiu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git
The following commit(s) were added to refs/heads/master by this push:
new 3f92663aed HDDS-11785. DataNode aborts ContainerStateMachine if it
does not know any follower next index (#7480)
3f92663aed is described below
commit 3f92663aed8acf023c09eb6d7f92e214c677b027
Author: Wei-Chiu Chuang <[email protected]>
AuthorDate: Tue Nov 26 10:16:51 2024 -0800
HDDS-11785. DataNode aborts ContainerStateMachine if it does not know any
follower next index (#7480)
---
.../transport/server/ratis/ContainerStateMachine.java | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/ContainerStateMachine.java
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/ContainerStateMachine.java
index 0be2b6de6e..23be4138b6 100644
---
a/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/ContainerStateMachine.java
+++
b/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/ContainerStateMachine.java
@@ -1005,12 +1005,15 @@ public class ContainerStateMachine extends
BaseStateMachine {
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);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]