Skip to content

Commit

Permalink
[branch-3.3][fix] Change read max position to earliest position (#1328)
Browse files Browse the repository at this point in the history
  • Loading branch information
gaoran10 authored Aug 23, 2024
1 parent 985d291 commit 5e2dbb6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.apache.bookkeeper.mledger.ManagedCursor;
import org.apache.bookkeeper.mledger.ManagedLedgerException;
import org.apache.bookkeeper.mledger.Position;
import org.apache.bookkeeper.mledger.impl.PositionImpl;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.tuple.Pair;
import org.apache.pulsar.broker.service.persistent.PersistentTopic;
Expand Down Expand Up @@ -193,7 +194,7 @@ private void readMoreEntries() {
if (log.isDebugEnabled()) {
log.debug("{} Schedule read of {} messages.", name, messagesToRead);
}
cursor.asyncReadEntriesOrWait(messagesToRead, readMaxSizeBytes, this, null, null);
cursor.asyncReadEntriesOrWait(messagesToRead, readMaxSizeBytes, this, null, PositionImpl.LATEST);
} else {
if (log.isDebugEnabled()) {
log.debug("{} Not schedule read due to pending read. Messages to read {}.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
import org.apache.bookkeeper.mledger.Position;
import org.apache.bookkeeper.mledger.impl.ManagedCursorImpl;
import org.apache.bookkeeper.mledger.impl.ManagedLedgerImpl;
import org.apache.bookkeeper.mledger.impl.PositionImpl;
import org.apache.pulsar.broker.PulsarServerException;
import org.apache.pulsar.broker.service.persistent.PersistentTopic;
import org.apache.pulsar.client.api.MessageId;
Expand Down Expand Up @@ -161,7 +162,7 @@ public void readEntriesFailed(ManagedLedgerException exception, Object ctx) {
HAVE_PENDING_READ_UPDATER.set(ExchangeMessageRouter.this, FALSE);
log.error("Failed to read entries from exchange {}", exchange.getName(), exception);
}
}, null, null);
}, null, PositionImpl.LATEST);
} else {
log.warn("{} Not schedule read due to pending read. Messages to read {}.",
exchange.getName(), availablePermits);
Expand Down

0 comments on commit 5e2dbb6

Please sign in to comment.