[fix] Exchange data cleanup improvement#698
Open
gaoran10 wants to merge 5 commits intostreamnative:masterfrom
Open
[fix] Exchange data cleanup improvement#698gaoran10 wants to merge 5 commits intostreamnative:masterfrom
gaoran10 wants to merge 5 commits intostreamnative:masterfrom
Conversation
2f33a4a to
a54babd
Compare
3 tasks
GhostBoyBoy
reviewed
Oct 12, 2022
| queueName, position.getLedgerId(), position.getEntryId())); | ||
| } | ||
| } | ||
| FutureUtil.waitForAll(futures).thenRun(this::scheduleExchangeClearTask); |
Contributor
There was a problem hiding this comment.
When (router.getExchange().markDeleteAsync) throws an exception, the task will stop. Replace (thenRun) with (whenComplete)
Collaborator
Author
There was a problem hiding this comment.
Good catch!
Fixed, please take a look again, thanks.
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.
Motivation
The PR #619 changed the queue cursor to be durable, this will cause the exchange topic can't be cleaned up completely because one queue only handles part of the exchange data, and only these index positions could be acknowledged.
At checkpoint1, get the route mark delete position of exchange1 and exchange2, then get the last confirm position of the queue. The exchange1 route mark delete pos is 1:2, the exchange2 mark delete pos is 2:2, and the LAC of the queue may be equal with 3:2 or greater than 3:2 (because the routing message process is still running), when the mark delete pos of the queue reach the LAC at checkpoint1, it indicates that the index message 3:0, 3:1 and 3:2 were all acked, so we can ack the exchange1 with pos 1:2, and ack the exchange2 with pos 2:2.
Modifications
Add exchange data cleanup scheduled task for each queue.
Remove useless unAckMessages in
AmqpConsumer.Verifying this change
Add verification to make sure exchange data could be cleaned up completely.
Does this pull request potentially affect one of the following parts:
If
yeswas chosen, please highlight the changesDocumentation
Check the box below.
Need to update docs?
doc-required(If you need help on updating docs, create a doc issue)
no-need-doc(Please explain why)
doc(If this PR contains doc changes)