codelipenghui opened a new issue #14880:
URL: https://github.com/apache/pulsar/issues/14880


   **Describe the bug**
   
   Using pulsar-admin to check the topic internal stats for a transaction 
topic, you will see the following non-durable cursor.
   
   ```
   "transaction-buffer-sub" : {
         "markDeletePosition" : "743:3810",
         "readPosition" : "743:3811",
         "waitingReadOp" : false,
         "pendingReadOps" : 0,
         "messagesConsumedCounter" : 0,
         "cursorLedger" : -1,
         "cursorLedgerLastEntry" : -1,
         "individuallyDeletedMessages" : "[]",
         "lastLedgerSwitchTimestamp" : "2022-03-25T23:13:08.612+08:00",
         "state" : "Uninitialized",
         "numberOfEntriesSinceFirstNotAckedMessage" : 1,
         "totalNonContiguousDeletedMessagesRange" : 0,
         "subscriptionHavePendingRead" : false,
         "subscriptionHavePendingReplayRead" : false,
         "properties" : { }
       }
   ```
   
   But from the source code
   
   ```java
   if (lastConfirmedEntry.getEntryId() != -1) {
       while (lastConfirmedEntry.compareTo(currentLoadPosition) > 0
               && fillEntryQueueCallback.fillQueue()) {
           Entry entry = entryQueue.poll();
           if (entry != null) {
               try {
                   currentLoadPosition = PositionImpl.get(entry.getLedgerId(),
                           entry.getEntryId());
                   callBack.handleTxnEntry(entry);
               } finally {
                   entry.release();
               }
           } else {
               try {
                   Thread.sleep(1);
               } catch (InterruptedException e) {
                   //no-op
               }
           }
       }
   }
   
   closeCursor(managedCursor);
   ```
   
   The cursor should be closed after the transaction buffer is recovered.
   
   **Additional context**
   
https://github.com/apache/pulsar/commit/f0a2171cbad894cec5bfb2d4de31cb8de32a3183
   


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