poorbarcode commented on code in PR #21946:
URL: https://github.com/apache/pulsar/pull/21946#discussion_r1564802782
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/persistent/PersistentReplicator.java:
##########
@@ -134,30 +137,44 @@ public PersistentReplicator(String localCluster,
PersistentTopic localTopic, Man
}
@Override
- protected void readEntries(Producer<byte[]> producer) {
- // Rewind the cursor to be sure to read again all non-acked messages
sent while restarting
+ protected void setProducerAndTriggerReadEntries(Producer<byte[]> producer)
{
+ // Rewind the cursor to be sure to read again all non-acked messages
sent while restarting.
cursor.rewind();
-
cursor.cancelPendingReadRequest();
- HAVE_PENDING_READ_UPDATER.set(this, FALSE);
- this.producer = (ProducerImpl) producer;
Review Comment:
> Why do we need to move these two lines?
It seems that if we don't set producer, the operation
doCloseProducerAsync(producer, () -> {}); can't close the producer.
We did not remove these two lines, just moved them into the logic branch
`compareSetAndGetState(Starting, Started) == true`.
>`doCloseProducerAsync(producer, () -> {});` can't close the producer.
This logic branch is using the method variable `producer`, not
`this.producer`, so it does work
--
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]