You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2019/08/19 17:39:46 UTC

[GitHub] [incubator-druid] leventov commented on a change in pull request #8323: Make sure ReferenceCountingSegment.decrement() is invoked correctly when useCache=true

leventov commented on a change in pull request #8323: Make sure ReferenceCountingSegment.decrement() is invoked correctly when useCache=true
URL: https://github.com/apache/incubator-druid/pull/8323#discussion_r315329128
 
 

 ##########
 File path: server/src/main/java/org/apache/druid/segment/realtime/appenderator/SinkQuerySegmentWalker.java
 ##########
 @@ -231,7 +231,7 @@ public SegmentDescriptor apply(final PartitionChunk<Sink> chunk)
                                                       // 1) Only use caching if data is immutable
                                                       // 2) Hydrants are not the same between replicas, make sure cache is local
                                                       if (hydrantDefinitelySwapped && cache.isLocal()) {
-                                                        QueryRunner<T> cachingRunner = new CachingQueryRunner<>(
+                                                        QueryRunner<T> cachingRunner = new CloseableCachingQueryRunner<>(
 
 Review comment:
   I think you could achieve the same effect using the following code:
   ```java
   QueryRunner<T> runner;
   // 1) Only use caching if data is immutable
   // 2) Hydrants are not the same between replicas, make sure cache is local
   if (hydrantDefinitelySwapped && cache.isLocal()) {
     runner = CachingQueryRunner<>(...);
   } else {
     runner = factory.createRunner(segment.lhs);
   }
   runner = QueryRunnerHelper.makeClosingQueryRunner(runner, segment.rhs);
   return new Pair<>(segment.lhs.getDataInterval(), runner);
   ```
   
   Thus new class `CloseableCachingQueryRunner` is not needed.
   
   Please also:
    - Rename `segment` to something like `segmentAndCloseable`
    - Reduce the level of nesting by extracting variables, such as `FunctionalIterable.create(specs).transform(...)` as `perSegmentRunners` variable.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org