merlimat commented on code in PR #16389:
URL: https://github.com/apache/pulsar/pull/16389#discussion_r913387344


##########
managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedCursorTest.java:
##########
@@ -3750,5 +3750,25 @@ public void readEntriesFailed(ManagedLedgerException 
exception, Object ctx) {
         Awaitility.await().untilAsserted(() -> assertTrue(flag.get()));
     }
 
+    @Test
+    public void testLazyCursorLedgerCreation() throws ManagedLedgerException, 
InterruptedException {
+        ManagedLedgerConfig managedLedgerConfig = new ManagedLedgerConfig();
+        ManagedLedgerImpl ledger = (ManagedLedgerImpl) factory
+                .open("testLazyCursorLedgerCreation", managedLedgerConfig);
+        ManagedCursorImpl cursor = (ManagedCursorImpl) 
ledger.openCursor("test");
+        assertEquals(cursor.getState(), "NoLedger");

Review Comment:
   We should also assert the mark-delete position of the cursor before any ack 
is sent. 
   
   And we could close the cursor (either gracefully or not) and recover it to 
verify the mark-delete is correct.
   
   To simulate the "ungraceful" close, we can use a different 
ManagedLedgerFactory to fence and recover the managed ledger.



-- 
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]

Reply via email to