Skip to content
Snippets Groups Projects
Commit 7add4e98 authored by Marco Gaido's avatar Marco Gaido Committed by gatorsmile
Browse files

[SPARK-21738] Thriftserver doesn't cancel jobs when session is closed

## What changes were proposed in this pull request?

When a session is closed the Thriftserver doesn't cancel the jobs which may still be running. This is a huge waste of resources.
This PR address the problem canceling the pending jobs when a session is closed.

## How was this patch tested?

The patch was tested manually.

Author: Marco Gaido <mgaido@hortonworks.com>

Closes #18951 from mgaido91/SPARK-21738.
parent 1cce1a3b
No related branches found
No related tags found
No related merge requests found
......@@ -71,9 +71,9 @@ private[hive] class SparkExecuteStatementOperation(
def close(): Unit = {
// RDDs will be cleaned automatically upon garbage collection.
sqlContext.sparkContext.clearJobGroup()
logDebug(s"CLOSING $statementId")
cleanup(OperationState.CLOSED)
sqlContext.sparkContext.clearJobGroup()
}
def addNonNullColumnValue(from: SparkRow, to: ArrayBuffer[Any], ordinal: Int) {
......@@ -273,9 +273,6 @@ private[hive] class SparkExecuteStatementOperation(
override def cancel(): Unit = {
logInfo(s"Cancel '$statement' with $statementId")
if (statementId != null) {
sqlContext.sparkContext.cancelJobGroup(statementId)
}
cleanup(OperationState.CANCELED)
}
......@@ -287,6 +284,9 @@ private[hive] class SparkExecuteStatementOperation(
backgroundHandle.cancel(true)
}
}
if (statementId != null) {
sqlContext.sparkContext.cancelJobGroup(statementId)
}
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment