jihoonson commented on issue #6690: bugfix: when building materialized-view, if 
taskCount>1, may cause concurrentModificationException
URL: https://github.com/apache/incubator-druid/pull/6690#issuecomment-459907344
 
 
   @pzhdfy thanks for the patch and sorry for late review. Do you know what 
threads can read and remove at the same time? It's currently guarded by 
`taskLock`.
   
   ```java
       synchronized (taskLock) {
         for (Map.Entry<Interval, HadoopIndexTask> entry : 
runningTasks.entrySet()) {
           Optional<TaskStatus> taskStatus = 
taskStorage.getStatus(entry.getValue().getId());
           if (!taskStatus.isPresent() || !taskStatus.get().isRunnable()) {
             runningTasks.remove(entry.getKey());
             runningVersion.remove(entry.getKey());
           }
         }
         if (runningTasks.size() == maxTaskCount) {
           //if the number of running tasks reach the max task count, 
supervisor won't submit new tasks.
           return;
         }
         Pair<SortedMap<Interval, String>, Map<Interval, List<DataSegment>>> 
toBuildIntervalAndBaseSegments = checkSegments();
         SortedMap<Interval, String> sortedToBuildVersion = 
toBuildIntervalAndBaseSegments.lhs;
         Map<Interval, List<DataSegment>> baseSegments = 
toBuildIntervalAndBaseSegments.rhs;
         missInterval = sortedToBuildVersion.keySet();
         submitTasks(sortedToBuildVersion, baseSegments);
       }
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

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

Reply via email to