Advance ack level when queue is drained#9731
Merged
dnr merged 4 commits intotemporalio:mainfrom Apr 7, 2026
Merged
Conversation
rkannan82
approved these changes
Apr 3, 2026
rkannan82
reviewed
Apr 3, 2026
|
|
||
| if newAckLevel == db.getMaxReadLevelLocked(subqueue) { | ||
| // Reset approximateBacklogCount to fix the count divergence issue | ||
| if newAckLevel == db.getMaxReadLevelLocked(subqueue) || isDrained { |
Contributor
There was a problem hiding this comment.
Instead of adding this isDrained check, can we not advance ackLevel to readLevel when outstandingTasks is empty? This makes the ackLevel accurate and existing reset check should work.
Contributor
Author
There was a problem hiding this comment.
In theory, yes. I felt like this was a more conservative change and that would be more risky: if something was wrong with the logic, just adjusting the backlog count is safer than skipping over tasks. But it's pretty clear: if we've read to the end and have no tasks, then we can move the ack level. I think I see where to put the check, let me try it that way...
rkannan82
approved these changes
Apr 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed?
In priBacklogManager, use the isDrained logic (outstandingTasks) to move the ack level up when a queue is empty.
Why?
If the task id range ends in a gap, we won't be able to move the ack level higher based on completed tasks alone, but we can move it up when the queue is totally empty. This also lets us trigger the backlog count divergence reset.
How did you test it?