File tree Expand file tree Collapse file tree
managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6170,6 +6170,31 @@ public void markDeleteComplete(Object ctx) {
61706170 }
61716171 }
61726172
6173+ @ Test (timeOut = 20000 )
6174+ void testMarkDeletePreviousLacManyTimesInRolloverScenario () throws Exception {
6175+ ManagedLedgerConfig config = new ManagedLedgerConfig ();
6176+ config .setMaxEntriesPerLedger (1 );
6177+ // Set retention in order to not trim ledger.
6178+ config .setRetentionTime (20 , TimeUnit .SECONDS );
6179+ config .setRetentionSizeInMB (1 );
6180+
6181+ ManagedLedgerImpl ledger =
6182+ (ManagedLedgerImpl ) factory .open ("testMarkDeletePreviousLacManyTimesInRolloverScenario" , config );
6183+ ManagedCursorImpl cursor = (ManagedCursorImpl ) ledger .openCursor ("c1" );
6184+
6185+ Position position = ledger .addEntry ("entry1" .getBytes (Encoding ));
6186+
6187+ // Wait for new ledger created.
6188+ Awaitility .await ().untilAsserted (() -> assertThat (ledger .getLedgersInfo ().size ()).isEqualTo (2 ));
6189+
6190+ int markDeleteTimes = 10 ;
6191+ for (int i = 0 ; i < markDeleteTimes ; i ++) {
6192+ cursor .markDelete (position );
6193+ }
6194+
6195+ assertThat (cursor .getMarkDeletedPosition ()).isGreaterThan (position );
6196+ }
6197+
61736198 class TestPulsarMockBookKeeper extends PulsarMockBookKeeper {
61746199 Map <Long , Integer > ledgerErrors = new HashMap <>();
61756200
You can’t perform that action at this time.
0 commit comments