From f6c4c84da39816f2da1db3e19bcec4aa3563e56d Mon Sep 17 00:00:00 2001 From: Benjamin Wang Date: Wed, 12 Oct 2022 19:28:32 +0800 Subject: [PATCH] etcdserver: added more debug log for the purgeFile goroutine Signed-off-by: Benjamin Wang --- client/pkg/fileutil/purge.go | 10 +++++++++- server/embed/etcd.go | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/client/pkg/fileutil/purge.go b/client/pkg/fileutil/purge.go index e8ac0ca6f..f4492009d 100644 --- a/client/pkg/fileutil/purge.go +++ b/client/pkg/fileutil/purge.go @@ -41,6 +41,12 @@ func purgeFile(lg *zap.Logger, dirname string, suffix string, max uint, interval lg = zap.NewNop() } errC := make(chan error, 1) + lg.Info("started to purge file", + zap.String("dir", dirname), + zap.String("suffix", suffix), + zap.Uint("max", max), + zap.Duration("interval", interval)) + go func() { if donec != nil { defer close(donec) @@ -63,14 +69,16 @@ func purgeFile(lg *zap.Logger, dirname string, suffix string, max uint, interval f := filepath.Join(dirname, newfnames[0]) l, err := TryLockFile(f, os.O_WRONLY, PrivateFileMode) if err != nil { + lg.Warn("failed to lock file", zap.String("path", f), zap.Error(err)) break } if err = os.Remove(f); err != nil { + lg.Error("failed to remove file", zap.String("path", f), zap.Error(err)) errC <- err return } if err = l.Close(); err != nil { - lg.Warn("failed to unlock/close", zap.String("path", l.Name()), zap.Error(err)) + lg.Error("failed to unlock/close", zap.String("path", l.Name()), zap.Error(err)) errC <- err return } diff --git a/server/embed/etcd.go b/server/embed/etcd.go index f612e96ef..7afe7fc90 100644 --- a/server/embed/etcd.go +++ b/server/embed/etcd.go @@ -323,6 +323,8 @@ func print(lg *zap.Logger, ec Config, sc config.ServerConfig, memberInitialized zap.String("election-timeout", fmt.Sprintf("%v", time.Duration(sc.ElectionTicks*int(sc.TickMs))*time.Millisecond)), zap.Bool("initial-election-tick-advance", sc.InitialElectionTickAdvance), zap.Uint64("snapshot-count", sc.SnapshotCount), + zap.Uint("max-wals", sc.MaxWALFiles), + zap.Uint("max-snapshots", sc.MaxSnapFiles), zap.Uint64("snapshot-catchup-entries", sc.SnapshotCatchUpEntries), zap.Strings("initial-advertise-peer-urls", ec.getAPURLs()), zap.Strings("listen-peer-urls", ec.getLPURLs()),