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

snapshot: some improvments to the snapshot process #17236

Merged
merged 5 commits into from
May 9, 2023

Conversation

huikang
Copy link
Collaborator

@huikang huikang commented May 8, 2023

Description

snapshot: some improvments to the snapshot process

  • Add raft to the snapshot logger because the log messages are from raft package, making it consistent with other snapshot logs like starting snapshot up to, which are from the raft package as well. Also it allows users know where to search for the logger message
// before
2023-05-08T10:10:19.954-0400 [INFO]  agent.server.raft: starting snapshot up to: index=30
2023-05-08T10:10:19.954-0400 [INFO]  agent.server.snapshot: creating new snapshot: path=/tmp/dc-2-consul-server-1/raft/snapshots/3-30-1683555019954.tmp
2023-05-08T10:10:19.967-0400 [INFO]  agent.server.raft: snapshot complete up to: index=30

// after
2023-05-08T10:04:20.361-0400 [INFO]  agent.server.raft: starting snapshot up to: index=25
2023-05-08T10:04:20.361-0400 [INFO]  agent.server.raft.snapshot: creating new snapshot: path=/tmp/dc-2-consul-server-1/raft/snapshots/2-25-1683554660361.tmp
2023-05-08T10:04:20.382-0400 [INFO]  agent.server.raft: snapshot complete up to: index=25
2023-05-08T10:04:20.382-0400 [INFO]  agent.server: creating temporary file of snapshot: path=/var/folders/c0/0_4qftyd47g8bkq_4_5dpw4m0000gn/T/snapshot3125735996
  • Print out the path of the temp snapshot file for trouble shooting

  • Update the doc a bit

PR Checklist

  • updated test coverage
  • external facing docs updated
  • appropriate backport labels added
  • not a security concern

@huikang huikang requested a review from a team as a code owner May 8, 2023 14:14
@github-actions github-actions bot added the type/docs Documentation needs to be created/updated/clarified label May 8, 2023
@huikang huikang added pr/no-changelog PR does not need a corresponding .changelog entry backport/1.15 This release series is no longer active on CE. Use backport/ent/1.15. backport/1.14 labels May 8, 2023
@huikang huikang requested review from a team and jmurret and removed request for a team May 8, 2023 14:31
Copy link
Contributor

@trujillo-adam trujillo-adam left a comment

Choose a reason for hiding this comment

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

Just a few suggestions for the docs. Approving so you're not blocked on my end.

website/content/commands/snapshot/save.mdx Outdated Show resolved Hide resolved
Comment on lines 32 to 33
Another side effect is that one snapshot file is also taken at `data_dir/raft/snapshops`,
resulting from Raft snapshot.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
Another side effect is that one snapshot file is also taken at `data_dir/raft/snapshops`,
resulting from Raft snapshot.
As a result of the Raft snapshot, Consul also saves one snapshot file at `data_dir/raft/snapshops`.

Is that correct? Consul saves an additional snapshot triggered by the Raft snapshot?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, this is a result from the raft library.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

But I'd like to have an eng reviewer to confirm. Thanks, @trujillo-adam

@huikang
Copy link
Collaborator Author

huikang commented May 9, 2023

Hi, @kisunji , this seems related to the logger work you presented yesterday, so add you as the reviewer. Thanks.

Copy link
Contributor

@kisunji kisunji left a comment

Choose a reason for hiding this comment

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

Even though it's just logging, I think we should have a changelog calling out the move from snapshot -> raft.snapshot.

website/content/commands/snapshot/save.mdx Outdated Show resolved Hide resolved
@@ -53,6 +53,7 @@ func New(logger hclog.Logger, r *raft.Raft) (*Snapshot, error) {
if err != nil {
return nil, fmt.Errorf("failed to create snapshot file: %v", err)
}
logger.Info("creating temporary file of snapshot", "path", archive.Name())
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be at the debug level? Wondering if it is useful for operators at the INFO level

@huikang huikang merged commit 48f7d99 into main May 9, 2023
116 checks passed
@huikang huikang deleted the minor-update-snapshot-logger branch May 9, 2023 19:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/1.15 This release series is no longer active on CE. Use backport/ent/1.15. pr/no-changelog PR does not need a corresponding .changelog entry type/docs Documentation needs to be created/updated/clarified
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants