-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
Run a separate in memory snapshot to reduce number of entries stored in raft memory storage #18825
base: main
Are you sure you want to change the base?
Conversation
Skipping CI for Draft Pull Request. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: serathius The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files
... and 24 files with indirect coverage changes @@ Coverage Diff @@
## main #18825 +/- ##
==========================================
- Coverage 68.76% 68.75% -0.01%
==========================================
Files 420 420
Lines 35523 35528 +5
==========================================
Hits 24426 24426
- Misses 9665 9670 +5
Partials 1432 1432 Continue to review full report in Codecov by Sentry.
|
d0cff01
to
2dd72a2
Compare
2dd72a2
to
2a560ea
Compare
…in raft memory storage Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
2a560ea
to
df6ba3f
Compare
func (s *EtcdServer) snapshotToMemory(snapi uint64, confState raftpb.ConfState) { | ||
d := GetMembershipInfoInV2Format(s.Logger(), s.cluster) | ||
|
||
lg := s.Logger() | ||
|
||
// For backward compatibility, generate v2 snapshot from v3 state. | ||
snap, err := s.r.raftStorage.CreateSnapshot(snapi, &confState, d) | ||
if err != nil { | ||
// the snapshot was done asynchronously with the progress of raft. | ||
// raft might have already got a newer snapshot. | ||
if errorspkg.Is(err, raft.ErrSnapOutOfDate) { | ||
return | ||
} | ||
lg.Panic("failed to create snapshot", zap.Error(err)) | ||
} | ||
|
||
verifyConsistentIndexIsLatest(lg, snap, s.consistIndex.ConsistentIndex()) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You do not persist the snapshot to disk. Is it intentionally? You will still have the same issue as #18588?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, please read the description of the PR for context.
c.lg.Info( | ||
"snapshot storing member", | ||
zap.String("id", m.ID.String()), | ||
zap.Strings("peer-urls", m.PeerURLs), | ||
zap.Bool("is-learner", m.IsLearner), | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why remove this log ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now happens too frequently and spams logs
lg.Info( | ||
"compacted Raft logs", | ||
zap.Uint64("compact-index", compacti), | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why remove this log?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now happens too frequently and spams logs
compacti := uint64(1) | ||
if snapi > s.Cfg.SnapshotCatchUpEntries { | ||
compacti = snapi - s.Cfg.SnapshotCatchUpEntries | ||
if snapi <= s.Cfg.SnapshotCatchUpEntries { | ||
return | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be unrelated to this PR, can we do it in a separate small PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, compactLog was causing some issue with when called too frequently. Need to double check.
Part of #17098
Alternative to #18635
Goal: Reduce number of raft entries stored in memory
Context:
Proposal:
Benchmark results
./bin/tools/benchmark put --total=15000 --val-size=100000