-
Notifications
You must be signed in to change notification settings - Fork 28.6k
[SPARK-6964][SQL] Support Cancellation in the Thrift Server #6207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Test build #32878 has finished for PR 6207 at commit
|
Test build #33032 has finished for PR 6207 at commit
|
Test build #33175 has finished for PR 6207 at commit
|
56251bb
to
78ab6eb
Compare
Test build #33185 has finished for PR 6207 at commit
|
ping @marmbrus |
This is great! As discussed off-line it would be great if we could make running everything async (and thus supporting cancelation) flag controlled. |
Test build #33305 has finished for PR 6207 at commit
|
Test build #33328 has finished for PR 6207 at commit
|
|
||
val largeJoin = "SELECT COUNT(*) FROM test_map " + | ||
List.fill(10)("join test_map").mkString(" ") | ||
val f = future { Thread.sleep(100); statement.cancel(); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed off-line we should look at doing this without a sleep, but I don't think that needs to block merging.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HiveStatement does not support setQueryTimeout.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that this is the cause of timeouts / flakiness in this suite: on a slow machine, it's possible that the timeout might expire before the query begins executing, which would cause us to hang indefinitely while waiting for the query to complete.
I'm fixing this in my own PR, but just wanted to flag this here as being a problem so that we don't do this again in the future.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, another problem: this probably shouldn't be using the global execution context, since its thread pool could be tied up by other uses and prevent this future from being scheduled in a timely manner.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, +1 for a more reliable way to trigger cancel after submitting the long execution.
/cc @liancheng |
Test build #33523 has finished for PR 6207 at commit
|
val smallJoin = "SELECT COUNT(*) FROM test_map " + | ||
List.fill(4)("join test_map").mkString(" ") | ||
val rs1 = statement.executeQuery(smallJoin) | ||
Await.result(sf, Duration.Inf) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use a relatively long timeout (3 min?) instead of Inf
here, just in case things go wrong and cause super long Jenkins build time.
This LGTM except for some minor issues. |
Test build #33749 has finished for PR 6207 at commit
|
269d5ab
to
37bd362
Compare
Test build #33788 has finished for PR 6207 at commit
|
37bd362
to
a46b96b
Compare
Test build #34289 has finished for PR 6207 at commit
|
Test build #34292 has finished for PR 6207 at commit
|
6ab5b28
to
687c113
Compare
Test build #34296 has finished for PR 6207 at commit
|
jenkins test this please |
Test build #34305 has finished for PR 6207 at commit
|
I am merging it to master. |
Support runInBackground in SparkExecuteStatementOperation, and add cancellation Author: Dong Wang <dong@databricks.com> Closes #6207 from dongwang218/SPARK-6964-jdbc-cancel and squashes the following commits: 687c113 [Dong Wang] fix 100 characters 7bfa2a7 [Dong Wang] fix merge 380480f [Dong Wang] fix for liancheng's comments eb3e385 [Dong Wang] small nit 341885b [Dong Wang] small fix 3d8ebf8 [Dong Wang] add spark.sql.hive.thriftServer.async flag 04142c3 [Dong Wang] set SQLSession for async execution 184ec35 [Dong Wang] keep hive conf 819ae03 [Dong Wang] [SPARK-6964][SQL][WIP] Support Cancellation in the Thrift Server
Support runInBackground in SparkExecuteStatementOperation, and add cancellation Author: Dong Wang <dong@databricks.com> Closes apache#6207 from dongwang218/SPARK-6964-jdbc-cancel and squashes the following commits: 687c113 [Dong Wang] fix 100 characters 7bfa2a7 [Dong Wang] fix merge 380480f [Dong Wang] fix for liancheng's comments eb3e385 [Dong Wang] small nit 341885b [Dong Wang] small fix 3d8ebf8 [Dong Wang] add spark.sql.hive.thriftServer.async flag 04142c3 [Dong Wang] set SQLSession for async execution 184ec35 [Dong Wang] keep hive conf 819ae03 [Dong Wang] [SPARK-6964][SQL][WIP] Support Cancellation in the Thrift Server Conflicts: sql/hive-thriftserver/v0.13.1/src/main/scala/org/apache/spark/sql/hive/thriftserver/Shim13.scala
This is merged right? @dongwang218 can you close the issue? |
Yeah. I merged it. The commit is eb19d3f. |
yes, closing the PR, thanks @yhuai. |
Support runInBackground in SparkExecuteStatementOperation, and add cancellation Author: Dong Wang <dong@databricks.com> Closes apache#6207 from dongwang218/SPARK-6964-jdbc-cancel and squashes the following commits: 687c113 [Dong Wang] fix 100 characters 7bfa2a7 [Dong Wang] fix merge 380480f [Dong Wang] fix for liancheng's comments eb3e385 [Dong Wang] small nit 341885b [Dong Wang] small fix 3d8ebf8 [Dong Wang] add spark.sql.hive.thriftServer.async flag 04142c3 [Dong Wang] set SQLSession for async execution 184ec35 [Dong Wang] keep hive conf 819ae03 [Dong Wang] [SPARK-6964][SQL][WIP] Support Cancellation in the Thrift Server
Support runInBackground in SparkExecuteStatementOperation, and add cancellation Author: Dong Wang <dong@databricks.com> Closes apache#6207 from dongwang218/SPARK-6964-jdbc-cancel and squashes the following commits: 687c113 [Dong Wang] fix 100 characters 7bfa2a7 [Dong Wang] fix merge 380480f [Dong Wang] fix for liancheng's comments eb3e385 [Dong Wang] small nit 341885b [Dong Wang] small fix 3d8ebf8 [Dong Wang] add spark.sql.hive.thriftServer.async flag 04142c3 [Dong Wang] set SQLSession for async execution 184ec35 [Dong Wang] keep hive conf 819ae03 [Dong Wang] [SPARK-6964][SQL][WIP] Support Cancellation in the Thrift Server
statement.executeQuery(largeJoin) | ||
} | ||
assert(e.getMessage contains "cancelled") | ||
Await.result(f, 3.minute) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why three minutes? This seems arbitrary.
…ryServerSuite This patch fixes a flaky "test jdbc cancel" test in HiveThriftBinaryServerSuite. This test is prone to a race-condition which causes it to block indefinitely with while waiting for an extremely slow query to complete, which caused many Jenkins builds to time out. For more background, see my comments on #6207 (the PR which introduced this test). Author: Josh Rosen <joshrosen@databricks.com> Closes #10425 from JoshRosen/SPARK-11823. (cherry picked from commit 2235cd4) Signed-off-by: Josh Rosen <joshrosen@databricks.com>
…ryServerSuite This patch fixes a flaky "test jdbc cancel" test in HiveThriftBinaryServerSuite. This test is prone to a race-condition which causes it to block indefinitely with while waiting for an extremely slow query to complete, which caused many Jenkins builds to time out. For more background, see my comments on #6207 (the PR which introduced this test). Author: Josh Rosen <joshrosen@databricks.com> Closes #10425 from JoshRosen/SPARK-11823.
Support runInBackground in SparkExecuteStatementOperation, and add cancellation