-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Issue 9082: Broker expires messages one at a time after topic unload #9083
Conversation
Notes for the reviewers: |
managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/OpFindNewest.java
Outdated
Show resolved
Hide resolved
managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedCursorTest.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/test/java/org/apache/pulsar/broker/service/MessageTTLTest.java
Show resolved
Hide resolved
pulsar-broker/src/test/java/org/apache/pulsar/broker/service/MessageTTLTest.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/test/java/org/apache/pulsar/broker/service/MessageTTLTest.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/test/java/org/apache/pulsar/broker/service/MessageTTLTest.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/test/java/org/apache/pulsar/broker/service/MessageTTLTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @sijie for your review.
I have pushed a commit in order to address some of your comments, I left answers/question to the unresolved comments
managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedCursorTest.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/test/java/org/apache/pulsar/broker/service/MessageTTLTest.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/test/java/org/apache/pulsar/broker/service/MessageTTLTest.java
Outdated
Show resolved
Hide resolved
pulsar-broker/src/test/java/org/apache/pulsar/broker/service/MessageTTLTest.java
Show resolved
Hide resolved
pulsar-broker/src/test/java/org/apache/pulsar/broker/service/MessageTTLTest.java
Outdated
Show resolved
Hide resolved
@eolivelli left my comments. |
@sijie I have just left one of your comments to address, probably I still do not understand how can enhance the test with lastMessageId |
.subscribe(); | ||
|
||
MessageId lastMessageIdOnConsumer = consumer.getLastMessageId(); | ||
log.info("lastMessageID written {}, lastMessageIdForConsumer {}", lastMessageId, lastMessageIdOnConsumer); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these two values are the same, even if the messages are expired
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right. I think you can get stats-internal to get the internal stats to get the markDeletePosition. If you see the markDeletePosition is moved, it means TTL is taking effect.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very good @sijie
I have updated the test
@sijie can you please take another look ? I answered to your comments |
/pulsarbot run-failure-checks |
…9083) Fixes #9082 In case of topic unload the ManagedLedger rolls a new ledger and this confuses the search for messages to be expired. This is how OpFindNewest (the operation involved in message expiry, PersistentMessageExpiryMonitor) works: - first check if first message is expired - test in the last message - perform a search... At step two we are jumping to a position that is not valid, and the search ends immediately, returning only the first message Ensure that we are jumping only to a valid position, this change allows the PersistentMessageExpiryMonitor to find the best range of messages to expire. This change added tests: - unit test that covers the change - one reproducer for the problem, that now is fixes - another test case for the expected end-to-end behaviour for a consumer that waits too much and messages expire It can be also verified trying to reproduce manually the reproducer at #9082, after applying this patch the issue is no more reproducible (cherry picked from commit 7313b34)
…9083) Fixes #9082 In case of topic unload the ManagedLedger rolls a new ledger and this confuses the search for messages to be expired. This is how OpFindNewest (the operation involved in message expiry, PersistentMessageExpiryMonitor) works: - first check if first message is expired - test in the last message - perform a search... At step two we are jumping to a position that is not valid, and the search ends immediately, returning only the first message Ensure that we are jumping only to a valid position, this change allows the PersistentMessageExpiryMonitor to find the best range of messages to expire. This change added tests: - unit test that covers the change - one reproducer for the problem, that now is fixes - another test case for the expected end-to-end behaviour for a consumer that waits too much and messages expire It can be also verified trying to reproduce manually the reproducer at #9082, after applying this patch the issue is no more reproducible (cherry picked from commit 7313b34)
Fixes #9082
Motivation
In case of topic unload the ManagedLedger rolls a new ledger and this confuses the search for messages to be expired.
This is how OpFindNewest (the operation involved in message expiry, PersistentMessageExpiryMonitor) works:
At step two we are jumping to a position that is not valid, and the search ends immediately, returning only the first message
Modifications
Ensure that we are jumping only to a valid position, this change allows the PersistentMessageExpiryMonitor to find the best range of messages to expire.
Verifying this change
This change added tests:
It can be also verified trying to reproduce manually the reproducer at #9082, after applying this patch the issue is no more reproducible