-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-24063][SS] Add maximum epoch queue threshold for ContinuousExecution #23156
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
Closed
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
72733c5
[SPARK-24063][SS] Add maximum epoch queue threshold for ContinuousExe…
gaborgsomogyi b0c5056
Merge branch 'master' into SPARK-24063
gaborgsomogyi 357f834
Merge branch 'master' into SPARK-24063
gaborgsomogyi f6bc301
withSQLConf used and test commented
gaborgsomogyi 96152da
Review fixes:
gaborgsomogyi 43e61ef
Merge branch 'master' into SPARK-24063
gaborgsomogyi 9324c90
AtomicReference used for failure reference
gaborgsomogyi 8a9b67f
Made config public
gaborgsomogyi 41656f1
Review fix
gaborgsomogyi d67db64
Review fix
gaborgsomogyi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,7 @@ package org.apache.spark.sql.execution.streaming.continuous | |
|
|
||
| import java.util.UUID | ||
| import java.util.concurrent.TimeUnit | ||
| import java.util.concurrent.atomic.AtomicReference | ||
| import java.util.function.UnaryOperator | ||
|
|
||
| import scala.collection.JavaConverters._ | ||
|
|
@@ -58,6 +59,9 @@ class ContinuousExecution( | |
| // For use only in test harnesses. | ||
| private[sql] var currentEpochCoordinatorId: String = _ | ||
|
|
||
| // Throwable that caused the execution to fail | ||
| private val failure: AtomicReference[Throwable] = new AtomicReference[Throwable](null) | ||
|
|
||
| override val logicalPlan: LogicalPlan = { | ||
| val v2ToRelationMap = MutableMap[StreamingRelationV2, StreamingDataSourceV2Relation]() | ||
| var nextSourceId = 0 | ||
|
|
@@ -261,6 +265,11 @@ class ContinuousExecution( | |
| lastExecution.toRdd | ||
| } | ||
| } | ||
|
|
||
| val f = failure.get() | ||
| if (f != null) { | ||
| throw f | ||
| } | ||
| } catch { | ||
| case t: Throwable if StreamExecution.isInterruptionException(t, sparkSession.sparkContext) && | ||
| state.get() == RECONFIGURING => | ||
|
|
@@ -373,6 +382,35 @@ class ContinuousExecution( | |
| } | ||
| } | ||
|
|
||
| /** | ||
| * Stores error and stops the query execution thread to terminate the query in new thread. | ||
| */ | ||
| def stopInNewThread(error: Throwable): Unit = { | ||
| if (failure.compareAndSet(null, error)) { | ||
| logError(s"Query $prettyIdString received exception $error") | ||
| stopInNewThread() | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like there is a race here. The query stop may happen before the continuous-execution checks |
||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Stops the query execution thread to terminate the query in new thread. | ||
| */ | ||
| private def stopInNewThread(): Unit = { | ||
| new Thread("stop-continuous-execution") { | ||
gaborgsomogyi marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| setDaemon(true) | ||
|
|
||
| override def run(): Unit = { | ||
| try { | ||
| ContinuousExecution.this.stop() | ||
| } catch { | ||
| case e: Throwable => | ||
| logError(e.getMessage, e) | ||
| throw e | ||
| } | ||
| } | ||
| }.start() | ||
| } | ||
|
|
||
| /** | ||
| * Stops the query execution thread to terminate the query. | ||
| */ | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.