diff --git a/raft/storage.go b/raft/storage.go index 57a525e39..69c3a7d90 100644 --- a/raft/storage.go +++ b/raft/storage.go @@ -98,6 +98,8 @@ func (ms *MemoryStorage) InitialState() (pb.HardState, pb.ConfState, error) { // SetHardState saves the current HardState. func (ms *MemoryStorage) SetHardState(st pb.HardState) error { + ms.Lock() + defer ms.Unlock() ms.hardState = st return nil }