You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by "spacemonkd (via GitHub)" <gi...@apache.org> on 2026/07/20 19:38:09 UTC

[PR] RATIS-2611. Clear pending queue on all install-snapshot replies [ratis]

spacemonkd opened a new pull request, #1524:
URL: https://github.com/apache/ratis/pull/1524

   ## What changes were proposed in this pull request?
   
   RATIS-2611. Clear pending queue on all install-snapshot replies
   
   When calling the onNext method, in the various result cases [here](https://github.com/apache/ratis/blob/f4c3781468e756220836e88d953fd5598177afdf/ratis-grpc/src/main/java/org/apache/ratis/grpc/server/GrpcLogAppender.java#L676) some cases do not call `removePending()`.
   
   NOT_LEADER
   CONF_MISMATCH
   UNRECOGNIZED
   SNAPSHOT_EXPIRED
   these cases do not clear the pending queue and this may possibly fail on the Preconditions.assertSame() check.
   
   `pending.poll()` removes the oldest enqueued request index. The handler assumes that for each reply we will have one addPending() and then one removePending() call in order.
   
   So if we take an example of chunk install with `SNAPSHOT_EXPIRED`
   
   1. Let us assume we send chunk [0,1,2] -> three `addPending()` calls -> pending queue [0, 1, 2]
   2. Reply with chunk 0 as success -> one `removePending()` call -> pending.poll() returns 0, condition passed
   3. Reply with chunk 1 as SNAPSHOT_EXPIRED -> pending queue still has [1, 2]
   
   This edge case is handled in the PR.
   
   
   ## What is the link to the Apache JIRA
   https://issues.apache.org/jira/browse/RATIS-2611
   
   ## How was this patch tested?
   Unit tests


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ratis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] RATIS-2611. Clear pending queue on all install-snapshot replies [ratis]

Posted by "spacemonkd (via GitHub)" <gi...@apache.org>.
spacemonkd closed pull request #1524: RATIS-2611. Clear pending queue on all install-snapshot replies
URL: https://github.com/apache/ratis/pull/1524


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ratis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] RATIS-2611. Clear pending queue on all install-snapshot replies [ratis]

Posted by "spacemonkd (via GitHub)" <gi...@apache.org>.
spacemonkd commented on PR #1524:
URL: https://github.com/apache/ratis/pull/1524#issuecomment-5026445320

   @szetszwo could you take a look at this PR?
   
   P.S. The tests have been generated via Cursor and have been validated locally.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@ratis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org