Projects
Eulaceura:Mainline
etcd
_service:obs_scm:0013-backport-Update-the-compa...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:obs_scm:0013-backport-Update-the-compaction-log-when-bootstrap-and-update-compacts-signature.patch of Package etcd
From f8f186490bbd2f404f47a50a4dab92355c3485f4 Mon Sep 17 00:00:00 2001 From: Benjamin Wang <benjamin.ahrtr@gmail.com> Date: Sun, 21 Apr 2024 13:23:59 +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 <benjamin.ahrtr@gmail.com> --- mvcc/kvstore.go | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/mvcc/kvstore.go b/mvcc/kvstore.go index 6752038..198db96 100644 --- a/mvcc/kvstore.go +++ b/mvcc/kvstore.go @@ -274,7 +274,7 @@ func (s *store) updateCompactRev(rev int64) (<-chan struct{}, error) { return nil, nil } -func (s *store) compact(trace *traceutil.Trace, rev int64) (<-chan struct{}, error) { +func (s *store) compact(trace *traceutil.Trace, rev int64) <-chan struct{} { ch := make(chan struct{}) var j = func(ctx context.Context) { if ctx.Err() != nil { @@ -293,7 +293,7 @@ func (s *store) compact(trace *traceutil.Trace, rev int64) (<-chan struct{}, err s.fifoSched.Schedule(j) trace.Step("schedule compaction") - return ch, nil + return ch } func (s *store) compactLockfree(rev int64) (<-chan struct{}, error) { @@ -302,7 +302,7 @@ func (s *store) compactLockfree(rev int64) (<-chan struct{}, error) { return ch, err } - return s.compact(traceutil.TODO(), rev) + return s.compact(traceutil.TODO(), rev), nil } func (s *store) Compact(trace *traceutil.Trace, rev int64) (<-chan struct{}, error) { @@ -316,7 +316,7 @@ func (s *store) Compact(trace *traceutil.Trace, rev int64) (<-chan struct{}, err } s.mu.Unlock() - return s.compact(trace, rev) + return s.compact(trace, rev), nil } // DefaultIgnores is a map of keys to ignore in hash checking. @@ -447,17 +447,28 @@ func (s *store) restore() error { tx.Unlock() if scheduledCompact != 0 { - s.compactLockfree(scheduledCompact) - - if s.lg != nil { - s.lg.Info( - "resume scheduled compaction", - zap.String("meta-bucket-name", string(metaBucketName)), - zap.String("meta-bucket-name-key", string(scheduledCompactKeyName)), - zap.Int64("scheduled-compact-revision", scheduledCompact), - ) + if _, err := s.compactLockfree(scheduledCompact); err != nil { + if s.lg != nil { + s.lg.Warn("compaction encountered error", + zap.String("meta-bucket-name", string(metaBucketName)), + zap.String("meta-bucket-name-key", string(scheduledCompactKeyName)), + zap.Int64("scheduled-compact-revision", scheduledCompact), + zap.Error(err), + ) + } else { + plog.Printf("compaction encountered error, scheduled-compact-revision: %d", scheduledCompact) + } } else { - plog.Printf("resume scheduled compaction at %d", scheduledCompact) + if s.lg != nil { + s.lg.Info( + "resume scheduled compaction", + zap.String("meta-bucket-name", string(metaBucketName)), + zap.String("meta-bucket-name-key", string(scheduledCompactKeyName)), + zap.Int64("scheduled-compact-revision", scheduledCompact), + ) + } else { + plog.Printf("resume scheduled compaction at %d", scheduledCompact) + } } } -- 2.9.3.windows.1
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.
浙ICP备2022010568号-2