Skip to content

[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

Closed
wants to merge 9 commits into from

Conversation

dongwang218
Copy link

Support runInBackground in SparkExecuteStatementOperation, and add cancellation

@SparkQA
Copy link

SparkQA commented May 16, 2015

Test build #32878 has finished for PR 6207 at commit 13c53b1.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented May 19, 2015

Test build #33032 has finished for PR 6207 at commit db60d1c.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented May 20, 2015

Test build #33175 has finished for PR 6207 at commit 56251bb.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@dongwang218 dongwang218 force-pushed the SPARK-6964-jdbc-cancel branch from 56251bb to 78ab6eb Compare May 20, 2015 23:17
@SparkQA
Copy link

SparkQA commented May 21, 2015

Test build #33185 has finished for PR 6207 at commit 78ab6eb.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@dongwang218 dongwang218 changed the title [SPARK-6964][SQL][WIP] Support Cancellation in the Thrift Server [SPARK-6964][SQL] Support Cancellation in the Thrift Server May 21, 2015
@dongwang218
Copy link
Author

ping @marmbrus

@marmbrus
Copy link
Contributor

This is great! As discussed off-line it would be great if we could make running everything async (and thus supporting cancelation) flag controlled.

@SparkQA
Copy link

SparkQA commented May 22, 2015

Test build #33305 has finished for PR 6207 at commit edf8fa1.

  • This patch fails Scala style tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented May 22, 2015

Test build #33328 has finished for PR 6207 at commit 4002fb2.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.


val largeJoin = "SELECT COUNT(*) FROM test_map " +
List.fill(10)("join test_map").mkString(" ")
val f = future { Thread.sleep(100); statement.cancel(); }
Copy link
Contributor

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.

Copy link
Author

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.

Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Author

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.

@marmbrus
Copy link
Contributor

/cc @liancheng

@SparkQA
Copy link

SparkQA commented May 26, 2015

Test build #33523 has finished for PR 6207 at commit 689e30d.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

val smallJoin = "SELECT COUNT(*) FROM test_map " +
List.fill(4)("join test_map").mkString(" ")
val rs1 = statement.executeQuery(smallJoin)
Await.result(sf, Duration.Inf)
Copy link
Contributor

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.

@liancheng
Copy link
Contributor

This LGTM except for some minor issues.

@SparkQA
Copy link

SparkQA commented May 29, 2015

Test build #33749 has finished for PR 6207 at commit 269d5ab.

  • This patch fails PySpark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@dongwang218 dongwang218 force-pushed the SPARK-6964-jdbc-cancel branch from 269d5ab to 37bd362 Compare May 30, 2015 01:21
@SparkQA
Copy link

SparkQA commented May 30, 2015

Test build #33788 has finished for PR 6207 at commit 37bd362.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@dongwang218 dongwang218 force-pushed the SPARK-6964-jdbc-cancel branch from 37bd362 to a46b96b Compare June 5, 2015 17:02
@SparkQA
Copy link

SparkQA commented Jun 5, 2015

Test build #34289 has finished for PR 6207 at commit a46b96b.

  • This patch fails Scala style tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Jun 5, 2015

Test build #34292 has finished for PR 6207 at commit 6ab5b28.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@dongwang218 dongwang218 force-pushed the SPARK-6964-jdbc-cancel branch from 6ab5b28 to 687c113 Compare June 5, 2015 18:36
@SparkQA
Copy link

SparkQA commented Jun 5, 2015

Test build #34296 has finished for PR 6207 at commit 687c113.

  • This patch fails PySpark unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@yhuai
Copy link
Contributor

yhuai commented Jun 5, 2015

jenkins test this please

@SparkQA
Copy link

SparkQA commented Jun 5, 2015

Test build #34305 has finished for PR 6207 at commit 687c113.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@yhuai
Copy link
Contributor

yhuai commented Jun 6, 2015

I am merging it to master.

dongwang218 pushed a commit that referenced this pull request Jun 6, 2015
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
dongwang218 pushed a commit to dongwang218/spark that referenced this pull request Jun 6, 2015
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
@marmbrus
Copy link
Contributor

This is merged right? @dongwang218 can you close the issue?

@yhuai
Copy link
Contributor

yhuai commented Jun 11, 2015

Yeah. I merged it. The commit is eb19d3f.

@dongwang218
Copy link
Author

yes, closing the PR, thanks @yhuai.

jeanlyn pushed a commit to jeanlyn/spark that referenced this pull request Jun 12, 2015
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
nemccarthy pushed a commit to nemccarthy/spark that referenced this pull request Jun 19, 2015
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)
Copy link
Contributor

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.

asfgit pushed a commit that referenced this pull request Dec 22, 2015
…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>
asfgit pushed a commit that referenced this pull request Dec 22, 2015
…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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants