Hi dev, I noticed that matchIndex in leaderStateImpl in initialized with value 0[1] and I think it is incorrect.
As the Raft Paper[2] states, matchIndex is 'for each server, index of highest log entry known to be replicated on server’. 0 is considered to be a valid Raft Log index in Ratis, and if we initialize matchIndex to 0, the very first log entry will become committed as soon as it is flushed into leader’s LogSegment, instead of after receiving majority ack responses. Therefore, I think the correct initialization value for match index is -1. Existing CI passed with -1: https://github.com/apache/ratis/actions/runs/3875583646. What do you think? Regards, William Song [1] https://github.com/apache/ratis/blob/d45dccc09c34d9dc51c52c6b14b468b2641692c2/ratis-server/src/main/java/org/apache/ratis/server/impl/FollowerInfoImpl.java#L40 [2] https://raft.github.io/raft.pdf
