Anpu Lu created RATIS-1883:
------------------------------
Summary: Next Index should be always larger than Match Index in
GrpcLogAppender
Key: RATIS-1883
URL: https://issues.apache.org/jira/browse/RATIS-1883
Project: Ratis
Issue Type: Bug
Components: Leader
Affects Versions: 2.5.1
Reporter: Anpu Lu
*Next Index should be always larger than Match Index in GrpcLogAppender.*
Considering the case below:
1. A new leader appends a no-op log [3], and sends an AppendEntries Request
containing log [3] to followers, updating their next index to 4, while match
index is default 0
2. Follower A has log [0 1] receives this request and replies inconsistency
3. Before leader receives reply, leader receives a client request and appends
log [4] and sends AppendEntries Request to followers, updating their next index
to 5, while match index is default 0
4. Leader receives inconsistency reply and decreases follower A's next index
from 5 to 2
5. Leader sends AppendEntries Request containing log [2 3 4] to follower A,
updating next index to 5
6. The same with 3, leader receives a client request and appends log [5] and
sends AppendEntries Request to followers, updating their next index to 6, while
match index is default 0
7. Follower receives request with log [4] and replies inconsistency
8. Leader receives inconsistency reply and decreases follower A's next index
from 6 to 2
9. Follower receives request with log [2 3 4] and replies success
10. Leader receives success reply and updates follower A's match index from 0
to 4.
11. *Now match index is larger than next index 2*
Possible solution:
- update next index after match index changes when receiving success reply
- update next index keeping larger than match index when receiving
inconsistency reply
--
This message was sent by Atlassian Jira
(v8.20.10#820010)