Csaba Ringhofer has submitted this change and it was merged. ( https://gerrit.cloudera.org/25287 )
Change subject: IMPALA-15737: Check for cancellation in hash join probe loops ...................................................................... IMPALA-15737: Check for cancellation in hash join probe loops The ProcessProbeRow* loops in PartitionedHashJoinNode only return to GetNext() when the output batch is full. For a many-to-many join whose other join conjuncts are mostly false, a single probe row can match millions of build rows while producing no output, so the loop runs for a very long time without ever observing cancellation. Cancelled fragment instances kept running on executors for hours after the coordinator had released the query, holding on to their memory (including the expression results pool addressed by IMPALA-14863) until the impalad was restarted. This change adds a cheap periodic cancellation check to the probe loops: every PROBE_CANCEL_CHECK_INTERVAL (1024) build rows visited, RuntimeState::is_cancelled() is checked and, if the query was cancelled, the loop returns with Status::CANCELLED through the existing error path of ProcessProbeBatch(). The check is always inlined and only touches a member counter between checks, so the cost per build row is a counter increment and a predicted branch. Testing: - Added test_cancel_many_to_many_join to test_conjuncts.py. It runs the same many-to-many query as test_create_cache_many_tables, waits until the probe loop has started allocating expression results, cancels the query and asserts that num-fragments-in-flight drops to zero within 30 seconds. Without the fix the fragment instances keep running until the whole probe batch is processed. - Moved @SkipIfExploration.is_not_exhaustive() from the class to the memory test so the cancellation test runs in core. Change-Id: I3f65f54588a7349d0255f94234884aea7cd5551e Reviewed-on: https://gerrit.cloudera.org/25287 Reviewed-by: Michael Smith <[email protected]> Tested-by: Impala Public Jenkins <[email protected]> Reviewed-by: Csaba Ringhofer <[email protected]> --- M be/src/exec/partitioned-hash-join-node-ir.cc M be/src/exec/partitioned-hash-join-node.h M be/src/exec/partitioned-hash-join-node.inline.h M tests/custom_cluster/test_conjuncts.py 4 files changed, 101 insertions(+), 24 deletions(-) Approvals: Michael Smith: Looks good to me, but someone else must approve Impala Public Jenkins: Verified Csaba Ringhofer: Looks good to me, approved -- To view, visit https://gerrit.cloudera.org/25287 To unsubscribe, visit https://gerrit.cloudera.org/settings Gerrit-Project: Impala-ASF Gerrit-Branch: master Gerrit-MessageType: merged Gerrit-Change-Id: I3f65f54588a7349d0255f94234884aea7cd5551e Gerrit-Change-Number: 25287 Gerrit-PatchSet: 3 Gerrit-Owner: Anonymous Coward <[email protected]> Gerrit-Reviewer: Anonymous Coward <[email protected]> Gerrit-Reviewer: Csaba Ringhofer <[email protected]> Gerrit-Reviewer: Impala Public Jenkins <[email protected]> Gerrit-Reviewer: Jason Fehr <[email protected]> Gerrit-Reviewer: Joe McDonnell <[email protected]> Gerrit-Reviewer: Michael Smith <[email protected]>
