coderzc commented on code in PR #21187:
URL: https://github.com/apache/pulsar/pull/21187#discussion_r1462691000
##########
pulsar-broker/src/main/java/org/apache/pulsar/compaction/CompactedTopicImpl.java:
##########
@@ -100,7 +100,11 @@ public void asyncReadEntriesOrWait(ManagedCursor cursor,
boolean isFirstRead,
ReadEntriesCallback callback, Consumer
consumer) {
PositionImpl cursorPosition;
- if (isFirstRead &&
MessageId.earliest.equals(consumer.getStartMessageId())){
+ boolean readFromEarliest = isFirstRead &&
MessageId.earliest.equals(consumer.getStartMessageId())
+ && (!cursor.isDurable() ||
cursor.getName().equals(Compactor.COMPACTION_SUBSCRIPTION)
+ || cursor.getMarkDeletedPosition() == null
+ || cursor.getMarkDeletedPosition().getEntryId() == -1L);
Review Comment:
> Sorry, I mean why we need to check
cursor.getMarkDeletedPosition().getEntryId() == -1L?
Oh, since if `markDeletedPosition.entryID == -1L` then the md-position is an
invalid position, the initial md-position of the consumer will be set to it.
https://github.com/apache/pulsar/blob/b14fcb47f20398bdf5b698e158346dce19f0edc6/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java#L997-L998
https://github.com/apache/pulsar/blob/b14fcb47f20398bdf5b698e158346dce19f0edc6/managed-ledger/src/main/java/org/apache/bookkeeper/mledger/impl/ManagedLedgerImpl.java#L3715-L3725
--
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]