diff --git a/raft.go b/raft.go index 86916626..21dbb3e1 100644 --- a/raft.go +++ b/raft.go @@ -1303,7 +1303,10 @@ func stepLeader(r *raft, m pb.Message) error { case pb.MsgReadIndex: // only one voting member (the leader) in the cluster if r.prs.IsSingleton() { - if resp := r.responseToReadIndexReq(m, r.raftLog.committed); resp.To != None { + // It's possible that the "officially committed index" < "actually committed index", + // raft may return an out of date readindex in such case. + readIndex := max(r.raftLog.committed, r.prs.Committed()) + if resp := r.responseToReadIndexReq(m, readIndex); resp.To != None { r.send(resp) } return nil