315157973 commented on a change in pull request #12202:
URL: https://github.com/apache/pulsar/pull/12202#discussion_r716627314



##########
File path: 
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractTopic.java
##########
@@ -404,7 +406,9 @@ public String getReplicatorPrefix() {
                 .thenCompose(__ ->
                         incrementTopicEpochIfNeeded(producer, 
producerQueuedFuture))
                 .thenCompose(producerEpoch -> {
-                    lock.writeLock().lock();
+                    Lock producerLock = producer.getAccessMode() == 
ProducerAccessMode.Shared
+                            ? lock.readLock() : lock.writeLock();
+                    producerLock.lock();

Review comment:
       The counter in internalAddProducer() is not thread-safe, it will be a 
problem if you use the read lock




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