FrankChen021 commented on code in PR #19548:
URL: https://github.com/apache/druid/pull/19548#discussion_r3380363903


##########
server/src/main/java/org/apache/druid/segment/join/LookupJoinableFactory.java:
##########
@@ -57,9 +61,20 @@ public Optional<Joinable> build(final DataSource dataSource, 
final JoinCondition
     if (condition.canHashJoin()) {
       final String lookupName = lookupDataSource.getLookupName();
       return lookupProvider.get(lookupName)
-                           .map(c -> 
LookupJoinable.wrap(c.getLookupExtractorFactory().get()));
+                           .map(this::buildLookupJoinable);
     } else {
       return Optional.empty();
     }
   }
+
+  private LookupJoinable buildLookupJoinable(final 
LookupExtractorFactoryContainer container)
+  {
+    final LookupExtractorFactory lookupExtractorFactory = 
container.getLookupExtractorFactory();
+    final Optional<RetainedLookupExtractor> retainedLookupExtractor =
+        lookupExtractorFactory.acquireRetainedLookupExtractor();

Review Comment:
   [P1] Close retained lookup joinables deterministically
   
   After the incremental change, buildLookupJoinable acquires a 
RetainedLookupExtractor once and stores it in the joinable, but 
LookupJoinable.acquireReference() now returns only a no-op closeable. 
JoinDataSource.createSegmentMapFunction has no close hook for the captured 
joinable list, so HashJoinSegment.close() never closes this retained extractor; 
it is released only by the Cleaner after GC. For cached namespace lookups, one 
retained retired version is enough to make CacheScheduler skip further 
refreshes with the default maxRetiredCacheEntries=1, so lookup-join queries can 
stall later lookup updates until GC or timeout. Please attach the retained 
handle to an explicit query/joinable lifecycle or use a real ref-counted 
closeable instead of the no-op reference.



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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to