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

feat: Delete Progress.PendingSnapshot and improve snapshot handling #243

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

soma00333
Copy link

Summary

This PR addresses issue #124 by cleaning up and improving snapshot handling in the Raft library. The main objectives include removing the PendingSnapshot, improving the handling of ReportSnapshot() and MsgSnapStatus, and cleaning up related state transitions to enhance clarity and robustness in the Raft snapshot management logic.

Change

Removal of PendingSnapshot

  • Eliminated Progress.PendingSnapshot, which is no longer necessary after changes in #110.
  • Simplified state transitions related to snapshot handling.

Enhancements to ReportSnapshot() and MsgSnapStatus

  • Updated ReportSnapshot() and MsgSnapStatus to accept the index of the applied snapshot.
  • This change allows Raft to handle cases where the snapshot’s applied index differs from the requested index, as seen in complex systems like CockroachDB.
  • Logic now directly updates Match and transitions to StateReplicate when applicable.

Additional Improvements

  • Improved comments for snapshot-related state handling.
  • Added test cases to ensure correctness for scenarios involving differing snapshot indices.

Breaking Changes

Public API Changes

  • ReportSnapshot() and MsgSnapStatus now require the applied snapshot’s index as a parameter.
  • These changes are not backward-compatible and necessitate updates in all downstream implementations.
  • The changes are designed for inclusion in version 4.0.0 to prevent breaking compatibility with existing 3.x users.

References

How I tested

$ make test
PASSES="unit" ./scripts/test.sh 
Starting at: Wed Nov 27 22:33:49 JST 2024

'unit' started at Wed Nov 27 22:33:49 JST 2024
ok      go.etcd.io/raft/v3      0.634s
ok      go.etcd.io/raft/v3/confchange   0.626s
ok      go.etcd.io/raft/v3/quorum       (cached)
ok      go.etcd.io/raft/v3/raftpb       (cached)
ok      go.etcd.io/raft/v3/rafttest     1.544s
ok      go.etcd.io/raft/v3/tracker      0.772s
'unit' completed at Wed Nov 27 22:33:52 JST 2024
SUCCESS

@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: soma00333
Once this PR has been reviewed and has the lgtm label, please assign spzala for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot
Copy link

Hi @soma00333. Thanks for your PR.

I'm waiting for a etcd-io member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@soma00333
Copy link
Author

@ahrtr
Hello, I hope you are doing good.
I handled one of the tickets in the v4.0.0 milestone.
Please take a look after you prepare the branch
Thank you

@serathius
Copy link
Member

cc @joshuazh-x
Can you help with review?

@soma00333
Copy link
Author

Thank you for checking this
I appreciate your help

@soma00333
Copy link
Author

/retest

@k8s-ci-robot
Copy link

@soma00333: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants