[SPARK-50205][SQL][TEST] Re-enable SparkSessionJobTaggingAndCancellationSuite.Cancellation APIs in SparkSession are isolated
#52704
+1
−2
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.
What changes were proposed in this pull request?
This PR aims to reenable
SparkSessionJobTaggingAndCancellationSuite.Cancellation APIs in SparkSession are isolated.#48736 disabled this test because of it was flaky. In this test, futures ran on threads managed by
ForkJoinPool.Each future invokes
SparkSession#addTagandSparkSession#getTag, and tags are implemented usingInheritableThreadLocal. So the root cause of this issue is same as #52417.But #48906 replaced
ForkJoinPoolwithExecutors.newFixedThreadPool(3)so I believe this issue no longer occurs.In fact, this issue can be reproduced by replacing
Executors.newFixedThreadPool(3)withnew ForkJoinPool(3)and inserting a sleep like as follows.Then, run the test as follows.
On the other hand, if inserting sleep but leaving
Executors.newFixedThreadPool(3)as it is, this test always seems to pass.So, we can now reenable this test.
Why are the changes needed?
For better test coverage.
Does this PR introduce any user-facing change?
No.
How was this patch tested?
The test always passes on my dev environment even if inserting sleep like explained above.
Was this patch authored or co-authored using generative AI tooling?
No.