Tim Armstrong has uploaded a new patch set (#5). ( 
http://gerrit.cloudera.org:8080/15954 )

Change subject: IMPALA-9756: avoid coord cancellation/unregistration races
......................................................................

IMPALA-9756: avoid coord cancellation/unregistration races

This patch aims to make the query tear-down path more predictable.

Specifically, we want to ensure that Coordinator::ComputeQuerySummary()
finishes before the query is unregistered. Before that could happen
if cancellation occurred on a different thread from unregistration,
e.g. if async_exec_thread_ cancels the query, if an asynchronous
Cancel() RPC comes in, if it was cancelled internally because of
a timeout, or for some other reason. The race was possible for
a couple of reasons:
* The synchronization between threads happened on UpdateExecState(),
  which is called before ComputeQuerySummary().
* The unregistering thread may not call Coordinator::Cancel() if
  coord_exec_called_ is not set.

This patch addresses both problems, by adding synchronization
so that Coordinator::Cancel() blocks until ComputeQuerySummary()
finishes, and so that coord_exec_called_ is set even if
'async_exec_thread_' is cancelling the query (which ensures
that both threads call Coordinator::Cancel() and synchronize there).

This is only done on the finalizing thread. Other threads that
initiate cancellation should not block on cancellation, so that
threads cannot pile up waiting for the query.

Testing:
Added a regression test that failed before this change.

Ran exhaustive tests.

Change-Id: I62cacc06d9877d33b79a33aeb3b82195e639b5c4
---
M be/src/runtime/coordinator.cc
M be/src/runtime/coordinator.h
M be/src/service/client-request-state.cc
M be/src/service/client-request-state.h
M tests/util/cancel_util.py
5 files changed, 57 insertions(+), 16 deletions(-)


  git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/54/15954/5
--
To view, visit http://gerrit.cloudera.org:8080/15954
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings

Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I62cacc06d9877d33b79a33aeb3b82195e639b5c4
Gerrit-Change-Number: 15954
Gerrit-PatchSet: 5
Gerrit-Owner: Tim Armstrong <tarmstr...@cloudera.com>

Reply via email to