adutra commented on code in PR #4487:
URL: https://github.com/apache/polaris/pull/4487#discussion_r3267396586
##########
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:
@visit2rahul In fact, we may want to add a comment above the `onNext()` call
explaining why it's safe to call it from concurrent threads.
--
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]