diff --git a/physical/raft/fsm.go b/physical/raft/fsm.go index 1638c458af..c2d9953ce3 100644 --- a/physical/raft/fsm.go +++ b/physical/raft/fsm.go @@ -238,6 +238,13 @@ func (f *FSM) openDBFile(dbPath string) error { return nil } +func (f *FSM) Stats() bolt.Stats { + f.l.RLock() + defer f.l.RUnlock() + + return f.db.Stats() +} + func (f *FSM) Close() error { f.l.RLock() defer f.l.RUnlock() diff --git a/physical/raft/raft.go b/physical/raft/raft.go index eaf3415553..e3c720630d 100644 --- a/physical/raft/raft.go +++ b/physical/raft/raft.go @@ -555,7 +555,7 @@ func (b *RaftBackend) Close() error { b.l.Lock() defer b.l.Unlock() - if err := b.fsm.db.Close(); err != nil { + if err := b.fsm.Close(); err != nil { return err } @@ -612,7 +612,7 @@ func (b *RaftBackend) DisableUpgradeMigration() (bool, bool) { func (b *RaftBackend) CollectMetrics(sink *metricsutil.ClusterMetricSink) { b.l.RLock() logstoreStats := b.stableStore.(*raftboltdb.BoltStore).Stats() - fsmStats := b.fsm.db.Stats() + fsmStats := b.fsm.Stats() stats := b.raft.Stats() b.l.RUnlock() b.collectMetricsWithStats(logstoreStats, sink, "logstore")