Skip to content
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

Merged
merged 9 commits into from
Jan 30, 2025

Conversation

ascherbakoff
Copy link
Contributor

@ascherbakoff ascherbakoff commented Jan 27, 2025

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.

@ascherbakoff ascherbakoff changed the title IGNITE-24283 Remove shared command from replication pipeline. IGNITE-24283 Fix a race in safe timestamp processing during raft command retry. Jan 28, 2025
@@ -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. */
Copy link
Contributor

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.

Copy link
Contributor Author

@ascherbakoff ascherbakoff Jan 30, 2025

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.

Copy link
Contributor

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

@ptupitsyn ptupitsyn changed the title IGNITE-24283 Fix a race in safe timestamp processing during raft command retry. IGNITE-24283 Fix a race in safe timestamp processing during raft command retry Jan 30, 2025
@ptupitsyn ptupitsyn changed the title IGNITE-24283 Fix a race in safe timestamp processing during raft command retry IGNITE-24283 Fix data race in raft pipeline on command retry Jan 30, 2025
@ptupitsyn ptupitsyn merged commit e9fd786 into apache:main Jan 30, 2025
1 check passed
@ptupitsyn ptupitsyn deleted the ignite-24283 branch January 30, 2025 16:27
ptupitsyn pushed a commit that referenced this pull request Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants