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

raftexample: Fix recovery from snapshot #11889

Merged
merged 2 commits into from
Feb 10, 2021

Conversation

mrkm4ntr
Copy link
Contributor

  • If there is a snapshot, HTTP server won't start.
    This function doesn't return.
    s.readCommits(commitC, errorC)
  • Resotring form snapshot occurs after replaying WAL.
  • When taking a snapshot, the last change is not applied to the state machine yet.

@mrkm4ntr mrkm4ntr force-pushed the example-recover-from-snap branch 2 times, most recently from 612f7ad to ae8e73d Compare May 14, 2020 08:23
@mrkm4ntr
Copy link
Contributor Author

mrkm4ntr commented Jun 1, 2020

@gyuho Could you kindly review this?

@stale
Copy link

stale bot commented Aug 31, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 21 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Aug 31, 2020
@mrkm4ntr
Copy link
Contributor Author

@gyuho @xiang90 Could you kindly review on this?

@stale stale bot removed the stale label Aug 31, 2020
@stale
Copy link

stale bot commented Nov 29, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 21 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Nov 29, 2020
@MrCroxx
Copy link

MrCroxx commented Dec 11, 2020

Found the same problem, bro.

When I was developing my graduation project last year, I referenced this sample and I found there seemed to be something wrong here. At that time I'm a beginner in etcd or raft, and I thought that I have missed something.

When I am reviewing the sample and writing my blog, I found there IS a bug. It is very misleading for a beginner.

@stale stale bot removed the stale label Dec 11, 2020
contrib/raftexample/raft.go Outdated Show resolved Hide resolved
Copy link
Contributor

@ptabor ptabor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you.
It LGTM, but I think it should get reviewed by RAFT owners:

@tbg @bdarnell @tangcong

@bdarnell
Copy link
Contributor

bdarnell commented Feb 1, 2021

Looks fine to me, but I've never looked at raftexample or the etcd-specific snap package, so I don't think I'm very helpful as a reviewer here.

@tbg
Copy link
Contributor

tbg commented Feb 2, 2021 via email

* If there is a snapshot, HTTP server won't start.
* Resotring form snapshot occurs after replaying WAL.
* When taking a snapshot, the last change is not applied to the state machine yet.
@@ -353,6 +340,13 @@ func (rc *raftNode) maybeTriggerSnapshot() {
return
}

// wait until all committed entries are applied
Copy link
Contributor

@ptabor ptabor Feb 5, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add:
// commitC is synchronous channel, so consumption of the message signals
// full application of previous messages.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed.

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

Successfully merging this pull request may close these issues.

None yet

5 participants