Because Copycat implements a form of incremental log compaction that’s not typically implemented in most Raft implementations. The concept of an index is not antithetical to anything Raft does. It’s just not necessitated by the typical
Raft implementation which uses snapshotting for log compaction. But incremental compaction does necessitate the use of an index to remove interleaved entries from the log. This is suggested in section 5.3.1 of the Raft dissertation
. In Copycat, the index is used primarily after a segment has been compacted. Once a segment has been compacted, entries in the log may be missing, and the index is used to account for those. The index still isn’t strictly necessary. Everything Copycat does to reset indexes and resolve conflicts could still be done by scans.