From 7991fcdbcb73a6028379a5619e3563867a0b21b0 Mon Sep 17 00:00:00 2001 From: Benjamin Wang Date: Mon, 15 Apr 2024 14:12:10 +0100 Subject: [PATCH] Update the compaction log when bootstrap and update compact's signature Actually the compact() never return an error, so remove the second return parameter. Signed-off-by: Benjamin Wang --- server/storage/mvcc/kvstore.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/server/storage/mvcc/kvstore.go b/server/storage/mvcc/kvstore.go index 0edf0b72d3b3..c7c105609aa3 100644 --- a/server/storage/mvcc/kvstore.go +++ b/server/storage/mvcc/kvstore.go @@ -226,7 +226,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{}) j := schedule.NewJob("kvstore_compact", func(ctx context.Context) { if ctx.Err() != nil { @@ -251,7 +251,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) { @@ -261,7 +261,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) { @@ -275,7 +275,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() { @@ -395,12 +395,12 @@ func (s *store) restore() error { if scheduledCompact != 0 { if _, err := s.compactLockfree(scheduledCompact); err != nil { s.lg.Warn("compaction encountered error", zap.Error(err)) + } else { + s.lg.Info( + "resume scheduled compaction", + zap.Int64("scheduled-compact-revision", scheduledCompact), + ) } - - s.lg.Info( - "resume scheduled compaction", - zap.Int64("scheduled-compact-revision", scheduledCompact), - ) } return nil