You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by "133tosakarin (via GitHub)" <gi...@apache.org> on 2024/09/04 09:49:41 UTC
[PR] [WIP]RATIS-2148.Grpc streaming snapshot transfer may cause followers to trigger reloadStateMachine incorrectly [ratis]
133tosakarin opened a new pull request, #1145:
URL: https://github.com/apache/ratis/pull/1145
see https://issues.apache.org/jira/browse/RATIS-2148.
--
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@ratis.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] RATIS-2148.Grpc streaming snapshot transfer may cause followers to trigger reloadStateMachine incorrectly [ratis]
Posted by "szetszwo (via GitHub)" <gi...@apache.org>.
szetszwo commented on code in PR #1145:
URL: https://github.com/apache/ratis/pull/1145#discussion_r1744065033
##########
ratis-server/src/main/java/org/apache/ratis/server/impl/SnapshotInstallationHandler.java:
##########
@@ -68,6 +68,7 @@ class SnapshotInstallationHandler {
new AtomicReference<>(INVALID_TERM_INDEX);
private final AtomicBoolean isSnapshotNull = new AtomicBoolean();
private final AtomicLong installedIndex = new AtomicLong(INVALID_LOG_INDEX);
+ private final AtomicBoolean isSnapshotInstallSuccess = new AtomicBoolean(true);
Review Comment:
Let's use the chunk request index instead of a boolean.
--
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@ratis.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] RATIS-2148. Snapshot transfer may cause followers to trigger reloadStateMachine incorrectly [ratis]
Posted by "133tosakarin (via GitHub)" <gi...@apache.org>.
133tosakarin commented on code in PR #1145:
URL: https://github.com/apache/ratis/pull/1145#discussion_r1746371780
##########
ratis-server/src/main/java/org/apache/ratis/server/impl/SnapshotInstallationHandler.java:
##########
@@ -172,6 +174,12 @@ private InstallSnapshotReplyProto checkAndInstallSnapshot(InstallSnapshotRequest
state.setLeader(leaderId, "installSnapshot");
server.updateLastRpcTime(FollowerState.UpdateType.INSTALL_SNAPSHOT_START);
+ if (snapshotChunkRequest.getRequestIndex() == 0) {
+ chunkRequestIndex.set(0);
Review Comment:
I think both are ok.
If chunkRequestIndex is initialized to -1, in the second if condition it should be like:
else if (chunkRequestIndex.get() != snapshotChunkRequest.getRequestIndex() - 1)
If chunkRequestIndex is initialized to 0, in the second if condition it should be like:
else if (chunkRequestIndex.get() != snapshotChunkRequest.getRequestIndex())
The first indicates whether the previous chunk was successfully received
The second one indicates which chunk should be received next.
--
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@ratis.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] RATIS-2148. Snapshot transfer may cause followers to trigger reloadStateMachine incorrectly [ratis]
Posted by "133tosakarin (via GitHub)" <gi...@apache.org>.
133tosakarin commented on code in PR #1145:
URL: https://github.com/apache/ratis/pull/1145#discussion_r1746371780
##########
ratis-server/src/main/java/org/apache/ratis/server/impl/SnapshotInstallationHandler.java:
##########
@@ -172,6 +174,12 @@ private InstallSnapshotReplyProto checkAndInstallSnapshot(InstallSnapshotRequest
state.setLeader(leaderId, "installSnapshot");
server.updateLastRpcTime(FollowerState.UpdateType.INSTALL_SNAPSHOT_START);
+ if (snapshotChunkRequest.getRequestIndex() == 0) {
+ chunkRequestIndex.set(0);
Review Comment:
After successfully receiving the first chunk, the chunkRequestIndex is 0, but the requestIndex of the second chunk will be 1.
--
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@ratis.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [WIP]RATIS-2148.Grpc streaming snapshot transfer may cause followers to trigger reloadStateMachine incorrectly [ratis]
Posted by "133tosakarin (via GitHub)" <gi...@apache.org>.
133tosakarin commented on PR #1145:
URL: https://github.com/apache/ratis/pull/1145#issuecomment-2328514296
Bidirectional flow RPC can ensure that the sending and receiving order of messages is the same.
So in this PR, I used a flag to determine whether the entire snapshot request was successful
If a corrupt exception is encountered before the last request is received, subsequent requests will not be processed, reset the flag, and wait for resending
--
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@ratis.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] RATIS-2148. Snapshot transfer may cause followers to trigger reloadStateMachine incorrectly [ratis]
Posted by "133tosakarin (via GitHub)" <gi...@apache.org>.
133tosakarin commented on code in PR #1145:
URL: https://github.com/apache/ratis/pull/1145#discussion_r1746371780
##########
ratis-server/src/main/java/org/apache/ratis/server/impl/SnapshotInstallationHandler.java:
##########
@@ -172,6 +174,12 @@ private InstallSnapshotReplyProto checkAndInstallSnapshot(InstallSnapshotRequest
state.setLeader(leaderId, "installSnapshot");
server.updateLastRpcTime(FollowerState.UpdateType.INSTALL_SNAPSHOT_START);
+ if (snapshotChunkRequest.getRequestIndex() == 0) {
+ chunkRequestIndex.set(0);
Review Comment:
I think both are ok.
If chunkRequestIndex is initialized to -1, in the second if condition it should be like:
**else if (chunkRequestIndex.get() != snapshotChunkRequest.getRequestIndex() - 1)**
If chunkRequestIndex is initialized to 0, in the second if condition it should be like:
**else if (chunkRequestIndex.get() != snapshotChunkRequest.getRequestIndex())**
The first indicates whether the previous chunk was successfully received
The second one indicates which chunk should be received next.
--
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@ratis.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] RATIS-2148. Snapshot transfer may cause followers to trigger reloadStateMachine incorrectly [ratis]
Posted by "133tosakarin (via GitHub)" <gi...@apache.org>.
133tosakarin commented on code in PR #1145:
URL: https://github.com/apache/ratis/pull/1145#discussion_r1746371780
##########
ratis-server/src/main/java/org/apache/ratis/server/impl/SnapshotInstallationHandler.java:
##########
@@ -172,6 +174,12 @@ private InstallSnapshotReplyProto checkAndInstallSnapshot(InstallSnapshotRequest
state.setLeader(leaderId, "installSnapshot");
server.updateLastRpcTime(FollowerState.UpdateType.INSTALL_SNAPSHOT_START);
+ if (snapshotChunkRequest.getRequestIndex() == 0) {
+ chunkRequestIndex.set(0);
Review Comment:
I think both are ok.
If chunkRequestIndex is initialized to -1, in the second if condition it should be like:
**else if (chunkRequestIndex.get() != snapshotChunkRequest.getRequestIndex() - 1)**
If chunkRequestIndex is initialized to 0, in the second if condition it should be like:
**else if (chunkRequestIndex.get() != snapshotChunkRequest.getRequestIndex())**
--
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@ratis.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] RATIS-2148. Snapshot transfer may cause followers to trigger reloadStateMachine incorrectly [ratis]
Posted by "szetszwo (via GitHub)" <gi...@apache.org>.
szetszwo commented on code in PR #1145:
URL: https://github.com/apache/ratis/pull/1145#discussion_r1747382564
##########
ratis-server/src/main/java/org/apache/ratis/server/impl/SnapshotInstallationHandler.java:
##########
@@ -172,6 +174,12 @@ private InstallSnapshotReplyProto checkAndInstallSnapshot(InstallSnapshotRequest
state.setLeader(leaderId, "installSnapshot");
server.updateLastRpcTime(FollowerState.UpdateType.INSTALL_SNAPSHOT_START);
+ if (snapshotChunkRequest.getRequestIndex() == 0) {
+ chunkRequestIndex.set(0);
Review Comment:
@133tosakarin , I see. The if-condition is also changed. You are right that both cases are correct.
--
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@ratis.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] RATIS-2148. Snapshot transfer may cause followers to trigger reloadStateMachine incorrectly [ratis]
Posted by "133tosakarin (via GitHub)" <gi...@apache.org>.
133tosakarin commented on code in PR #1145:
URL: https://github.com/apache/ratis/pull/1145#discussion_r1744702877
##########
ratis-server/src/main/java/org/apache/ratis/server/impl/SnapshotInstallationHandler.java:
##########
@@ -68,6 +68,7 @@ class SnapshotInstallationHandler {
new AtomicReference<>(INVALID_TERM_INDEX);
private final AtomicBoolean isSnapshotNull = new AtomicBoolean();
private final AtomicLong installedIndex = new AtomicLong(INVALID_LOG_INDEX);
+ private final AtomicBoolean isSnapshotInstallSuccess = new AtomicBoolean(true);
Review Comment:
Great idea! Great idea! Thank you for your suggestions
--
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@ratis.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] RATIS-2148. Snapshot transfer may cause followers to trigger reloadStateMachine incorrectly [ratis]
Posted by "OneSizeFitsQuorum (via GitHub)" <gi...@apache.org>.
OneSizeFitsQuorum commented on code in PR #1145:
URL: https://github.com/apache/ratis/pull/1145#discussion_r1744794923
##########
ratis-server/src/main/java/org/apache/ratis/server/impl/SnapshotInstallationHandler.java:
##########
@@ -68,6 +69,7 @@ class SnapshotInstallationHandler {
new AtomicReference<>(INVALID_TERM_INDEX);
private final AtomicBoolean isSnapshotNull = new AtomicBoolean();
private final AtomicLong installedIndex = new AtomicLong(INVALID_LOG_INDEX);
+ private final AtomicInteger chunkRequestIndex = new AtomicInteger(-1);
Review Comment:
set 0
--
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@ratis.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] RATIS-2148. Snapshot transfer may cause followers to trigger reloadStateMachine incorrectly [ratis]
Posted by "OneSizeFitsQuorum (via GitHub)" <gi...@apache.org>.
OneSizeFitsQuorum commented on PR #1145:
URL: https://github.com/apache/ratis/pull/1145#issuecomment-2330499966
Based on this PR, maybe we'll be able to do file-level retries during snapshot transfers in the future~
--
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@ratis.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] RATIS-2148. Snapshot transfer may cause followers to trigger reloadStateMachine incorrectly [ratis]
Posted by "szetszwo (via GitHub)" <gi...@apache.org>.
szetszwo commented on code in PR #1145:
URL: https://github.com/apache/ratis/pull/1145#discussion_r1745925779
##########
ratis-server/src/main/java/org/apache/ratis/server/impl/SnapshotInstallationHandler.java:
##########
@@ -172,6 +174,12 @@ private InstallSnapshotReplyProto checkAndInstallSnapshot(InstallSnapshotRequest
state.setLeader(leaderId, "installSnapshot");
server.updateLastRpcTime(FollowerState.UpdateType.INSTALL_SNAPSHOT_START);
+ if (snapshotChunkRequest.getRequestIndex() == 0) {
+ chunkRequestIndex.set(0);
Review Comment:
Should it be `-1`? It should be incremented only after `state.installSnapshot(..)` has succeeded.
--
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@ratis.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] RATIS-2148. Snapshot transfer may cause followers to trigger reloadStateMachine incorrectly [ratis]
Posted by "szetszwo (via GitHub)" <gi...@apache.org>.
szetszwo merged PR #1145:
URL: https://github.com/apache/ratis/pull/1145
--
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@ratis.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org