codelipenghui opened a new pull request #12277: URL: https://github.com/apache/pulsar/pull/12277
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: https://github.com/apache/pulsar/blob/4bc3c405a565b1c756b9b70ff02a63ea06c32c0d/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java#L477 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. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
