You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2022/10/17 06:16:21 UTC

[GitHub] [pulsar] lordcheng10 commented on a diff in pull request #18007: [fix][broker] Reduce unnecessary persistence of markdelete

lordcheng10 commented on code in PR #18007:
URL: https://github.com/apache/pulsar/pull/18007#discussion_r996647872


##########
managed-ledger/src/test/java/org/apache/bookkeeper/mledger/impl/ManagedCursorTest.java:
##########
@@ -974,6 +974,22 @@ void rewind() throws Exception {
         assertEquals(c1.getNumberOfEntries(), 2);
     }
 
+    @Test(timeOut = 20000)
+    void markDeleteThePositionTwice() throws Exception {
+        ManagedLedger ledger = factory.open("my_test_ledger", new ManagedLedgerConfig().setMaxEntriesPerLedger(10));
+        ManagedCursor cursor = ledger.openCursor("c1");
+        Position p1 = ledger.addEntry("dummy-entry-1".getBytes(Encoding));
+
+        assertEquals(cursor.getNumberOfEntries(), 1);
+
+        cursor.markDelete(p1);
+        assertFalse(cursor.hasMoreEntries());
+        assertEquals(cursor.getNumberOfEntries(), 0);
+
+        // markDelete p1 again
+        cursor.markDelete(p1);

Review Comment:
   OK



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org