Denovo1998 commented on code in PR #26106:
URL: https://github.com/apache/pulsar/pull/26106#discussion_r3499204227


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentReplicator.java:
##########
@@ -357,13 +357,45 @@ public void readEntriesComplete(List<Entry> entries, 
Object ctx) {
         InFlightTask inFlightTask = (InFlightTask) ctx;
 
         latestPublishTime = System.currentTimeMillis();
-        // Release memory if terminated.
+        // The read result must be discarded because the replicator is 
terminating or the cursor was
+        // rewound while this read was in flight (e.g. after a failed publish 
or a schema change).
         if (state == State.Terminated || state == State.Terminating
                 || inFlightTask.isSkipReadResultDueToCursorRewind()) {
             for (Entry entry : entries) {
-                inFlightTask.incCompletedEntries();
                 entry.release();
             }
+            boolean resumeReads = state != State.Terminated && state != 
State.Terminating;
+            // Hold the same lock as 
doRewindCursor()/acquirePermitsIfNotFetchingSchema() so completing the

Review Comment:
   This comment still refers to `acquirePermitsIfNotFetchingSchema()`, but that 
helper was removed by #26005. Could you update this to reference the 
`readMoreEntries()` read-scheduling path instead? The locking statement is 
still correct, but the stale method name makes the concurrency explanation 
harder to follow.



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