@@ -2184,12 +2184,11 @@ public void asyncMarkDelete(final Position position, Map<String, Long> propertie
21842184 // Snapshot all positions into local variables to avoid race condition.
21852185 Position newPosition = ackBatchPosition (position );
21862186 Position moveForwardPosition = newPosition ;
2187- Position lastConfirmedEntry = ledger .getLastConfirmedEntry ();
21882187 Position markDeletePos = markDeletePosition ;
2188+ Position lastConfirmedEntry = ledger .getLastConfirmedEntry ();
21892189 boolean shouldCursorMoveForward = false ;
21902190 try {
2191- // Keep all comparison cases here for future modification.
2192- if (lastConfirmedEntry .getLedgerId () > newPosition .getLedgerId ()) {
2191+ if (lastConfirmedEntry .getLedgerId () >= newPosition .getLedgerId ()) {
21932192 LedgerInfo curMarkDeleteledgerInfo = ledger .getLedgerInfo (newPosition .getLedgerId ()).get ();
21942193 Long nextValidLedger = ledger .getNextValidLedger (newPosition .getLedgerId ());
21952194 shouldCursorMoveForward = (nextValidLedger != null )
@@ -2198,15 +2197,6 @@ public void asyncMarkDelete(final Position position, Map<String, Long> propertie
21982197 if (shouldCursorMoveForward ) {
21992198 moveForwardPosition = PositionFactory .create (nextValidLedger , -1 );
22002199 }
2201- } else if (lastConfirmedEntry .getLedgerId () == newPosition .getLedgerId ()) {
2202- LedgerInfo curMarkDeleteledgerInfo = ledger .getLedgerInfo (newPosition .getLedgerId ()).get ();
2203- Long nextValidLedger = ledger .getNextValidLedger (lastConfirmedEntry .getLedgerId ());
2204- shouldCursorMoveForward = (nextValidLedger != null )
2205- && (curMarkDeleteledgerInfo != null
2206- && newPosition .getEntryId () + 1 >= curMarkDeleteledgerInfo .getEntries ());
2207- if (shouldCursorMoveForward ) {
2208- moveForwardPosition = PositionFactory .create (nextValidLedger , -1 );
2209- }
22102200 } else {
22112201 Long nextValidLedger = ledger .getNextValidLedger (lastConfirmedEntry .getLedgerId ());
22122202 shouldCursorMoveForward = (nextValidLedger != null )
0 commit comments