You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "jojochuang (via GitHub)" <gi...@apache.org> on 2024/11/23 07:45:37 UTC
[PR] HDDS-11785. DataNode aborts state machine because ContainerStateMachine does not know follower's next index [ozone]
jojochuang opened a new pull request, #7480:
URL: https://github.com/apache/ozone/pull/7480
## What changes were proposed in this pull request?
HDDS-11785. DataNode aborts state machine because ContainerStateMachine does not know follower's next index
Please describe your PR in detail:
* When waitOnAllFollowers is enabled (hdds.datanode.wait.on.all.followers), the leader may not have the follower's information, and will throw a RuntimeException that closes the state machine.
* Add a fix to return 0 in that case.
## What is the link to the Apache JIRA
https://issues.apache.org/jira/browse/HDDS-11785
## How was this patch tested?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11785. DataNode aborts state machine because ContainerStateMachine does not know follower's next index [ozone]
Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on code in PR #7480:
URL: https://github.com/apache/ozone/pull/7480#discussion_r1855258611
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/ContainerStateMachine.java:
##########
@@ -1006,7 +1006,7 @@ private void removeStateMachineDataIfNeeded(long index) {
RaftServer.Division division = ratisServer.getServer().getDivision(getGroupId());
if (division.getInfo().isLeader()) {
long minIndex = Arrays.stream(division.getInfo()
- .getFollowerNextIndices()).min().getAsLong();
+ .getFollowerNextIndices()).min().orElse(0);
LOG.debug("Removing data corresponding to log index {} min index {} "
+ "from cache", index, minIndex);
removeCacheDataUpTo(Math.min(minIndex, index));
Review Comment:
Thanks @jojochuang for the patch.
Should it `removeCacheDataUpTo` only if `minIndex` is found?
```java
Arrays.stream(division.getInfo().getFollowerNextIndices())
.min()
.ifPresent(minIndex -> removeCacheDataUpTo(Math.min(minIndex, index)));
```
Also, would be nice to rethrow unchecked exceptions directly:
```java
try {
...
} catch (RuntimeException e) {
throw e;
} catch (Exception e) {
throw new RuntimeException(e);
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11785. DataNode aborts ContainerStateMachine if it does not know any follower next index [ozone]
Posted by "jojochuang (via GitHub)" <gi...@apache.org>.
jojochuang commented on code in PR #7480:
URL: https://github.com/apache/ozone/pull/7480#discussion_r1857167237
##########
hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/transport/server/ratis/ContainerStateMachine.java:
##########
@@ -1006,7 +1006,7 @@ private void removeStateMachineDataIfNeeded(long index) {
RaftServer.Division division = ratisServer.getServer().getDivision(getGroupId());
if (division.getInfo().isLeader()) {
long minIndex = Arrays.stream(division.getInfo()
- .getFollowerNextIndices()).min().getAsLong();
+ .getFollowerNextIndices()).min().orElse(0);
LOG.debug("Removing data corresponding to log index {} min index {} "
+ "from cache", index, minIndex);
removeCacheDataUpTo(Math.min(minIndex, index));
Review Comment:
I think it's essentially the same, but your suggest is more readable. Will update accordingly.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11785. DataNode aborts ContainerStateMachine if it does not know any follower next index [ozone]
Posted by "jojochuang (via GitHub)" <gi...@apache.org>.
jojochuang commented on PR #7480:
URL: https://github.com/apache/ozone/pull/7480#issuecomment-2501633517
Merged. Thanks Attila
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org
Re: [PR] HDDS-11785. DataNode aborts ContainerStateMachine if it does not know any follower next index [ozone]
Posted by "jojochuang (via GitHub)" <gi...@apache.org>.
jojochuang merged PR #7480:
URL: https://github.com/apache/ozone/pull/7480
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org