[ML] When skipping updating mark delete position, execute callback with executor to prevent deadlock
@@ -1896,7 +1896,8 @@ public class ManagedCursorImpl implements ManagedCursor {
log.info("Skipping updating mark delete position to {}. The persisted mark delete position {} "
+ "is later.", mdEntry.newPosition, persistentMarkDeletePosition);
}
- mdEntry.triggerComplete();
+ // run with executor to prevent deadlock
+ ledger.getExecutor().executeOrdered(ledger.getName(), safeRun(() -> mdEntry.triggerComplete()));
return;
}
@@ -1914,7 +1915,8 @@ public class ManagedCursorImpl implements ManagedCursor {
log.info("Skipping updating mark delete position to {}. The mark delete position update "
+ "in progress {} is later.", mdEntry.newPosition, inProgressLatest);
}
- mdEntry.triggerComplete();
+ // run with executor to prevent deadlock
+ ledger.getExecutor().executeOrdered(ledger.getName(), safeRun(() -> mdEntry.triggerComplete()));
return;
}
