lhotari commented on code in PR #24934:
URL: https://github.com/apache/pulsar/pull/24934#discussion_r2486388792
##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/service/AbstractDispatcherSingleActiveConsumer.java:
##########
@@ -161,7 +163,21 @@ private NavigableMap<Integer, Integer> makeHashRing(int
consumerSize) {
return Collections.unmodifiableNavigableMap(hashRing);
}
- public synchronized CompletableFuture<Void> addConsumer(Consumer consumer)
{
+ public CompletableFuture<Void> addConsumer(Consumer consumer) {
+ return internalAddConsumer(consumer, 0);
+ }
+
+ private synchronized CompletableFuture<Void> internalAddConsumer(Consumer
consumer, int retryCount) {
+ if (retryCount >= MAX_RETRY_COUNT_FOR_ADD_CONSUMER_RACE) {
+ log.warn("[{}] The active consumer's connection is still inactive
after all retries, remove {} by force",
+ getName(), consumer);
+ try {
+ removeConsumer(consumer);
Review Comment:
I don't think that `removeConsumer` could be used directly to remove a
consumer here since it won't signal in any way to the client that the consumer
has been closed and other other data structures in parent levels don't get
updated consistently.
--
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]