From d383e865cbc7d045a735420a0b5b9c942b93dbfc Mon Sep 17 00:00:00 2001 From: Philip O'Toole Date: Thu, 18 Jan 2024 06:50:43 -0500 Subject: [PATCH] Don't log incremental Persist times --- CHANGELOG.md | 1 + store/fsm.go | 4 +++- store/store.go | 9 +++++---- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6791ea4b..5ffa1d2b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ The releases changes the default logging level for the Raft subsystem from `INFO - [PR #1607](https://github.com/rqlite/rqlite/pull/1607): Remove use of deprecated `ioutil`. - [PR #1608](https://github.com/rqlite/rqlite/pull/1608): Always close the FSM Snapshot. - [PR #1610](https://github.com/rqlite/rqlite/pull/1610): Change Raft default log level to `WARN`. +- [PR #1611](https://github.com/rqlite/rqlite/pull/1611): Don't log incremental Raft snapshots. ## 8.16.6 (January 16th 2024) ### Implementation changes and bug fixes diff --git a/store/fsm.go b/store/fsm.go index 16c2a42a..9b34e4a2 100644 --- a/store/fsm.go +++ b/store/fsm.go @@ -48,7 +48,9 @@ func (f *FSMSnapshot) Persist(sink raft.SnapshotSink) (retError error) { if retError == nil { dur := time.Since(startT) stats.Get(snapshotPersistDuration).(*expvar.Int).Set(dur.Milliseconds()) - f.logger.Printf("persisted snapshot %s in %s", sink.ID(), time.Since(startT)) + if f.logger != nil { + f.logger.Printf("persisted snapshot %s in %s", sink.ID(), dur) + } } }() return f.FSMSnapshot.Persist(sink) diff --git a/store/store.go b/store/store.go index 34733b72..09426998 100644 --- a/store/store.go +++ b/store/store.go @@ -1826,13 +1826,14 @@ func (s *Store) fsmSnapshot() (fSnap raft.FSMSnapshot, retErr error) { stats.Add(numSnapshots, 1) dur := time.Since(startT) stats.Get(snapshotCreateDuration).(*expvar.Int).Set(dur.Milliseconds()) + fs := FSMSnapshot{ + FSMSnapshot: fsmSnapshot, + } if fullNeeded { s.logger.Printf("%s snapshot created in %s on node ID %s", fPLog, dur, s.raftID) + fs.logger = s.logger } - return &FSMSnapshot{ - FSMSnapshot: fsmSnapshot, - logger: s.logger, - }, nil + return &fs, nil } // fsmRestore restores the node to a previous state. The Hashicorp docs state this