Repository navigation
[spark] Fix flaky interrupted CTAS test on Spark 3.2-3.4 - #11381
Open
LuciferYang wants to merge 2 commits into
Open
LuciferYang wants to merge 2 commits into
LuciferYang wants to merge 2 commits into
Conversation
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Purpose
Fixes #11380. "Interrupted CTAS cleans up its table" cancels its job group with
interruptOnCancel = true. Before Spark 4.0, a kill that lands after the executor's kill check but beforeTask.runrecords the task thread only marks the TaskContext; the thread is never interrupted, and nothing checks the mark before the task body runs (SPARK-44818 added that check in 4.0.0). The test UDF then stays in its 30 sThread.sleep, and Range checks the mark only after the partition's 10 rows. The cancelled task holds one of the twolocal[2]slots for up to 300 s, and once both are held, later cases time out waiting for a task to start.The UDF now sleeps in 20 ms steps and throws
TaskKilledExceptiononce the TaskContext is marked killed. When the interrupt does arrive,Thread.sleepthrows as before.Tests
The change is test-only. On a fork, with the four cases repeated 40 times per suite on Spark 3.2-3.4 and Scala 2.12, the old UDF left a task running 5 s after
cancelJobGroupin 4 of 480 cases, and a UDF that polls the mark the same way (with a 200 ms wait before it throws) in none of 480 (run).