nandorKollar commented on code in PR #4487:
URL: https://github.com/apache/polaris/pull/4487#discussion_r3266968231


##########
runtime/service/src/main/java/org/apache/polaris/service/events/listeners/inmemory/InMemoryBufferEventListener.java:
##########
@@ -63,7 +63,13 @@ public class InMemoryBufferEventListener extends 
PolarisPersistenceEventListener
   @Override
   protected void processEvent(String realmId, PolarisEvent event) {
     var processor = Objects.requireNonNull(processors.get(realmId));
-    processor.onNext(event);
+    // Reactive Streams rule 1.3 requires onNext() to be called sequentially. 
Mutiny's
+    // UnicastProcessor is not safe for concurrent onNext() calls; concurrent 
emissions
+    // can silently drop events. Synchronize on the processor so that 
concurrent
+    // processEvent() calls for the same realm serialize on the same 
underlying processor.
+    synchronized (processor) {

Review Comment:
   It appears to me, that `UnicastProcessor#onNext` is actually a synchronized: 
https://github.com/smallrye/smallrye-mutiny/blob/main/implementation/src/main/java/io/smallrye/mutiny/operators/multi/processors/UnicastProcessor.java#L196
   
   Could you please explain what's the point of acquiring the same lock here?



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