Hello Tim Armstrong, Dan Hecht, Impala Public Jenkins, I'd like you to reexamine a change. Please visit
http://gerrit.cloudera.org:8080/11270 to look at the new patch set (#3). Change subject: IMPALA-7422: Fix a race in QueryState::StartFInstances() ...................................................................... IMPALA-7422: Fix a race in QueryState::StartFInstances() A recent commit for IMPALA-7163 (cbc8c63) introduced a race between insertion into QueryState::fragment_map_ and the thread creation. In particular, after the aforementioned commit, the counting barrier 'instances_prepared_barrier_' is used for synchronizing callers of Cancel()/PublishFilter() and the PREPARE phase of fragment instances. Cancel()/PublishFilter() cannot proceed until all fragment instances have finished preparing; 'instances_prepared_barrier_' is updated by fragment instances once each of them is done preparing. The race is due to the fact that QueryState::StartFInstances() doesn't insert the fragment instance into 'fragment_map_' until after the fragment instance thread has been spawned. So, it's possible for the newly spawned thread to finish preparing and update the counting barrier before the insertion into 'fragment_map_' happens. It's therefore possible for PublishFilter() to have gotten unblocked before a fragment is inserted into 'fragment_map_', triggering the DCHECK() in IMPALA-7422. This change fixes the race by moving the insertion into fragment_map_ before the thread is spawned. Testing done: Exhaustive debug + release builds which previously ran into this race Change-Id: I35f2a5b0ea5143703850ffc229cec0e4294e6a3e --- M be/src/runtime/query-state.cc M be/src/runtime/query-state.h 2 files changed, 14 insertions(+), 8 deletions(-) git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/70/11270/3 -- To view, visit http://gerrit.cloudera.org:8080/11270 To unsubscribe, visit http://gerrit.cloudera.org:8080/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: newpatchset Gerrit-Change-Id: I35f2a5b0ea5143703850ffc229cec0e4294e6a3e Gerrit-Change-Number: 11270 Gerrit-PatchSet: 3 Gerrit-Owner: Michael Ho <k...@cloudera.com> Gerrit-Reviewer: Dan Hecht <dhe...@cloudera.com> Gerrit-Reviewer: Impala Public Jenkins <impala-public-jenk...@cloudera.com> Gerrit-Reviewer: Michael Ho <k...@cloudera.com> Gerrit-Reviewer: Tim Armstrong <tarmstr...@cloudera.com>