forked from apache/pulsar
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Data is not deleted after expiration due to connected readers (apache…
…#5621) * Data is not deleted after expiration due to connected readers *Problem* A problem is observed when stress testing pulsar using [pulsar-flink](https://github.com/streamnative/pulsar-flink) - No matter what TTL or retention setting is used, the data is never cleaned up. So the stress test ends up failing due to disk filled up. The root cause of the problem is described as below. when a reader is opened using `MessageId.earliest`, a non-durable cursor with position (-1, -2) is added to the cursor heap. The position `(-1, -2)` in the heap is never updated because non-durable cursors are never advanced when mark-deletions happen. So the slowest cursor position is always `(-1, -2)`, thus causing no ledger can be deleted even they are expired or over quota. *Motivation* Fix the problem to make sure Pulsar honor to TTL and retention settings. *Modifications* - Fix the `startPosition` when PersistentTopic opens a non-durable cursor on `MessageId.earliest`. So the `startPosition` is (-1, -1) not (-1, -2). - Fix the `NonDurableCursorImpl` constructor to check if the position in the ledger of `MessageId.earliest`. If the provided position is in the `earliest` ledger, the mark-deleted position will be set to the previous position of first position. - Fix the `NonDurableCursorImpl` to advance ledger cursor when mark-deletion happens on a non-durable cursor. *Verify this change* Unit tests are coming.
- Loading branch information
Showing
8 changed files
with
71 additions
and
14 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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