-
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
Fix incorrect returned last message ID while the lastConfirmedEntry
with negative entry ID
#12277
Merged
merlimat
merged 1 commit into
apache:master
from
codelipenghui:penghui/fix-last-message-id-with-negative-entry-id
Oct 6, 2021
Merged
Fix incorrect returned last message ID while the lastConfirmedEntry
with negative entry ID
#12277
merlimat
merged 1 commit into
apache:master
from
codelipenghui:penghui/fix-last-message-id-with-negative-entry-id
Oct 6, 2021
Conversation
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
… with negative entry ID. Which recover a ManagedLedger, if the ManagedLedgers does not contain any ledgers, the ManagedLedger will use the current Ledger ID and -1 to generate the `lastConfirmedEntry`. For more details to see: https://github.com/apache/pulsar/blob/4bc3c405a565b1c756b9b70ff02a63ea06c32c0d/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java#L477 But for compacted topic, all the data might be compacted and move to the compacted Ledger, In this case, the broker will return X:-1 as the last message ID of the topic to the consumer, the consumer will treat the negative entry ID as no data in this topic, so hasMoreMessages will return false, but there is compacted data in the topic. The fix is as apache#12161 does to return the last message ID from the compacted Ledger if `lastConfirmedEntry` of the ManagedLedger with negative entry ID. Improved the `testLastMessageIdForCompactedLedger` test to cover the new changes.
eolivelli
approved these changes
Oct 5, 2021
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.
Lgtm
merlimat
approved these changes
Oct 6, 2021
codelipenghui
added a commit
that referenced
this pull request
Oct 6, 2021
… with negative entry ID. (#12277) Which recover a ManagedLedger, if the ManagedLedgers does not contain any ledgers, the ManagedLedger will use the current Ledger ID and -1 to generate the `lastConfirmedEntry`. For more details to see: https://github.com/apache/pulsar/blob/4bc3c405a565b1c756b9b70ff02a63ea06c32c0d/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java#L477 But for compacted topic, all the data might be compacted and move to the compacted Ledger, In this case, the broker will return X:-1 as the last message ID of the topic to the consumer, the consumer will treat the negative entry ID as no data in this topic, so hasMoreMessages will return false, but there is compacted data in the topic. The fix is as #12161 does to return the last message ID from the compacted Ledger if `lastConfirmedEntry` of the ManagedLedger with negative entry ID. Improved the `testLastMessageIdForCompactedLedger` test to cover the new changes. (cherry picked from commit 65fb6c6)
g8 job, thank you @codelipenghui |
eolivelli
pushed a commit
to eolivelli/pulsar
that referenced
this pull request
Feb 25, 2022
… with negative entry ID. (apache#12277) Which recover a ManagedLedger, if the ManagedLedgers does not contain any ledgers, the ManagedLedger will use the current Ledger ID and -1 to generate the `lastConfirmedEntry`. For more details to see: https://github.com/apache/pulsar/blob/4bc3c405a565b1c756b9b70ff02a63ea06c32c0d/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java#L477 But for compacted topic, all the data might be compacted and move to the compacted Ledger, In this case, the broker will return X:-1 as the last message ID of the topic to the consumer, the consumer will treat the negative entry ID as no data in this topic, so hasMoreMessages will return false, but there is compacted data in the topic. The fix is as apache#12161 does to return the last message ID from the compacted Ledger if `lastConfirmedEntry` of the ManagedLedger with negative entry ID. Improved the `testLastMessageIdForCompactedLedger` test to cover the new changes. (cherry picked from commit 65fb6c6) (cherry picked from commit 2e7088d)
bharanic-dev
pushed a commit
to bharanic-dev/pulsar
that referenced
this pull request
Mar 18, 2022
… with negative entry ID. (apache#12277) Which recover a ManagedLedger, if the ManagedLedgers does not contain any ledgers, the ManagedLedger will use the current Ledger ID and -1 to generate the `lastConfirmedEntry`. For more details to see: https://github.com/apache/pulsar/blob/4bc3c405a565b1c756b9b70ff02a63ea06c32c0d/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java#L477 But for compacted topic, all the data might be compacted and move to the compacted Ledger, In this case, the broker will return X:-1 as the last message ID of the topic to the consumer, the consumer will treat the negative entry ID as no data in this topic, so hasMoreMessages will return false, but there is compacted data in the topic. The fix is as apache#12161 does to return the last message ID from the compacted Ledger if `lastConfirmedEntry` of the ManagedLedger with negative entry ID. Improved the `testLastMessageIdForCompactedLedger` test to cover the new changes.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
area/compaction
cherry-picked/branch-2.7
Archived: 2.7 is end of life
cherry-picked/branch-2.8
Archived: 2.8 is end of life
doc-not-needed
Your PR changes do not impact docs
release/2.7.5
release/2.8.2
release/2.9.0
type/bug
The PR fixed a bug or issue reported a bug
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.
When recovering a ManagedLedger, if the ManagedLedgers does not contain any ledgers,
the ManagedLedger will use the current Ledger ID and -1 to generate the
lastConfirmedEntry
.For more details to see:
pulsar/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java
Line 477 in 4bc3c40
But for the compacted topic, all the data might be compacted and move to the compacted Ledger,
In this case, the broker will return X:-1 as the last message ID of the topic to the consumer,
the consumer will treat the negative entry ID as no data in this topic,
so
hasMoreMessages
method will return false, but there is compacted data in the topic.The fix is as #12161 does to return the last message ID from the compacted Ledger if
lastConfirmedEntry
of the ManagedLedger with negative entry ID.Improved the
testLastMessageIdForCompactedLedger
test to cover the new changes.