Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.Original topic: TinyKV中ReadIndex实现的问题

I implemented ReadIndex myself, but in the TestSplitConfChangeSnapshotUnreliableRecoverConcurrentPartition3B test, it causes read-only requests to report Request Time (after running four or five hundred times, I confirmed that only read-only requests time out), with a probability of about 1/20. Checking the logs, I found that the test’s requests frequently encounter not_leader issues because the network instability often causes the leader to step down.
My analysis is that if my read-only requests go through log synchronization, even if the leader switches, my log might still be committed and then returned. However, after implementing ReadIndex, switching the leader causes read-only requests to directly report errors and resend, leading to read-only requests continuously resending in an unstable network environment.
I feel this might be the reason. If so, does it mean I can’t implement ReadIndex, or do you have any good ideas?