-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IGNITE-24283 Fix data race in raft pipeline on command retry #5124
Conversation
…nto ignite-24283 # Conflicts: # modules/raft/src/main/java/org/apache/ignite/internal/raft/server/impl/JraftServerImpl.java
modules/raft/src/main/java/org/apache/ignite/raft/jraft/rpc/impl/ActionRequestProcessor.java
Outdated
Show resolved
Hide resolved
modules/raft/src/main/java/org/apache/ignite/raft/jraft/core/NodeImpl.java
Show resolved
Hide resolved
modules/raft/src/main/java/org/apache/ignite/internal/raft/server/impl/JraftServerImpl.java
Show resolved
Hide resolved
modules/raft-api/src/main/java/org/apache/ignite/internal/raft/WriteCommand.java
Outdated
Show resolved
Hide resolved
...t-api/src/main/java/org/apache/ignite/internal/raft/service/SafeTimeAwareCommandClosure.java
Outdated
Show resolved
Hide resolved
.../src/integrationTest/java/org/apache/ignite/distributed/ReplicasSafeTimePropagationTest.java
Outdated
Show resolved
Hide resolved
...table/src/main/java/org/apache/ignite/internal/table/distributed/raft/PartitionListener.java
Outdated
Show resolved
Hide resolved
...table/src/main/java/org/apache/ignite/internal/table/distributed/raft/PartitionListener.java
Outdated
Show resolved
Hide resolved
...n/java/org/apache/ignite/internal/table/distributed/replicator/PartitionReplicaListener.java
Outdated
Show resolved
Hide resolved
@@ -36,6 +36,7 @@ public class UpdateCommandResult implements Serializable { | |||
/** {@code true} if primary replica belongs to the raft group topology: peers and learners, (@code false) otherwise. */ | |||
private final boolean primaryInPeersAndLearners; | |||
|
|||
/** The safe timestamp. */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the code, 0 might be assigned to this field instead of the real safe time requested by the command. If this behavior will be retained, please mention here that 0 can be stored in the field and what it means.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
0 (HybridTimestamp.NULL_HYBRID_TIMESTAMP) means value is 'null'.
See the change above.
Not sure it needs additional comment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be useful for someone who is new to the code. Up to you
(cherry picked from commit e9fd786)
The root cause is modifying shared raft command state (patching safets) on retry, causing a race with FSM application.
The fix idea is to incapsulate safe timestamp in command closure instead passing it in the raft command.