You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@impala.apache.org by "Quanlong Huang (Code Review)" <ge...@cloudera.org> on 2020/08/11 11:45:36 UTC
[Impala-ASF-CR] IMPALA-9225: Add query option for retryable queries to spool all results before returning any to the client
Quanlong Huang has uploaded this change for review. ( http://gerrit.cloudera.org:8080/16323
Change subject: IMPALA-9225: Add query option for retryable queries to spool all results before returning any to the client
......................................................................
IMPALA-9225: Add query option for retryable queries to spool all results before returning any to the client
If we have returned any results to the client in the original query,
query retry will be skipped to avoid incorrect results. This patch adds
a query option, safely_retry_queries, for retryable queries to spool all
results before returning any to the client. It defaults to true. If all
query results cannot be contained in the allocated result spooling
space, we’ll return results and thus disabled query retry on the query.
Setting safely_retry_queries to false will fallback to the original
behavior - client can fetch results when any of them are ready. So we
explicitly set it to false in the retried query since it won’t be
retried anymore.
For non retryable queries, the safely_retry_queries option takes no
effects.
Tests:
- Add a test to verify that a retryable query will spool all its results
when safely_retry_queries is true (no matter whether
spool_query_results is true or false).
- Add a test to verify that query retry succeeds when a retryable query
is spooling its results (safely_retry_queries=true).
- Add a test to verify that the retried query won’t implicitly enable
result spooling.
- Add a test to verify that the original query can be canceled
correctly. We need this because the added logics for
safely_retry_queries are related to a condition variable that could
affect the cancellation code path.
- Run test_query_retries.py in my dev box.
Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
---
M be/src/exec/blocking-plan-root-sink.cc
M be/src/exec/blocking-plan-root-sink.h
M be/src/exec/buffered-plan-root-sink.cc
M be/src/exec/buffered-plan-root-sink.h
M be/src/exec/data-sink.h
M be/src/exec/hbase-table-sink.cc
M be/src/exec/hbase-table-sink.h
M be/src/exec/hdfs-table-sink.cc
M be/src/exec/hdfs-table-sink.h
M be/src/exec/kudu-table-sink.cc
M be/src/exec/kudu-table-sink.h
M be/src/exec/nested-loop-join-builder.cc
M be/src/exec/nested-loop-join-builder.h
M be/src/exec/partitioned-hash-join-builder.cc
M be/src/exec/partitioned-hash-join-builder.h
M be/src/exec/plan-root-sink.cc
M be/src/exec/plan-root-sink.h
M be/src/runtime/fragment-instance-state.cc
M be/src/runtime/krpc-data-stream-sender.cc
M be/src/runtime/krpc-data-stream-sender.h
M be/src/runtime/query-driver.cc
M be/src/service/query-options.cc
M be/src/service/query-options.h
M common/thrift/ImpalaInternalService.thrift
M common/thrift/ImpalaService.thrift
M fe/src/main/java/org/apache/impala/planner/PlanRootSink.java
M tests/common/impala_test_suite.py
M tests/custom_cluster/test_query_retries.py
28 files changed, 228 insertions(+), 29 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/23/16323/1
--
To view, visit http://gerrit.cloudera.org:8080/16323
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
Gerrit-Change-Number: 16323
Gerrit-PatchSet: 1
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
[Impala-ASF-CR] IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/16323 )
Change subject: IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
......................................................................
Patch Set 9: Code-Review+2
--
To view, visit http://gerrit.cloudera.org:8080/16323
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
Gerrit-Change-Number: 16323
Gerrit-PatchSet: 9
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Sahil Takiar <st...@cloudera.com>
Gerrit-Reviewer: Thomas Tauber-Marshall <tm...@cloudera.com>
Gerrit-Comment-Date: Tue, 25 Aug 2020 23:04:29 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-9225: Add query option for retryable queries to spool all results before returning any to the client
Posted by "Quanlong Huang (Code Review)" <ge...@cloudera.org>.
Hello Thomas Tauber-Marshall, Sahil Takiar, Impala Public Jenkins,
I'd like you to reexamine a change. Please visit
http://gerrit.cloudera.org:8080/16323
to look at the new patch set (#3).
Change subject: IMPALA-9225: Add query option for retryable queries to spool all results before returning any to the client
......................................................................
IMPALA-9225: Add query option for retryable queries to spool all results before returning any to the client
If we have returned any results to the client in the original query,
query retry will be skipped to avoid incorrect results. This patch adds
a query option, safely_retry_queries, for retryable queries to spool all
results before returning any to the client. It defaults to true. If all
query results cannot be contained in the allocated result spooling
space, we'll return results and thus disabled query retry on the query.
Setting safely_retry_queries to false will fallback to the original
behavior - client can fetch results when any of them are ready. So we
explicitly set it to false in the retried query since it won't be
retried anymore. For non retryable queries, the safely_retry_queries
option takes no effects.
To implement this, this patch defers the time when a retryable query
runs into the FINISHED state (rows available). If safely_retry_queries
is true, results spooling will be implicitly enabled for a retryable
query. The coordinator fragment instance will only update its
opened_promise_ when the sender is blocked by a full queue or all
results are spooled, or when any errors happen. The DataSink::Send()
interface is extended to pass in a reference of the promise. So the sink
can update it to signal the fetch() request which is waiting for the
opened_promise_ to continue and actually fetch results.
Tests:
- Add a test to verify that a retryable query will spool all its results
when safely_retry_queries is true (no matter whether
spool_query_results is true or false).
- Add a test to verify that query retry succeeds when a retryable query
is spooling its results (safely_retry_queries=true).
- Add a test to verify that the retried query won't implicitly enable
result spooling.
- Add a test to verify that the original query can be canceled
correctly. We need this because the added logics for
safely_retry_queries are related to a condition variable that could
affect the cancellation code path.
- Add a test to verify results will be returned when all of them can't
fit into the result spooling space, and query retry will be skipped.
- Run CORE tests.
Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
---
M be/src/exec/blocking-plan-root-sink.cc
M be/src/exec/blocking-plan-root-sink.h
M be/src/exec/buffered-plan-root-sink.cc
M be/src/exec/buffered-plan-root-sink.h
M be/src/exec/data-sink.h
M be/src/exec/hbase-table-sink.cc
M be/src/exec/hbase-table-sink.h
M be/src/exec/hdfs-table-sink.cc
M be/src/exec/hdfs-table-sink.h
M be/src/exec/kudu-table-sink.cc
M be/src/exec/kudu-table-sink.h
M be/src/exec/nested-loop-join-builder.cc
M be/src/exec/nested-loop-join-builder.h
M be/src/exec/partitioned-hash-join-builder.cc
M be/src/exec/partitioned-hash-join-builder.h
M be/src/exec/plan-root-sink.cc
M be/src/exec/plan-root-sink.h
M be/src/runtime/fragment-instance-state.cc
M be/src/runtime/krpc-data-stream-sender.cc
M be/src/runtime/krpc-data-stream-sender.h
M be/src/runtime/query-driver.cc
M be/src/runtime/spillable-row-batch-queue.h
M be/src/service/query-options.cc
M be/src/service/query-options.h
M common/thrift/ImpalaInternalService.thrift
M common/thrift/ImpalaService.thrift
M fe/src/main/java/org/apache/impala/planner/PlanRootSink.java
M tests/common/impala_test_suite.py
M tests/custom_cluster/test_query_retries.py
29 files changed, 291 insertions(+), 30 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/23/16323/3
--
To view, visit http://gerrit.cloudera.org:8080/16323
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
Gerrit-Change-Number: 16323
Gerrit-PatchSet: 3
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Sahil Takiar <st...@cloudera.com>
Gerrit-Reviewer: Thomas Tauber-Marshall <tm...@cloudera.com>
[Impala-ASF-CR] IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/16323 )
Change subject: IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
......................................................................
Patch Set 6:
Build Successful
https://jenkins.impala.io/job/gerrit-code-review-checks/6925/ : Initial code review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun to run full precommit tests.
--
To view, visit http://gerrit.cloudera.org:8080/16323
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
Gerrit-Change-Number: 16323
Gerrit-PatchSet: 6
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Sahil Takiar <st...@cloudera.com>
Gerrit-Reviewer: Thomas Tauber-Marshall <tm...@cloudera.com>
Gerrit-Comment-Date: Fri, 14 Aug 2020 03:28:17 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/16323 )
Change subject: IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
......................................................................
Patch Set 5:
Build Successful
https://jenkins.impala.io/job/gerrit-code-review-checks/6924/ : Initial code review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun to run full precommit tests.
--
To view, visit http://gerrit.cloudera.org:8080/16323
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
Gerrit-Change-Number: 16323
Gerrit-PatchSet: 5
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Sahil Takiar <st...@cloudera.com>
Gerrit-Reviewer: Thomas Tauber-Marshall <tm...@cloudera.com>
Gerrit-Comment-Date: Fri, 14 Aug 2020 03:24:14 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-9225: Add query option for retryable queries to spool all results before returning any to the client
Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/16323 )
Change subject: IMPALA-9225: Add query option for retryable queries to spool all results before returning any to the client
......................................................................
Patch Set 1:
Build Successful
https://jenkins.impala.io/job/gerrit-code-review-checks/6874/ : Initial code review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun to run full precommit tests.
--
To view, visit http://gerrit.cloudera.org:8080/16323
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
Gerrit-Change-Number: 16323
Gerrit-PatchSet: 1
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Comment-Date: Tue, 11 Aug 2020 12:05:01 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
Posted by "Quanlong Huang (Code Review)" <ge...@cloudera.org>.
Quanlong Huang has posted comments on this change. ( http://gerrit.cloudera.org:8080/16323 )
Change subject: IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
......................................................................
Patch Set 7:
(10 comments)
Thanks for the constructive comments, Sahil! Refactored the patch.
http://gerrit.cloudera.org:8080/#/c/16323/6//COMMIT_MSG
Commit Message:
http://gerrit.cloudera.org:8080/#/c/16323/6//COMMIT_MSG@20
PS6, Line 20: eries that don't enable resul
> might be worth mentioning that if retry_failed_queries = false or if spool_
Done
http://gerrit.cloudera.org:8080/#/c/16323/6//COMMIT_MSG@23
PS6, Line 23: To implement this, this patch defers the time when results are ready to
: be fetched. By default, the
> I think this merits a bit more clarification. in the normal case, a query i
Good explanation. Done.
http://gerrit.cloudera.org:8080/#/c/16323/6//COMMIT_MSG@25
PS6, Line 25: y, when spool_query_results and
: spool_all_results_
> I think this feature should also be dependent on result spooling being enab
Yeah, I hesitated for some time in this... Currently, retry_failed_queries and spool_query_results are both false by default. If this feature depends on these two options. It needs 3 query options to turn it on.
At the first patch set, the new option name is safely_retry_queries so it can hide the details about the implementation. Since its name is more detailed now, I think it's ok to make this feature depend on both the retry_failed_queries and spool_query_results options.
http://gerrit.cloudera.org:8080/#/c/16323/6/be/src/exec/buffered-plan-root-sink.cc
File be/src/exec/buffered-plan-root-sink.cc:
http://gerrit.cloudera.org:8080/#/c/16323/6/be/src/exec/buffered-plan-root-sink.cc@82
PS6, Line 82: discard_result(all_results_spooled_.Set(TErrorCode::RESULTS_SPOOLING_QUEUE_FULL));
: }
: batch_queue_has_capacity_.Wait(l);
: }
> it would be nice if this log statement was moved elsewhere (perhaps the coo
Good point! Let me refactor this.
http://gerrit.cloudera.org:8080/#/c/16323/6/be/src/exec/buffered-plan-root-sink.cc@87
PS6, Line 87:
> so I think what is happening here is that if the queue is full, and no more
Yeah, you are right. I think the var name is ok since our purpose is to spool all results. It can store errors that prevent us to spool all results, e.g. queue is full, cancellation or node failures. To make this clear, we can set an error indicating the queue is full instead of the current ok status. Coordinator can log the above message after seeing the queue is full.
http://gerrit.cloudera.org:8080/#/c/16323/6/be/src/runtime/coordinator.cc
File be/src/runtime/coordinator.cc:
http://gerrit.cloudera.org:8080/#/c/16323/6/be/src/runtime/coordinator.cc@803
PS6, Line 803: RETURN_IF_ERROR(UpdateExecState(coord_instance_->WaitForOpen(),
> nit: the typical pattern is to wrap the call to `UpdateExecState` in `RETUR
Done
http://gerrit.cloudera.org:8080/#/c/16323/6/be/src/runtime/fragment-instance-state.cc
File be/src/runtime/fragment-instance-state.cc:
http://gerrit.cloudera.org:8080/#/c/16323/6/be/src/runtime/fragment-instance-state.cc@91
PS6, Line 91: goto done;
> nit: delete?
Oops... Done
http://gerrit.cloudera.org:8080/#/c/16323/6/be/src/runtime/fragment-instance-state.cc@100
PS6, Line 100:
> nit: delete?
Done
http://gerrit.cloudera.org:8080/#/c/16323/6/be/src/runtime/fragment-instance-state.cc@112
PS6, Line 112: Close();
> can you just do this in the FlushFinal method of BufferedPlanRootSink? I do
I think we need this when ExecInternal() encounters any errors (e.g. errors in calling exec_tree_->GetNext()). For these cases, FlushFinal won't be called. test_original_query_cancel in test_query_retries.py is the test coverage for this. Without this, the original query can't be cancelled.
However, I realized that this can be moved to the Cancel() and Close() methods of BufferedPlanRootSink to handle error cases. Refactored this.
http://gerrit.cloudera.org:8080/#/c/16323/6/be/src/runtime/fragment-instance-state.cc@438
PS6, Line 438: }
> same comment as above I think
Yes, moved this into BufferedPlanRootSink::FlushFinal().
--
To view, visit http://gerrit.cloudera.org:8080/16323
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
Gerrit-Change-Number: 16323
Gerrit-PatchSet: 7
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Sahil Takiar <st...@cloudera.com>
Gerrit-Reviewer: Thomas Tauber-Marshall <tm...@cloudera.com>
Gerrit-Comment-Date: Mon, 24 Aug 2020 08:49:47 +0000
Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
Posted by "Quanlong Huang (Code Review)" <ge...@cloudera.org>.
Quanlong Huang has posted comments on this change. ( http://gerrit.cloudera.org:8080/16323 )
Change subject: IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
......................................................................
Patch Set 8:
(3 comments)
Thanks for the review! Revised the patch.
http://gerrit.cloudera.org:8080/#/c/16323/7/be/src/runtime/coordinator.cc
File be/src/runtime/coordinator.cc:
http://gerrit.cloudera.org:8080/#/c/16323/7/be/src/runtime/coordinator.cc@811
PS7, Line 811: if (sink->WaitForAllResultsSpooled()) {
: VLOG_QUERY << "Cannot spool all results in the alloc
> maybe WaitForAllResultsSpooled should still return a Status, but if the que
Sure. I think we just need a binary result to log whether the batch queue is full in BufferedPlanRootSink. Change this to boolean.
http://gerrit.cloudera.org:8080/#/c/16323/7/be/src/runtime/coordinator.cc@813
PS7, Line 813: " Query retry will be skipped if any re
> this will log into the client logs, right? e.g. impala-shell output? I thin
Yeah, impala-shell will output a warning for this. Changed this to VLOG_QUERY.
http://gerrit.cloudera.org:8080/#/c/16323/7/common/thrift/ImpalaService.thrift
File common/thrift/ImpalaService.thrift:
http://gerrit.cloudera.org:8080/#/c/16323/7/common/thrift/ImpalaService.thrift@566
PS7, Line 566: Set it to false then clients can fetch results imme
> consider rephrasing this. its not really unsafe, it just means that queries
Done
--
To view, visit http://gerrit.cloudera.org:8080/16323
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
Gerrit-Change-Number: 16323
Gerrit-PatchSet: 8
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Sahil Takiar <st...@cloudera.com>
Gerrit-Reviewer: Thomas Tauber-Marshall <tm...@cloudera.com>
Gerrit-Comment-Date: Tue, 25 Aug 2020 09:50:52 +0000
Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-9225: Add query option for retryable queries to spool all results before returning any to the client
Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/16323 )
Change subject: IMPALA-9225: Add query option for retryable queries to spool all results before returning any to the client
......................................................................
Patch Set 3:
Build Successful
https://jenkins.impala.io/job/gerrit-code-review-checks/6885/ : Initial code review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun to run full precommit tests.
--
To view, visit http://gerrit.cloudera.org:8080/16323
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
Gerrit-Change-Number: 16323
Gerrit-PatchSet: 3
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Sahil Takiar <st...@cloudera.com>
Gerrit-Reviewer: Thomas Tauber-Marshall <tm...@cloudera.com>
Gerrit-Comment-Date: Wed, 12 Aug 2020 08:31:44 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/16323 )
Change subject: IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
......................................................................
Patch Set 4:
Build Successful
https://jenkins.impala.io/job/gerrit-code-review-checks/6907/ : Initial code review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun to run full precommit tests.
--
To view, visit http://gerrit.cloudera.org:8080/16323
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
Gerrit-Change-Number: 16323
Gerrit-PatchSet: 4
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Sahil Takiar <st...@cloudera.com>
Gerrit-Reviewer: Thomas Tauber-Marshall <tm...@cloudera.com>
Gerrit-Comment-Date: Thu, 13 Aug 2020 13:38:09 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
Posted by "Quanlong Huang (Code Review)" <ge...@cloudera.org>.
Hello Thomas Tauber-Marshall, Sahil Takiar, Impala Public Jenkins,
I'd like you to reexamine a change. Please visit
http://gerrit.cloudera.org:8080/16323
to look at the new patch set (#5).
Change subject: IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
......................................................................
IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
If we have returned any results to the client in the original query,
query retry will be skipped to avoid incorrect results. This patch adds
a query option, spool_all_results_for_retries, for retryable queries to
spool all results before returning any to the client. It defaults to
true. If all query results cannot be contained in the allocated result
spooling space, we'll return results and thus disabled query retry on
the query.
Setting spool_all_results_for_retries to false will fallback to the
original behavior - client can fetch results when any of them are ready.
So we explicitly set it to false in the retried query since it won't be
retried. For non retryable queries, the spool_all_results_for_retries
option takes no effects.
To implement this, this patch defers the time when a retryable query
runs into the FINISHED state (rows available). If
spool_all_results_for_retries is true, results spooling will be
implicitly enabled for a retryable query. The coordinator will wait
until results of BufferedPlanRootSink are ready after waiting for the
root fragment instance's Open() finishes. BufferedPlanRootSink sets the
results ready signal in its Send() method when the batch queue is first
full. BufferedPlanRootSink also exposes a method to set the signal
outside when all batches are sent to the sink or any errors happen.
Tests:
- Add a test to verify that a retryable query will spool all its results
when spool_all_results_for_retries is true (no matter whether
spool_query_results is true or false).
- Add a test to verify that query retry succeeds when a retryable query
is spooling its results (spool_all_results_for_retries=true).
- Add a test to verify that the retried query won't implicitly enable
result spooling.
- Add a test to verify that the original query can be canceled
correctly. We need this because the added logics for
spool_all_results_for_retries are related to a condition variable that
could affect the cancellation code path.
- Add a test to verify results will be returned when all of them can't
fit into the result spooling space, and query retry will be skipped.
Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
---
M be/src/exec/buffered-plan-root-sink.cc
M be/src/exec/buffered-plan-root-sink.h
M be/src/exec/plan-root-sink.cc
M be/src/runtime/coordinator.cc
M be/src/runtime/fragment-instance-state.cc
M be/src/runtime/query-driver.cc
M be/src/runtime/spillable-row-batch-queue.h
M be/src/service/query-options.cc
M be/src/service/query-options.h
M common/thrift/ImpalaInternalService.thrift
M common/thrift/ImpalaService.thrift
M fe/src/main/java/org/apache/impala/planner/PlanRootSink.java
M tests/common/impala_test_suite.py
M tests/custom_cluster/test_query_retries.py
14 files changed, 278 insertions(+), 10 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/23/16323/5
--
To view, visit http://gerrit.cloudera.org:8080/16323
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
Gerrit-Change-Number: 16323
Gerrit-PatchSet: 5
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Sahil Takiar <st...@cloudera.com>
Gerrit-Reviewer: Thomas Tauber-Marshall <tm...@cloudera.com>
[Impala-ASF-CR] IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/16323 )
Change subject: IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
......................................................................
Patch Set 10: Code-Review+2
--
To view, visit http://gerrit.cloudera.org:8080/16323
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
Gerrit-Change-Number: 16323
Gerrit-PatchSet: 10
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Sahil Takiar <st...@cloudera.com>
Gerrit-Reviewer: Thomas Tauber-Marshall <tm...@cloudera.com>
Gerrit-Comment-Date: Wed, 26 Aug 2020 22:58:22 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
Posted by "Quanlong Huang (Code Review)" <ge...@cloudera.org>.
Hello Thomas Tauber-Marshall, Sahil Takiar, Impala Public Jenkins,
I'd like you to reexamine a change. Please visit
http://gerrit.cloudera.org:8080/16323
to look at the new patch set (#4).
Change subject: IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
......................................................................
IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
If we have returned any results to the client in the original query,
query retry will be skipped to avoid incorrect results. This patch adds
a query option, spool_all_results_for_retries, for retryable queries to
spool all results before returning any to the client. It defaults to
true. If all query results cannot be contained in the allocated result
spooling space, we'll return results and thus disabled query retry on
the query.
Setting spool_all_results_for_retries to false will fallback to the
original behavior - client can fetch results when any of them are ready.
So we explicitly set it to false in the retried query since it won't be
retried. For non retryable queries, the spool_all_results_for_retries
option takes no effects.
To implement this, this patch defers the time when a retryable query
runs into the FINISHED state (rows available). If
spool_all_results_for_retries is true, results spooling will be
implicitly enabled for a retryable query. The coordinator will wait
until results of BufferedPlanRootSink are ready after waiting for the
root fragment instance's Open() finishes. BufferedPlanRootSink sets the
results ready signal in its Send() method when the batch queue is first
full. BufferedPlanRootSink also exposes a method to set the signal
outside when all batches are sent to the sink or any errors happen.
Tests:
- Add a test to verify that a retryable query will spool all its results
when spool_all_results_for_retries is true (no matter whether
spool_query_results is true or false).
- Add a test to verify that query retry succeeds when a retryable query
is spooling its results (spool_all_results_for_retries=true).
- Add a test to verify that the retried query won't implicitly enable
result spooling.
- Add a test to verify that the original query can be canceled
correctly. We need this because the added logics for
spool_all_results_for_retries are related to a condition variable that
could affect the cancellation code path.
- Add a test to verify results will be returned when all of them can't
fit into the result spooling space, and query retry will be skipped.
Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
---
M be/src/exec/buffered-plan-root-sink.cc
M be/src/exec/buffered-plan-root-sink.h
M be/src/exec/plan-root-sink.cc
M be/src/runtime/coordinator.cc
M be/src/runtime/fragment-instance-state.cc
M be/src/runtime/query-driver.cc
M be/src/runtime/spillable-row-batch-queue.h
M be/src/service/query-options.cc
M be/src/service/query-options.h
M common/thrift/ImpalaInternalService.thrift
M common/thrift/ImpalaService.thrift
M fe/src/main/java/org/apache/impala/planner/PlanRootSink.java
M tests/common/impala_test_suite.py
M tests/custom_cluster/test_query_retries.py
14 files changed, 270 insertions(+), 10 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/23/16323/4
--
To view, visit http://gerrit.cloudera.org:8080/16323
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
Gerrit-Change-Number: 16323
Gerrit-PatchSet: 4
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Sahil Takiar <st...@cloudera.com>
Gerrit-Reviewer: Thomas Tauber-Marshall <tm...@cloudera.com>
[Impala-ASF-CR] IMPALA-9225: Add query option for retryable queries to spool all results before returning any to the client
Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/16323 )
Change subject: IMPALA-9225: Add query option for retryable queries to spool all results before returning any to the client
......................................................................
Patch Set 3: Verified-1
Build failed: https://jenkins.impala.io/job/gerrit-verify-dryrun/6273/
--
To view, visit http://gerrit.cloudera.org:8080/16323
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
Gerrit-Change-Number: 16323
Gerrit-PatchSet: 3
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Sahil Takiar <st...@cloudera.com>
Gerrit-Reviewer: Thomas Tauber-Marshall <tm...@cloudera.com>
Gerrit-Comment-Date: Wed, 12 Aug 2020 13:14:04 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/16323 )
Change subject: IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
......................................................................
Patch Set 9: Verified-1
Build failed: https://jenkins.impala.io/job/gerrit-verify-dryrun/6331/
--
To view, visit http://gerrit.cloudera.org:8080/16323
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
Gerrit-Change-Number: 16323
Gerrit-PatchSet: 9
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Sahil Takiar <st...@cloudera.com>
Gerrit-Reviewer: Thomas Tauber-Marshall <tm...@cloudera.com>
Gerrit-Comment-Date: Wed, 26 Aug 2020 02:58:19 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
Posted by "Sahil Takiar (Code Review)" <ge...@cloudera.org>.
Sahil Takiar has posted comments on this change. ( http://gerrit.cloudera.org:8080/16323 )
Change subject: IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
......................................................................
Patch Set 7: Code-Review+1
(4 comments)
overall, lgtm. a few more comments, but nothing major. can upgrade to +2 after resolving remaining comments.
http://gerrit.cloudera.org:8080/#/c/16323/6//COMMIT_MSG
Commit Message:
http://gerrit.cloudera.org:8080/#/c/16323/6//COMMIT_MSG@25
PS6, Line 25: y, when spool_query_results and
: spool_all_results_
> Yeah, I hesitated for some time in this... Currently, retry_failed_queries
Sounds good. Yeah we probably want retry_failed_queries and spool_query_results both enabled by default eventually.
http://gerrit.cloudera.org:8080/#/c/16323/7/be/src/runtime/coordinator.cc
File be/src/runtime/coordinator.cc:
http://gerrit.cloudera.org:8080/#/c/16323/7/be/src/runtime/coordinator.cc@811
PS7, Line 811: TErrorCode::type code = sink->WaitForAllResultsSpooled();
: if (code == TErrorCode::RESULTS_SPOOLING_QUEUE_FULL) {
maybe WaitForAllResultsSpooled should still return a Status, but if the queue is full and all results cannot be spooled then it returns Status::ERROR?
I guess I don't know if the TErrorCode::RESULTS_SPOOLING_QUEUE_FULL is really necessary? might be easier to just use Status objects.
http://gerrit.cloudera.org:8080/#/c/16323/7/be/src/runtime/coordinator.cc@813
PS7, Line 813: coord_instance_->runtime_state()->LogError(
this will log into the client logs, right? e.g. impala-shell output? I think that might be too verbose and end up being confusing for users. most of the time this won't make a difference since retries are only really needed occasionally. VLOG_QUERY is probably good enough.
http://gerrit.cloudera.org:8080/#/c/16323/7/common/thrift/ImpalaService.thrift
File common/thrift/ImpalaService.thrift:
http://gerrit.cloudera.org:8080/#/c/16323/7/common/thrift/ImpalaService.thrift@566
PS7, Line 566: Set it to false to fallback to the unsafe behavior,
consider rephrasing this. its not really unsafe, it just means that queries might not be retried.
--
To view, visit http://gerrit.cloudera.org:8080/16323
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
Gerrit-Change-Number: 16323
Gerrit-PatchSet: 7
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Sahil Takiar <st...@cloudera.com>
Gerrit-Reviewer: Thomas Tauber-Marshall <tm...@cloudera.com>
Gerrit-Comment-Date: Mon, 24 Aug 2020 21:13:55 +0000
Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has submitted this change and it was merged. ( http://gerrit.cloudera.org:8080/16323 )
Change subject: IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
......................................................................
IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
If we have returned any results to the client in the original query,
query retry will be skipped to avoid incorrect results. This patch adds
a query option, spool_all_results_for_retries, for retryable queries to
spool all results before returning any to the client. It defaults to
true. If all query results cannot be contained in the allocated result
spooling space, we'll return results and thus disabled query retry on
the query.
Setting spool_all_results_for_retries to false will fallback to the
original behavior - client can fetch results when any of them are ready.
So we explicitly set it to false in the retried query since it won't be
retried. For non retryable queries or queries that don't enable results
spooling, the spool_all_results_for_retries option takes no effect.
To implement this, this patch defers the time when results are ready to
be fetched. By default, the “rows available” event happens when any
results are ready. For a retryable query, when spool_query_results and
spool_all_results_for_retries are both true, the “rows available” event
happens after all results are spooled or any errors stopping us to do
so, e.g. batch queue is full, cancellation or failures. After waiting
for the root fragment instance’s Open() finishes, the coordinator will
wait until results of BufferedPlanRootSink are ready.
BufferedPlanRootSink sets the results ready signal in its Send(),
Close(), Cancel(), FlushFinal() methods.
Tests:
- Add a test to verify that a retryable query will spool all its results
when results spooling and spool_all_results_for_retries are enabled.
- Add a test to verify that query retry succeeds when a retryable query
is still spooling its results (spool_all_results_for_retries=true).
- Add a test to verify that the retried query won't spool all results
even when results spooling and spool_all_results_for_retries are
enabled in the original query.
- Add a test to verify that the original query can be canceled
correctly. We need this because the added logics for
spool_all_results_for_retries are related to the cancellation code
path.
- Add a test to verify results will be returned when all of them can't
fit into the result spooling space, and query retry will be skipped.
Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
Reviewed-on: http://gerrit.cloudera.org:8080/16323
Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>
---
M be/src/exec/buffered-plan-root-sink.cc
M be/src/exec/buffered-plan-root-sink.h
M be/src/runtime/coordinator.cc
M be/src/runtime/query-driver.cc
M be/src/runtime/spillable-row-batch-queue.h
M be/src/service/query-options.cc
M be/src/service/query-options.h
M common/thrift/ImpalaInternalService.thrift
M common/thrift/ImpalaService.thrift
M tests/common/impala_test_suite.py
M tests/custom_cluster/test_query_retries.py
11 files changed, 244 insertions(+), 8 deletions(-)
Approvals:
Impala Public Jenkins: Looks good to me, approved; Verified
--
To view, visit http://gerrit.cloudera.org:8080/16323
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
Gerrit-Change-Number: 16323
Gerrit-PatchSet: 11
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Sahil Takiar <st...@cloudera.com>
Gerrit-Reviewer: Thomas Tauber-Marshall <tm...@cloudera.com>
[Impala-ASF-CR] IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/16323 )
Change subject: IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
......................................................................
Patch Set 7:
Build Successful
https://jenkins.impala.io/job/gerrit-code-review-checks/6966/ : Initial code review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun to run full precommit tests.
--
To view, visit http://gerrit.cloudera.org:8080/16323
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
Gerrit-Change-Number: 16323
Gerrit-PatchSet: 7
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Sahil Takiar <st...@cloudera.com>
Gerrit-Reviewer: Thomas Tauber-Marshall <tm...@cloudera.com>
Gerrit-Comment-Date: Mon, 24 Aug 2020 09:08:55 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-9225: Add query option for retryable queries to spool all results before returning any to the client
Posted by "Sahil Takiar (Code Review)" <ge...@cloudera.org>.
Sahil Takiar has posted comments on this change. ( http://gerrit.cloudera.org:8080/16323 )
Change subject: IMPALA-9225: Add query option for retryable queries to spool all results before returning any to the client
......................................................................
Patch Set 3:
(6 comments)
http://gerrit.cloudera.org:8080/#/c/16323/3//COMMIT_MSG
Commit Message:
http://gerrit.cloudera.org:8080/#/c/16323/3//COMMIT_MSG@25
PS3, Line 25: The coordinator fragment instance will only update its
: opened_promise_ when the sender is blocked by a full queue or all
: results are spooled, or when any errors happen. The DataSink::Send()
: interface is extended to pass in a reference of the promise. So the sink
: can update it to signal the fetch() request which is waiting for the
: opened_promise_ to continue and actually fetch results.
conceptually I think this approach makes sense, but I think it would make more sense to move some of the code around. see my other comments, but I think we probably don't want to change what opened_promise_ means. I think this change will effectively change the meaning of opened_promise_. instead of being set when Open() completes, it will be set when all results are spooled, which would probably be after Exec() completes. which is a bit confusing.
conceptually, I think you the approach is correct. you basically want Coordinator::Wait() to block until all results have been spooled, which make sense. I just think we can move the logic directly in Coordinator::Wait() because it will be cleaner.
http://gerrit.cloudera.org:8080/#/c/16323/3/be/src/exec/data-sink.h
File be/src/exec/data-sink.h:
http://gerrit.cloudera.org:8080/#/c/16323/3/be/src/exec/data-sink.h@136
PS3, Line 136: virtual Status Send(RuntimeState* state, RowBatch* batch,
: Promise<Status>* sender_blocked=nullptr) = 0;
See my comment in fragment-instance-state.cc, but I think this can be moved into the BufferedPlanRootSink class.
You might have to do a cast in from the PlanRootSink to BufferedPlanRootSink, but that should be fine. BufferedPlanRootSink is always used when result spooling is enabled.
It doesn't look like this used anywhere else but BufferedPlanRootSink anyway.
You probably can't add it to the Send method in BufferedPlanRootSink since it inherits from DataSink::Send, so you might just have to add a new public method, something like IsBufferFull().
http://gerrit.cloudera.org:8080/#/c/16323/3/be/src/runtime/fragment-instance-state.cc
File be/src/runtime/fragment-instance-state.cc:
http://gerrit.cloudera.org:8080/#/c/16323/3/be/src/runtime/fragment-instance-state.cc@430
PS3, Line 430: Promise<Status>* sender_blocked_promise = !opened_promise_.IsSet() ?
: &opened_promise_ : nullptr;
: RETURN_IF_ERROR(sink_->Send(runtime_state_, row_batch_.get(),
: sender_blocked_promise));
I think it might make more sense to move all this logic into coordinator.cc
There are a few benefits:
(1) Most of this logic is really Coordinator specific. The opened_promised_ is actually only used by the Coordinator in Coordinator::Wait()
(2) The Coordinator has a pointer to the PlanRootSink (see PlanRootSink* coord_sink_). So you can potentially avoid making the change to the Send() method in DataSink, which thus agains all the re-factoring to unrelated classes like KuduTableSink
http://gerrit.cloudera.org:8080/#/c/16323/3/be/src/runtime/query-driver.cc
File be/src/runtime/query-driver.cc:
http://gerrit.cloudera.org:8080/#/c/16323/3/be/src/runtime/query-driver.cc@312
PS3, Line 312: if (query_ctx.client_request.query_options.safely_retry_queries) {
: // Reset this flag in the retry query since we won't retry again, so results can be
: // returned immediately.
: query_ctx.client_request.query_options.__set_safely_retry_queries(false);
: VLOG_QUERY << "Unset safely_retry_queries when retrying query "
: << PrintId(client_request_state_->query_id());
yeah this makes sense, nice catch
http://gerrit.cloudera.org:8080/#/c/16323/3/be/src/runtime/spillable-row-batch-queue.h
File be/src/runtime/spillable-row-batch-queue.h:
http://gerrit.cloudera.org:8080/#/c/16323/3/be/src/runtime/spillable-row-batch-queue.h@133
PS3, Line 133: MAX_SPILLED_RESULT_SPOOLING_MEM
thanks for catching this
http://gerrit.cloudera.org:8080/#/c/16323/3/common/thrift/ImpalaService.thrift
File common/thrift/ImpalaService.thrift:
http://gerrit.cloudera.org:8080/#/c/16323/3/common/thrift/ImpalaService.thrift@561
PS3, Line 561: SAFELY_RETRY_QUERIES
I do like the idea of making this configurable. some users might find the overhead of spooling all results too high - yet may still want queries to be retried.
I think we might want to change the name though. If I'm a user, I would probably always want this to be set to true, because why wouldn't I want my queries to be retried safely.
perhaps a better name would be SPOOL_ALL_RESULTS_FOR_RETRIES.
--
To view, visit http://gerrit.cloudera.org:8080/16323
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
Gerrit-Change-Number: 16323
Gerrit-PatchSet: 3
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Sahil Takiar <st...@cloudera.com>
Gerrit-Reviewer: Thomas Tauber-Marshall <tm...@cloudera.com>
Gerrit-Comment-Date: Wed, 12 Aug 2020 20:23:57 +0000
Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/16323 )
Change subject: IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
......................................................................
Patch Set 9:
Build started: https://jenkins.impala.io/job/gerrit-verify-dryrun/6331/ DRY_RUN=false
--
To view, visit http://gerrit.cloudera.org:8080/16323
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
Gerrit-Change-Number: 16323
Gerrit-PatchSet: 9
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Sahil Takiar <st...@cloudera.com>
Gerrit-Reviewer: Thomas Tauber-Marshall <tm...@cloudera.com>
Gerrit-Comment-Date: Tue, 25 Aug 2020 23:04:30 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
Posted by "Quanlong Huang (Code Review)" <ge...@cloudera.org>.
Hello Thomas Tauber-Marshall, Sahil Takiar, Impala Public Jenkins,
I'd like you to reexamine a change. Please visit
http://gerrit.cloudera.org:8080/16323
to look at the new patch set (#7).
Change subject: IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
......................................................................
IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
If we have returned any results to the client in the original query,
query retry will be skipped to avoid incorrect results. This patch adds
a query option, spool_all_results_for_retries, for retryable queries to
spool all results before returning any to the client. It defaults to
true. If all query results cannot be contained in the allocated result
spooling space, we'll return results and thus disabled query retry on
the query.
Setting spool_all_results_for_retries to false will fallback to the
original behavior - client can fetch results when any of them are ready.
So we explicitly set it to false in the retried query since it won't be
retried. For non retryable queries or queries that don't enable results
spooling, the spool_all_results_for_retries option takes no effect.
To implement this, this patch defers the time when results are ready to
be fetched. By default, the “rows available” event happens when any
results are ready. For a retryable query, when spool_query_results and
spool_all_results_for_retries are both true, the “rows available” event
happens after all results are spooled or any errors stopping us to do
so, e.g. batch queue is full, cancellation or failures. After waiting
for the root fragment instance’s Open() finishes, the coordinator will
wait until results of BufferedPlanRootSink are ready.
BufferedPlanRootSink sets the results ready signal in its Send(),
Close(), Cancel(), FlushFinal() methods.
Tests:
- Add a test to verify that a retryable query will spool all its results
when results spooling and spool_all_results_for_retries are enabled.
- Add a test to verify that query retry succeeds when a retryable query
is still spooling its results (spool_all_results_for_retries=true).
- Add a test to verify that the retried query won't spool all results
even when results spooling and spool_all_results_for_retries are
enabled in the original query.
- Add a test to verify that the original query can be canceled
correctly. We need this because the added logics for
spool_all_results_for_retries are related to the cancellation code
path.
- Add a test to verify results will be returned when all of them can't
fit into the result spooling space, and query retry will be skipped.
Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
---
M be/src/exec/buffered-plan-root-sink.cc
M be/src/exec/buffered-plan-root-sink.h
M be/src/runtime/coordinator.cc
M be/src/runtime/query-driver.cc
M be/src/runtime/spillable-row-batch-queue.h
M be/src/service/query-options.cc
M be/src/service/query-options.h
M common/thrift/ImpalaInternalService.thrift
M common/thrift/ImpalaService.thrift
M common/thrift/generate_error_codes.py
M tests/common/impala_test_suite.py
M tests/custom_cluster/test_query_retries.py
12 files changed, 257 insertions(+), 8 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/23/16323/7
--
To view, visit http://gerrit.cloudera.org:8080/16323
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
Gerrit-Change-Number: 16323
Gerrit-PatchSet: 7
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Sahil Takiar <st...@cloudera.com>
Gerrit-Reviewer: Thomas Tauber-Marshall <tm...@cloudera.com>
[Impala-ASF-CR] IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/16323 )
Change subject: IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
......................................................................
Patch Set 4: Verified+1
--
To view, visit http://gerrit.cloudera.org:8080/16323
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
Gerrit-Change-Number: 16323
Gerrit-PatchSet: 4
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Sahil Takiar <st...@cloudera.com>
Gerrit-Reviewer: Thomas Tauber-Marshall <tm...@cloudera.com>
Gerrit-Comment-Date: Thu, 13 Aug 2020 18:31:49 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
Posted by "Sahil Takiar (Code Review)" <ge...@cloudera.org>.
Sahil Takiar has posted comments on this change. ( http://gerrit.cloudera.org:8080/16323 )
Change subject: IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
......................................................................
Patch Set 8: Code-Review+2
--
To view, visit http://gerrit.cloudera.org:8080/16323
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
Gerrit-Change-Number: 16323
Gerrit-PatchSet: 8
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Sahil Takiar <st...@cloudera.com>
Gerrit-Reviewer: Thomas Tauber-Marshall <tm...@cloudera.com>
Gerrit-Comment-Date: Tue, 25 Aug 2020 17:00:51 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-9225: Add query option for retryable queries to spool all results before returning any to the client
Posted by "Quanlong Huang (Code Review)" <ge...@cloudera.org>.
Hello Impala Public Jenkins,
I'd like you to reexamine a change. Please visit
http://gerrit.cloudera.org:8080/16323
to look at the new patch set (#2).
Change subject: IMPALA-9225: Add query option for retryable queries to spool all results before returning any to the client
......................................................................
IMPALA-9225: Add query option for retryable queries to spool all results before returning any to the client
If we have returned any results to the client in the original query,
query retry will be skipped to avoid incorrect results. This patch adds
a query option, safely_retry_queries, for retryable queries to spool all
results before returning any to the client. It defaults to true. If all
query results cannot be contained in the allocated result spooling
space, we’ll return results and thus disabled query retry on the query.
Setting safely_retry_queries to false will fallback to the original
behavior - client can fetch results when any of them are ready. So we
explicitly set it to false in the retried query since it won’t be
retried anymore. For non retryable queries, the safely_retry_queries
option takes no effects.
To implement this, this patch defers the time when a retryable query
runs into the FINISHED state (rows available). If safely_retry_queries
is true, results spooling will be implicitly enabled for a retryable
query. The coordinator fragment instance will only update its
opened_promise_ when the sender is blocked by a full queue or all
results are spooled, or when any errors happen. The DataSink::Send()
interface is extended to pass in a reference of the promise. So the sink
can update it to signal the fetch() request which is waiting for the
opened_promise_ to continue and actually fetch results.
Tests:
- Add a test to verify that a retryable query will spool all its results
when safely_retry_queries is true (no matter whether
spool_query_results is true or false).
- Add a test to verify that query retry succeeds when a retryable query
is spooling its results (safely_retry_queries=true).
- Add a test to verify that the retried query won’t implicitly enable
result spooling.
- Add a test to verify that the original query can be canceled
correctly. We need this because the added logics for
safely_retry_queries are related to a condition variable that could
affect the cancellation code path.
- Run test_query_retries.py in my dev box.
Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
---
M be/src/exec/blocking-plan-root-sink.cc
M be/src/exec/blocking-plan-root-sink.h
M be/src/exec/buffered-plan-root-sink.cc
M be/src/exec/buffered-plan-root-sink.h
M be/src/exec/data-sink.h
M be/src/exec/hbase-table-sink.cc
M be/src/exec/hbase-table-sink.h
M be/src/exec/hdfs-table-sink.cc
M be/src/exec/hdfs-table-sink.h
M be/src/exec/kudu-table-sink.cc
M be/src/exec/kudu-table-sink.h
M be/src/exec/nested-loop-join-builder.cc
M be/src/exec/nested-loop-join-builder.h
M be/src/exec/partitioned-hash-join-builder.cc
M be/src/exec/partitioned-hash-join-builder.h
M be/src/exec/plan-root-sink.cc
M be/src/exec/plan-root-sink.h
M be/src/runtime/fragment-instance-state.cc
M be/src/runtime/krpc-data-stream-sender.cc
M be/src/runtime/krpc-data-stream-sender.h
M be/src/runtime/query-driver.cc
M be/src/service/query-options.cc
M be/src/service/query-options.h
M common/thrift/ImpalaInternalService.thrift
M common/thrift/ImpalaService.thrift
M fe/src/main/java/org/apache/impala/planner/PlanRootSink.java
M tests/common/impala_test_suite.py
M tests/custom_cluster/test_query_retries.py
28 files changed, 228 insertions(+), 29 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/23/16323/2
--
To view, visit http://gerrit.cloudera.org:8080/16323
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
Gerrit-Change-Number: 16323
Gerrit-PatchSet: 2
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
[Impala-ASF-CR] IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
Posted by "Quanlong Huang (Code Review)" <ge...@cloudera.org>.
Quanlong Huang has posted comments on this change. ( http://gerrit.cloudera.org:8080/16323 )
Change subject: IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
......................................................................
Patch Set 4:
(5 comments)
Thanks for the comments! I revised this patch to not extend the DataSink::Send() interface. Now the scope is smaller.
http://gerrit.cloudera.org:8080/#/c/16323/3//COMMIT_MSG
Commit Message:
http://gerrit.cloudera.org:8080/#/c/16323/3//COMMIT_MSG@25
PS3, Line 25: ll_results_for_retries is true, results spooling will be
: implicitly enabled for a retryable query. The coordinator will wait
: until results of BufferedPlanRootSink are ready after waiting for the
: root fragment instance's Open() finishes. BufferedPlanRootSink sets the
: results ready signal in its Send() method when the batch queue is first
: full. BufferedPlanRootSink also exposes a method to set
> conceptually I think this approach makes sense, but I think it would make m
Ack
http://gerrit.cloudera.org:8080/#/c/16323/3/be/src/exec/data-sink.h
File be/src/exec/data-sink.h:
http://gerrit.cloudera.org:8080/#/c/16323/3/be/src/exec/data-sink.h@136
PS3, Line 136:
: /// Flushes any remaining buffered state.
> See my comment in fragment-instance-state.cc, but I think this can be moved
Done
http://gerrit.cloudera.org:8080/#/c/16323/3/be/src/runtime/fragment-instance-state.cc
File be/src/runtime/fragment-instance-state.cc:
http://gerrit.cloudera.org:8080/#/c/16323/3/be/src/runtime/fragment-instance-state.cc@430
PS3, Line 430: UpdateState(StateEvent::BATCH_SENT);
: } while (!exec_tree_complete);
: // Release resources from final row batch.
: row_batch_->Reset();
> I think it might make more sense to move all this logic into coordinator.cc
Done
http://gerrit.cloudera.org:8080/#/c/16323/3/common/thrift/ImpalaService.thrift
File common/thrift/ImpalaService.thrift:
http://gerrit.cloudera.org:8080/#/c/16323/3/common/thrift/ImpalaService.thrift@561
PS3, Line 561: SPOOL_ALL_RESULTS_FO
> I do like the idea of making this configurable. some users might find the o
Done
http://gerrit.cloudera.org:8080/#/c/16323/3/tests/custom_cluster/test_query_retries.py
File tests/custom_cluster/test_query_retries.py:
http://gerrit.cloudera.org:8080/#/c/16323/3/tests/custom_cluster/test_query_retries.py@452
PS3, Line 452: :
> flake8: E203 whitespace before ':'
Done
--
To view, visit http://gerrit.cloudera.org:8080/16323
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
Gerrit-Change-Number: 16323
Gerrit-PatchSet: 4
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Sahil Takiar <st...@cloudera.com>
Gerrit-Reviewer: Thomas Tauber-Marshall <tm...@cloudera.com>
Gerrit-Comment-Date: Thu, 13 Aug 2020 13:18:56 +0000
Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/16323 )
Change subject: IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
......................................................................
Patch Set 4:
Build started: https://jenkins.impala.io/job/gerrit-verify-dryrun/6285/ DRY_RUN=true
--
To view, visit http://gerrit.cloudera.org:8080/16323
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
Gerrit-Change-Number: 16323
Gerrit-PatchSet: 4
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Sahil Takiar <st...@cloudera.com>
Gerrit-Reviewer: Thomas Tauber-Marshall <tm...@cloudera.com>
Gerrit-Comment-Date: Thu, 13 Aug 2020 13:19:26 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/16323 )
Change subject: IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
......................................................................
Patch Set 8:
Build Successful
https://jenkins.impala.io/job/gerrit-code-review-checks/6983/ : Initial code review checks passed. Use gerrit-verify-dryrun-external or gerrit-verify-dryrun to run full precommit tests.
--
To view, visit http://gerrit.cloudera.org:8080/16323
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
Gerrit-Change-Number: 16323
Gerrit-PatchSet: 8
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Sahil Takiar <st...@cloudera.com>
Gerrit-Reviewer: Thomas Tauber-Marshall <tm...@cloudera.com>
Gerrit-Comment-Date: Tue, 25 Aug 2020 10:06:13 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/16323 )
Change subject: IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
......................................................................
Patch Set 10:
Build started: https://jenkins.impala.io/job/gerrit-verify-dryrun/6341/ DRY_RUN=false
--
To view, visit http://gerrit.cloudera.org:8080/16323
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
Gerrit-Change-Number: 16323
Gerrit-PatchSet: 10
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Sahil Takiar <st...@cloudera.com>
Gerrit-Reviewer: Thomas Tauber-Marshall <tm...@cloudera.com>
Gerrit-Comment-Date: Wed, 26 Aug 2020 22:58:23 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
Posted by "Quanlong Huang (Code Review)" <ge...@cloudera.org>.
Hello Thomas Tauber-Marshall, Sahil Takiar, Impala Public Jenkins,
I'd like you to reexamine a change. Please visit
http://gerrit.cloudera.org:8080/16323
to look at the new patch set (#8).
Change subject: IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
......................................................................
IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
If we have returned any results to the client in the original query,
query retry will be skipped to avoid incorrect results. This patch adds
a query option, spool_all_results_for_retries, for retryable queries to
spool all results before returning any to the client. It defaults to
true. If all query results cannot be contained in the allocated result
spooling space, we'll return results and thus disabled query retry on
the query.
Setting spool_all_results_for_retries to false will fallback to the
original behavior - client can fetch results when any of them are ready.
So we explicitly set it to false in the retried query since it won't be
retried. For non retryable queries or queries that don't enable results
spooling, the spool_all_results_for_retries option takes no effect.
To implement this, this patch defers the time when results are ready to
be fetched. By default, the “rows available” event happens when any
results are ready. For a retryable query, when spool_query_results and
spool_all_results_for_retries are both true, the “rows available” event
happens after all results are spooled or any errors stopping us to do
so, e.g. batch queue is full, cancellation or failures. After waiting
for the root fragment instance’s Open() finishes, the coordinator will
wait until results of BufferedPlanRootSink are ready.
BufferedPlanRootSink sets the results ready signal in its Send(),
Close(), Cancel(), FlushFinal() methods.
Tests:
- Add a test to verify that a retryable query will spool all its results
when results spooling and spool_all_results_for_retries are enabled.
- Add a test to verify that query retry succeeds when a retryable query
is still spooling its results (spool_all_results_for_retries=true).
- Add a test to verify that the retried query won't spool all results
even when results spooling and spool_all_results_for_retries are
enabled in the original query.
- Add a test to verify that the original query can be canceled
correctly. We need this because the added logics for
spool_all_results_for_retries are related to the cancellation code
path.
- Add a test to verify results will be returned when all of them can't
fit into the result spooling space, and query retry will be skipped.
Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
---
M be/src/exec/buffered-plan-root-sink.cc
M be/src/exec/buffered-plan-root-sink.h
M be/src/runtime/coordinator.cc
M be/src/runtime/query-driver.cc
M be/src/runtime/spillable-row-batch-queue.h
M be/src/service/query-options.cc
M be/src/service/query-options.h
M common/thrift/ImpalaInternalService.thrift
M common/thrift/ImpalaService.thrift
M tests/common/impala_test_suite.py
M tests/custom_cluster/test_query_retries.py
11 files changed, 244 insertions(+), 8 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/23/16323/8
--
To view, visit http://gerrit.cloudera.org:8080/16323
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
Gerrit-Change-Number: 16323
Gerrit-PatchSet: 8
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Sahil Takiar <st...@cloudera.com>
Gerrit-Reviewer: Thomas Tauber-Marshall <tm...@cloudera.com>
[Impala-ASF-CR] IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
Posted by "Sahil Takiar (Code Review)" <ge...@cloudera.org>.
Sahil Takiar has posted comments on this change. ( http://gerrit.cloudera.org:8080/16323 )
Change subject: IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
......................................................................
Patch Set 6:
(10 comments)
starting to look good
http://gerrit.cloudera.org:8080/#/c/16323/6//COMMIT_MSG
Commit Message:
http://gerrit.cloudera.org:8080/#/c/16323/6//COMMIT_MSG@20
PS6, Line 20: spool_all_results_for_retries
might be worth mentioning that if retry_failed_queries = false or if spool_query_results = false, this option won't take any effect either.
http://gerrit.cloudera.org:8080/#/c/16323/6//COMMIT_MSG@23
PS6, Line 23: To implement this, this patch defers the time when a retryable query
: runs into the FINISHED stat
I think this merits a bit more clarification. in the normal case, a query is in the FINISHED state as soon as rows are ready to be fetched. conceptually, we aren't really changing anything about this state, even when this feature is triggered , a transition to the FINISHED state indicates that rows are ready to be fetched.
the only difference is what it means for "rows are ready to be fetched". when this feature is *not* triggered, rows are ready to be fetched as soon as *any* rows are available. when this feature is triggered, rows are only ready to be fetched when *all* rows are available.
http://gerrit.cloudera.org:8080/#/c/16323/6//COMMIT_MSG@25
PS6, Line 25: results spooling will be
: implicitly enabled
I think this feature should also be dependent on result spooling being enabled by the user (e.g. spool_query_results = true). otherwise users might find it a bit confusing that result spooling is used even when spool_query_results is false.
I think users might want to set spool_all_results_for_retries to false if they find that spooling all results introduces too much overhead.
I think it would be rare that they set spool_query_results = false, the only reason I can see that happening is if there is a bug in the implementation.
http://gerrit.cloudera.org:8080/#/c/16323/6/be/src/exec/buffered-plan-root-sink.cc
File be/src/exec/buffered-plan-root-sink.cc:
http://gerrit.cloudera.org:8080/#/c/16323/6/be/src/exec/buffered-plan-root-sink.cc@82
PS6, Line 82: if (state->query_options().retry_failed_queries
: && state->query_options().spool_all_results_for_retries) {
: state->LogError(ErrorMsg(TErrorCode::GENERAL, "Cannot spool all results. "
: "Query retry will be skipped if any results have been returned."));
it would be nice if this log statement was moved elsewhere (perhaps the coordinator?) to avoid leaking the query retry feature into the result spooling implementation. right now the two are separate, and it would be nice to keep it that way.
http://gerrit.cloudera.org:8080/#/c/16323/6/be/src/exec/buffered-plan-root-sink.cc@87
PS6, Line 87: discard_result(spooled_all_results_.Set(Status::OK()));
so I think what is happening here is that if the queue is full, and no more results can be spooled. we set spooled_all_results_ in order to unblock the coordinator, and as long as no results have been fetched, the query can still be retried, is that correct?
that is definitely a nice property to have here. the one nit is that perhaps we should rename spooled_all_results_ to something else then? technically this line is setting spooled_all_results_ to true, even though all results have not been spooled.
http://gerrit.cloudera.org:8080/#/c/16323/6/be/src/runtime/coordinator.cc
File be/src/runtime/coordinator.cc:
http://gerrit.cloudera.org:8080/#/c/16323/6/be/src/runtime/coordinator.cc@803
PS6, Line 803: Status status = UpdateExecState(coord_instance_->WaitForOpen(),
nit: the typical pattern is to wrap the call to `UpdateExecState` in `RETURN_IF_ERROR`, and then return Status::OK() on line 814
http://gerrit.cloudera.org:8080/#/c/16323/6/be/src/runtime/fragment-instance-state.cc
File be/src/runtime/fragment-instance-state.cc:
http://gerrit.cloudera.org:8080/#/c/16323/6/be/src/runtime/fragment-instance-state.cc@91
PS6, Line 91: VLOG_QUERY << "Set opened_promise_ after Prepare()";
nit: delete?
http://gerrit.cloudera.org:8080/#/c/16323/6/be/src/runtime/fragment-instance-state.cc@100
PS6, Line 100: VLOG_QUERY << "Set opended_promise_ after Open";
nit: delete?
http://gerrit.cloudera.org:8080/#/c/16323/6/be/src/runtime/fragment-instance-state.cc@112
PS6, Line 112: reinterpret_cast<BufferedPlanRootSink*>(sink_)->MarkSpooledAllResults(status);
can you just do this in the FlushFinal method of BufferedPlanRootSink? I don't think setting the spooled_all_results_ flag has to be done specifically when query retries are enabled either
http://gerrit.cloudera.org:8080/#/c/16323/6/be/src/runtime/fragment-instance-state.cc@438
PS6, Line 438: reinterpret_cast<BufferedPlanRootSink*>(sink_)->MarkSpooledAllResults(Status::OK());
same comment as above I think
--
To view, visit http://gerrit.cloudera.org:8080/16323
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
Gerrit-Change-Number: 16323
Gerrit-PatchSet: 6
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Sahil Takiar <st...@cloudera.com>
Gerrit-Reviewer: Thomas Tauber-Marshall <tm...@cloudera.com>
Gerrit-Comment-Date: Fri, 14 Aug 2020 18:35:56 +0000
Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/16323 )
Change subject: IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
......................................................................
Patch Set 10: Verified+1
--
To view, visit http://gerrit.cloudera.org:8080/16323
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
Gerrit-Change-Number: 16323
Gerrit-PatchSet: 10
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Sahil Takiar <st...@cloudera.com>
Gerrit-Reviewer: Thomas Tauber-Marshall <tm...@cloudera.com>
Gerrit-Comment-Date: Thu, 27 Aug 2020 04:09:57 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-9225: Add query option for retryable queries to spool all results before returning any to the client
Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/16323 )
Change subject: IMPALA-9225: Add query option for retryable queries to spool all results before returning any to the client
......................................................................
Patch Set 3:
Build started: https://jenkins.impala.io/job/gerrit-verify-dryrun/6273/ DRY_RUN=true
--
To view, visit http://gerrit.cloudera.org:8080/16323
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
Gerrit-Change-Number: 16323
Gerrit-PatchSet: 3
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Sahil Takiar <st...@cloudera.com>
Gerrit-Reviewer: Thomas Tauber-Marshall <tm...@cloudera.com>
Gerrit-Comment-Date: Wed, 12 Aug 2020 08:11:58 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-9225: Add query option for retryable queries to spool all results before returning any to the client
Posted by "Quanlong Huang (Code Review)" <ge...@cloudera.org>.
Quanlong Huang has posted comments on this change. ( http://gerrit.cloudera.org:8080/16323 )
Change subject: IMPALA-9225: Add query option for retryable queries to spool all results before returning any to the client
......................................................................
Patch Set 3:
> Uploaded patch set 3.
Add a test to verify results will be returned when all of them can't fit into the result spooling space, and query retry will be skipped. Fix a bug in the previous patch revealed by the test.
Also fix a flaky test in the previous patch.
--
To view, visit http://gerrit.cloudera.org:8080/16323
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
Gerrit-Change-Number: 16323
Gerrit-PatchSet: 3
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Sahil Takiar <st...@cloudera.com>
Gerrit-Reviewer: Thomas Tauber-Marshall <tm...@cloudera.com>
Gerrit-Comment-Date: Wed, 12 Aug 2020 08:10:54 +0000
Gerrit-HasComments: No
[Impala-ASF-CR] IMPALA-9225: Add query option for retryable queries to spool all results before returning any to the client
Posted by "Impala Public Jenkins (Code Review)" <ge...@cloudera.org>.
Impala Public Jenkins has posted comments on this change. ( http://gerrit.cloudera.org:8080/16323 )
Change subject: IMPALA-9225: Add query option for retryable queries to spool all results before returning any to the client
......................................................................
Patch Set 3:
(1 comment)
http://gerrit.cloudera.org:8080/#/c/16323/3/tests/custom_cluster/test_query_retries.py
File tests/custom_cluster/test_query_retries.py:
http://gerrit.cloudera.org:8080/#/c/16323/3/tests/custom_cluster/test_query_retries.py@452
PS3, Line 452:
flake8: E203 whitespace before ':'
--
To view, visit http://gerrit.cloudera.org:8080/16323
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: comment
Gerrit-Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
Gerrit-Change-Number: 16323
Gerrit-PatchSet: 3
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Sahil Takiar <st...@cloudera.com>
Gerrit-Reviewer: Thomas Tauber-Marshall <tm...@cloudera.com>
Gerrit-Comment-Date: Wed, 12 Aug 2020 08:09:36 +0000
Gerrit-HasComments: Yes
[Impala-ASF-CR] IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
Posted by "Quanlong Huang (Code Review)" <ge...@cloudera.org>.
Hello Thomas Tauber-Marshall, Sahil Takiar, Impala Public Jenkins,
I'd like you to reexamine a change. Please visit
http://gerrit.cloudera.org:8080/16323
to look at the new patch set (#6).
Change subject: IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
......................................................................
IMPALA-9225: Query option for retryable queries to spool all results before returning any to the client
If we have returned any results to the client in the original query,
query retry will be skipped to avoid incorrect results. This patch adds
a query option, spool_all_results_for_retries, for retryable queries to
spool all results before returning any to the client. It defaults to
true. If all query results cannot be contained in the allocated result
spooling space, we'll return results and thus disabled query retry on
the query.
Setting spool_all_results_for_retries to false will fallback to the
original behavior - client can fetch results when any of them are ready.
So we explicitly set it to false in the retried query since it won't be
retried. For non retryable queries, the spool_all_results_for_retries
option takes no effects.
To implement this, this patch defers the time when a retryable query
runs into the FINISHED state (rows available). If
spool_all_results_for_retries is true, results spooling will be
implicitly enabled for a retryable query. The coordinator will wait
until results of BufferedPlanRootSink are ready after waiting for the
root fragment instance's Open() finishes. BufferedPlanRootSink sets the
results ready signal in its Send() method when the batch queue is first
full. BufferedPlanRootSink also exposes a method to set the signal
outside when all batches are sent to the sink or any errors happen.
Tests:
- Add a test to verify that a retryable query will spool all its results
when spool_all_results_for_retries is true (no matter whether
spool_query_results is true or false).
- Add a test to verify that query retry succeeds when a retryable query
is spooling its results (spool_all_results_for_retries=true).
- Add a test to verify that the retried query won't implicitly enable
result spooling.
- Add a test to verify that the original query can be canceled
correctly. We need this because the added logics for
spool_all_results_for_retries are related to a condition variable that
could affect the cancellation code path.
- Add a test to verify results will be returned when all of them can't
fit into the result spooling space, and query retry will be skipped.
Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
---
M be/src/exec/buffered-plan-root-sink.cc
M be/src/exec/buffered-plan-root-sink.h
M be/src/exec/plan-root-sink.cc
M be/src/runtime/coordinator.cc
M be/src/runtime/fragment-instance-state.cc
M be/src/runtime/query-driver.cc
M be/src/runtime/spillable-row-batch-queue.h
M be/src/service/query-options.cc
M be/src/service/query-options.h
M common/thrift/ImpalaInternalService.thrift
M common/thrift/ImpalaService.thrift
M fe/src/main/java/org/apache/impala/planner/PlanRootSink.java
M tests/common/impala_test_suite.py
M tests/custom_cluster/test_query_retries.py
14 files changed, 278 insertions(+), 10 deletions(-)
git pull ssh://gerrit.cloudera.org:29418/Impala-ASF refs/changes/23/16323/6
--
To view, visit http://gerrit.cloudera.org:8080/16323
To unsubscribe, visit http://gerrit.cloudera.org:8080/settings
Gerrit-Project: Impala-ASF
Gerrit-Branch: master
Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I462dbfef9ddab9060b30a6937fca9122484a24a5
Gerrit-Change-Number: 16323
Gerrit-PatchSet: 6
Gerrit-Owner: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Impala Public Jenkins <im...@cloudera.com>
Gerrit-Reviewer: Quanlong Huang <hu...@gmail.com>
Gerrit-Reviewer: Sahil Takiar <st...@cloudera.com>
Gerrit-Reviewer: Thomas Tauber-Marshall <tm...@cloudera.com>