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/02/02 03:47:32 UTC
[GitHub] pzhdfy edited a comment on issue #6690: bugfix: when building
materialized-view, if taskCount>1, may cause concurrentModificationException
pzhdfy edited a comment on issue #6690: bugfix: when building materialized-view, if taskCount>1, may cause concurrentModificationException
URL: https://github.com/apache/incubator-druid/pull/6690#issuecomment-459931967
@jihoonson
Yes, this is guarded by taskLock .
This is just the WRONG USE of hashmap.
if we remove an entry from a hashmap by remove(key), while iterating it, this will throw a concurrentModificationException, even in a single thread.
![image](https://user-images.githubusercontent.com/2594619/52159446-ccf9db80-26df-11e9-9b98-fd9e735f7989.png)
ref:https://stackoverflow.com/questions/602636/concurrentmodificationexception-and-a-hashmap
```java
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());
}
}
```
----------------------------------------------------------------
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:
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