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(Flags): [Breaking] Add flag for snapshot duration frequency #7675

Merged
merged 6 commits into from
Apr 1, 2021

Conversation

rohanprasad
Copy link
Contributor

@rohanprasad rohanprasad commented Mar 31, 2021

Add a new flag snapshot-after-duration, which will take duration as a value. Raft snapshots will now be taken based on time since the last snapshot or the number of new raft entries. Also, rename snapshot-after to snapshot-after-entries for distinction.

Fixes DGRAPH-3213


This change is Reviewable

Copy link
Contributor

@NamanJain8 NamanJain8 left a comment

Choose a reason for hiding this comment

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

Some minor comments. Otherwise, looks good.

worker/draft.go Outdated Show resolved Hide resolved
worker/draft.go Outdated Show resolved Hide resolved
worker/draft.go Outdated Show resolved Hide resolved
Copy link
Contributor

@manishrjain manishrjain left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 3 of 4 files at r1, 1 of 1 files at r2.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @NamanJain8, @rohanprasad, and @vvbalaji-dgraph)


dgraph/cmd/alpha/run.go, line 161 at r2 (raw file):

			`Make this Alpha a "learner" node. In learner mode, this Alpha will not participate `+
				"in Raft elections. This can be used to achieve a read-only replica.").
		Flag("snapshot-after-entries",

Just keep both for now. But, make it an AND. Both conditions must be true.


dgraph/cmd/alpha/run.go, line 166 at r2 (raw file):

				"snapshot-after-duration or snapshot-after-entries threshold is crossed.").
		Flag("snapshot-after-duration",
			"Frequency at which we should create a new raft snapshots. Set "+

No need to repeat that "snapshots are created ...". Explain the format of duration -- 30m, 2h, ... Or, if it's in the help, then it's good.

snapshot-after


worker/draft.go, line 1000 at r2 (raw file):

func (n *node) checkpointAndClose(done chan struct{}) {
	slowTicker := time.NewTicker(time.Minute)
	lastSnapshotTime := time.Now()

just keep this in memory.

Copy link
Contributor

@NamanJain8 NamanJain8 left a comment

Choose a reason for hiding this comment

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

LGTM.
Few nit-picks. Otherwise, looks fine.

worker/draft.go Show resolved Hide resolved
worker/draft.go Outdated Show resolved Hide resolved
worker/draft.go Outdated Show resolved Hide resolved
worker/draft.go Outdated Show resolved Hide resolved
@rohanprasad rohanprasad merged commit d9ce265 into release/v21.03 Apr 1, 2021
aman-bansal pushed a commit that referenced this pull request Apr 8, 2021
* Add flag for snapshot duration frequency
* Use both entries and duration based flags for snapshots
@joshua-goldstein joshua-goldstein deleted the rohanprasad/change_snapshot_flag branch August 11, 2022 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants