You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by "nicoloboschi (via GitHub)" <gi...@apache.org> on 2023/02/02 11:03:09 UTC

[GitHub] [pulsar] nicoloboschi commented on a diff in pull request #19389: [fix][broker] Fix concurrency bug in PersistentTopicsBase#internalGetReplicatedSubscriptionStatus

nicoloboschi commented on code in PR #19389:
URL: https://github.com/apache/pulsar/pull/19389#discussion_r1094372398


##########
pulsar-broker/src/main/java/org/apache/pulsar/broker/admin/impl/PersistentTopicsBase.java:
##########
@@ -5220,7 +5220,7 @@ protected void internalGetReplicatedSubscriptionStatus(AsyncResponse asyncRespon
                     .thenAccept(partitionMetadata -> {
                         if (partitionMetadata.partitions > 0) {
                             List<CompletableFuture<Void>> futures = new ArrayList<>(partitionMetadata.partitions);
-                            Map<String, Boolean> status = new HashMap<>();
+                            Map<String, Boolean> status = new ConcurrentHashMap<>(partitionMetadata.partitions);

Review Comment:
   the initial capacity of the ConcurrentHashMap is subject to the load factor. I'd leave it with the default capacity



-- 
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: commits-unsubscribe@pulsar.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org