Skip to content
Closed
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 @@ -230,7 +230,7 @@ public MarkDeleteEntry(PositionImpl newPosition, Map<String, Long> properties,
}

public void triggerComplete() {
// Trigger the final callback after having (eventually) triggered the switchin-ledger operation. This
// Trigger the final callback after having (eventually) triggered the switching-ledger operation. This
// will ensure that no race condition will happen between the next mark-delete and the switching
// operation.
if (callbackGroup != null) {
Expand Down Expand Up @@ -1277,8 +1277,9 @@ public void operationFailed(ManagedLedgerException exception) {

persistentMarkDeletePosition = null;
inProgressMarkDeletePersistPosition = null;
lastMarkDeleteEntry = new MarkDeleteEntry(newPosition, getProperties(), null, null);
internalAsyncMarkDelete(newPosition, isCompactionCursor() ? getProperties() : Collections.emptyMap(),
PositionImpl newMarkDeletePosition = ledger.getPreviousPosition(newPosition);
lastMarkDeleteEntry = new MarkDeleteEntry(newMarkDeletePosition, getProperties(), null, null);
internalAsyncMarkDelete(newMarkDeletePosition, isCompactionCursor() ? getProperties() : Collections.emptyMap(),
new MarkDeleteCallback() {
@Override
public void markDeleteComplete(Object ctx) {
Expand Down Expand Up @@ -2005,7 +2006,7 @@ void internalMarkDelete(final MarkDeleteEntry mdEntry) {

LAST_MARK_DELETE_ENTRY_UPDATER.updateAndGet(this, last -> {
if (last != null && last.newPosition.compareTo(mdEntry.newPosition) > 0) {
// keep the current value since it's later then the mdEntry.newPosition
// keep the current value since it's later than the mdEntry.newPosition
return last;
} else {
return mdEntry;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import lombok.extern.slf4j.Slf4j;
import org.apache.bookkeeper.mledger.ManagedCursor;
import org.apache.pulsar.broker.service.persistent.PersistentSubscription;
import org.apache.pulsar.broker.service.persistent.PersistentTopic;
import org.apache.pulsar.client.admin.PulsarAdminException;
Expand Down Expand Up @@ -111,6 +112,9 @@ public void testSeek() throws Exception {
consumer.seek(messageIds.get(5));
assertEquals(sub.getNumberOfEntriesInBacklog(false), 5);

ManagedCursor cursor = topicRef.getSubscription("my-subscription").getCursor();
assertEquals(cursor.getMarkDeletedPosition(), cursor.getPersistentMarkDeletedPosition());

MessageIdImpl messageId = (MessageIdImpl) messageIds.get(5);
MessageIdImpl beforeEarliest = new MessageIdImpl(
messageId.getLedgerId() - 1, messageId.getEntryId(), messageId.getPartitionIndex());
Expand Down