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

[3.5] Update the compaction log when bootstrap and update compact's signature #17830

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions server/mvcc/kvstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ func (s *store) checkPrevCompactionCompleted() bool {
return scheduledCompact == finishedCompact && scheduledCompactFound == finishedCompactFound
}

func (s *store) compact(trace *traceutil.Trace, rev, prevCompactRev int64, prevCompactionCompleted bool) (<-chan struct{}, error) {
func (s *store) compact(trace *traceutil.Trace, rev, prevCompactRev int64, prevCompactionCompleted bool) <-chan struct{} {
ch := make(chan struct{})
var j = func(ctx context.Context) {
if ctx.Err() != nil {
Expand All @@ -262,7 +262,7 @@ func (s *store) compact(trace *traceutil.Trace, rev, prevCompactRev int64, prevC

s.fifoSched.Schedule(j)
trace.Step("schedule compaction")
return ch, nil
return ch
}

func (s *store) compactLockfree(rev int64) (<-chan struct{}, error) {
Expand All @@ -272,7 +272,7 @@ func (s *store) compactLockfree(rev int64) (<-chan struct{}, error) {
return ch, err
}

return s.compact(traceutil.TODO(), rev, prevCompactRev, prevCompactionCompleted)
return s.compact(traceutil.TODO(), rev, prevCompactRev, prevCompactionCompleted), nil
}

func (s *store) Compact(trace *traceutil.Trace, rev int64) (<-chan struct{}, error) {
Expand All @@ -287,7 +287,7 @@ func (s *store) Compact(trace *traceutil.Trace, rev int64) (<-chan struct{}, err
}
s.mu.Unlock()

return s.compact(trace, rev, prevCompactRev, prevCompactionCompleted)
return s.compact(trace, rev, prevCompactRev, prevCompactionCompleted), nil
}

func (s *store) Commit() {
Expand Down Expand Up @@ -408,15 +408,18 @@ func (s *store) restore() error {

if scheduledCompact != 0 {
if _, err := s.compactLockfree(scheduledCompact); err != nil {
s.lg.Warn("compaction encountered error", zap.Error(err))
s.lg.Warn("compaction encountered error",
zap.Int64("scheduled-compact-revision", scheduledCompact),
zap.Error(err),
)
} else {
s.lg.Info(
"resume scheduled compaction",
zap.Stringer("meta-bucket-name", buckets.Meta),
zap.String("meta-bucket-name-key", string(scheduledCompactKeyName)),
zap.Int64("scheduled-compact-revision", scheduledCompact),
)
}

s.lg.Info(
"resume scheduled compaction",
zap.Stringer("meta-bucket-name", buckets.Meta),
zap.String("meta-bucket-name-key", string(scheduledCompactKeyName)),
zap.Int64("scheduled-compact-revision", scheduledCompact),
)
}

return nil
Expand Down
Loading