AnonHxy commented on code in PR #17394:
URL: https://github.com/apache/pulsar/pull/17394#discussion_r963215655


##########
pulsar-broker/src/test/java/org/apache/pulsar/broker/intercept/MangedLedgerInterceptorImplTest.java:
##########
@@ -256,6 +257,29 @@ public void testFindPositionByIndex() throws Exception {
         ledger.close();
     }
 
+    @Test
+    public void testBeforeAddEntryWithException() throws Exception {

Review Comment:
   > There is no such error log with the bug fix in the test.
   
   This will not prevent regression. The test will alwalys pass no matter 
duplicate release or not.
   
   How about verifying the `Bytebuf.refCnt()` like below ?  @HQebupt 
   ```suggestion
     ByteBuf buffer = Unpooled.wrappedBuffer("message".getBytes());
           ManagedLedger ledger = factory.open(ledgerAndCursorName, config);
   
           CountDownLatch countDownLatch = new CountDownLatch(1);
           ledger.asyncAddEntry(buffer, new AsyncCallbacks.AddEntryCallback() {
               @Override
               public void addComplete(Position position, ByteBuf entryData, 
Object ctx) {
                   countDownLatch.countDown();
               }
   
               @Override
               public void addFailed(ManagedLedgerException exception, Object 
ctx) {
                   countDownLatch.countDown();
               }
           }, null);
           countDownLatch.await();
           assertEquals(buffer.refCnt(), 1);
   ```
   
   
   



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