Fixes #4826 and #5128 It should be easy to use QueryMetrics from different threads for scenario like JDBC. The doc says "DefaultQueryMetrics's ownerThread should be reassigned explicitly", but it is not clear how best to do that.
I propose to make QueryMetrics thread safe so that it could be used in different threads with minimum effort. One case directly benefiting from the design is that the [yielderOpenCloseExecutor hack](#4415) could be removed. It also solves the above issues instantly. leventov has pointed out one drawback of making QueryMetrics thread-safe > making QueryMetrics thread-safe is inherently wrong thing to do. Instead of > failing with ConcurrentModificationException, multiple threads will override > metrics of each other. Nobody would understand what is going on and if the > metrics are trustworthy or not. I think it's still a valid concern. But this thread-safe approach indeed makes every other things simpler and simple code could also mean fewer bugs. @leventov @gianm @jon-wei what do you think? [ Full content available at: https://github.com/apache/incubator-druid/pull/6402 ] This message was relayed via gitbox.apache.org for [email protected]
