adutra commented on code in PR #4487:
URL: https://github.com/apache/polaris/pull/4487#discussion_r3268135323
##########
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:
Agreed, but that's for another PR imho. And I'm not sure it's realistic: if
a processor for realm ID X is being evicted, it's because it wasn't used for 1
hour; if a thread arrives while it's being evicted and attempts to retrieve a
processor for realm X, I suppose Caffeine would instantiate a new processor
(TBC).
--
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]