Github user vrozov commented on a diff in the pull request:

    https://github.com/apache/drill/pull/1208#discussion_r181865979
  
    --- Diff: 
exec/java-exec/src/main/java/org/apache/drill/exec/physical/impl/partitionsender/PartitionerDecorator.java
 ---
    @@ -118,105 +127,114 @@ public PartitionOutgoingBatch 
getOutgoingBatches(int index) {
         return null;
       }
     
    -  @VisibleForTesting
    -  protected List<Partitioner> getPartitioners() {
    +  List<Partitioner> getPartitioners() {
         return partitioners;
       }
     
       /**
        * Helper to execute the different methods wrapped into same logic
        * @param iface
    -   * @throws IOException
    +   * @throws ExecutionException
        */
    -  protected void executeMethodLogic(final GeneralExecuteIface iface) 
throws IOException {
    -    if (partitioners.size() == 1 ) {
    -      // no need for threads
    -      final OperatorStats localStatsSingle = 
partitioners.get(0).getStats();
    -      localStatsSingle.clear();
    -      localStatsSingle.startProcessing();
    +  @VisibleForTesting
    +  void executeMethodLogic(final GeneralExecuteIface iface) throws 
ExecutionException {
    +    // To simulate interruption of main fragment thread and interrupting 
the partition threads, create a
    +    // CountDownInject latch. Partitioner threads await on the latch and 
main fragment thread counts down or
    +    // interrupts waiting threads. This makes sure that we are actually 
interrupting the blocked partitioner threads.
    +    try (CountDownLatchInjection testCountDownLatch = 
injector.getLatch(context.getExecutionControls(), "partitioner-sender-latch")) {
    --- End diff --
    
    The `testCountDownLatch` is used only for testing and initialized to 1. The 
wait is on `count`. 


---

Reply via email to