lhotari commented on code in PR #25101:
URL: https://github.com/apache/pulsar/pull/25101#discussion_r2639607677
##########
managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedCursorTest.java:
##########
@@ -1260,26 +1263,29 @@ void cursorPersistence() throws Exception {
List<Entry> entries = c1.readEntries(3);
Position p1 = entries.get(2).getPosition();
+ // Mark delete, create ledger 4 due to cursor ledger state is NoLedger.
c1.markDelete(p1);
entries.forEach(Entry::release);
entries = c1.readEntries(4);
Position p2 = entries.get(2).getPosition();
+ // Mark delete, create ledger 5 due to cursor ledger state is NoLedger.
c2.markDelete(p2);
entries.forEach(Entry::release);
// Reopen
-
@Cleanup("shutdown")
ManagedLedgerFactory factory2 = new
ManagedLedgerFactoryImpl(metadataStore, bkc);
- ledger = factory2.open("my_test_ledger");
+ // Recovery open cursor_persistence_ledger ledger, create ledger 6,
and move mark delete position to 6:-1.
+ // See PR https://github.com/apache/pulsar/pull/25087.
+ ledger = factory2.open("cursor_persistence_ledger");
c1 = ledger.openCursor("c1");
c2 = ledger.openCursor("c2");
assertEquals(c1.getMarkDeletedPosition(), p1);
- // move mark-delete-position from 3:5 to 6:-1 since all the entries
have been consumed
ManagedCursor finalC2 = c2;
- Awaitility.await().untilAsserted(() ->
assertNotEquals(finalC2.getMarkDeletedPosition(), p2));
+ Awaitility.await()
+ .untilAsserted(() ->
assertEquals(finalC2.getMarkDeletedPosition(), PositionFactory.create(6, -1)));
Review Comment:
I'd avoid using specific ledger ids since there's also the managed cursor
persistent that could increase the ledger id and cause race conditions.
Wouldn't it be sufficient to assert that the mark delete position is greater
than p2 here?
```suggestion
.untilAsserted(() ->
assertThat(finalC2.getMarkDeletedPosition()).isGreaterThan(p2));
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]