Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4140,6 +4140,12 @@ public CompletableFuture<Position> getLastDispatchablePosition() {
if (lastDispatchablePosition != null) {
return CompletableFuture.completedFuture(lastDispatchablePosition);
}
Position lastPosition;
if (transactionBuffer instanceof TransactionBufferDisable) {
lastPosition = getLastPosition();
} else {
lastPosition = getMaxReadPosition();
}
return ledger.getLastDispatchablePosition(entry -> {
MessageMetadata md = entry.getMessageMetadata();
if (md == null) {
Expand All @@ -4154,7 +4160,7 @@ public CompletableFuture<Position> getLastDispatchablePosition() {
return !isTxnAborted(txnID, entry.getPosition());
}
return true;
}, getMaxReadPosition()).thenApply(position -> {
}, lastPosition).thenApply(position -> {
// Update lastDispatchablePosition to the given position
updateLastDispatchablePosition(position);
return position;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.util.concurrent.CompletableFuture;
import lombok.extern.slf4j.Slf4j;
import org.apache.bookkeeper.mledger.Position;
import org.apache.bookkeeper.mledger.PositionFactory;
import org.apache.pulsar.broker.service.BrokerServiceException;
import org.apache.pulsar.broker.service.Topic;
import org.apache.pulsar.broker.service.persistent.PersistentTopic;
Expand Down Expand Up @@ -108,7 +109,7 @@ public void syncMaxReadPositionForNormalPublish(Position position, boolean isMar

@Override
public Position getMaxReadPosition() {
return topic.getLastPosition();
return PositionFactory.LATEST;
}

@Override
Expand Down
Loading