BewareMyPower commented on code in PR #25187:
URL: https://github.com/apache/pulsar/pull/25187#discussion_r2752309550


##########
pulsar-metadata/src/main/java/org/apache/pulsar/metadata/impl/batching/AbstractBatchedMetadataStore.java:
##########
@@ -169,8 +177,8 @@ private void enqueue(MessagePassingQueue<MetadataOp> queue, 
MetadataOp op) {
                 internalBatchOperation(Collections.singletonList(op));
                 return;
             }
-            if (queue.size() > maxOperations && 
flushInProgress.compareAndSet(false, true)) {
-                executor.execute(this::flush);
+            if (queue.size() > maxOperations) {
+                flush();

Review Comment:
   The purpose is exactly to avoid the thread switching. `synchronized` is much 
more lightweight than `executor.execute`.



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