poorbarcode commented on code in PR #21187:
URL: https://github.com/apache/pulsar/pull/21187#discussion_r1338035184
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentDispatcherSingleActiveConsumer.java:
##########
@@ -349,7 +350,11 @@ protected void readMoreEntries(Consumer consumer) {
}
havePendingRead = true;
if (consumer.readCompacted()) {
- boolean readFromEarliest = isFirstRead &&
MessageId.earliest.equals(consumer.getStartMessageId());
+ boolean readFromEarliest = false;
+ if (!cursor.isDurable() || ((ManagedCursorImpl)
cursor).isCompactionCursor()
+ || cursor.getPersistentMarkDeletedPosition() ==
null) {
+ readFromEarliest = isFirstRead &&
MessageId.earliest.equals(consumer.getStartMessageId());
Review Comment:
The expected behaviors from the users point:
- Create a new reader. It should be reading at the earliest entry.
- Should continue reading from `{markDeletedPosition} + 1` after reconnect
(caused by socket closed or other events)<sup>[1]</sup>
- Create a new consumer(`non-durable`). It should be reading at the earliest
entry.
- Should continue reading from `{markDeletedPosition} + 1` after reconnect
(caused by socket closed or other events)<sup>[2]</sup>
- Create a new consumer(`durable`). It should be reading at
`{markDeletedPosition} + 1.`<sup>[3]</sup>
This PR only fixes the case<sup>[3]</sup>, we should guarantee the
case<sup>[1]</sup> and case<sup>[2]</sup> too.
--
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]