Skip to content
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

[SPARK-50366][SQL] Isolate user-defined tags on thread level for SparkSession in Classic #48906

Closed
wants to merge 5 commits into from

Conversation

xupefei
Copy link
Contributor

@xupefei xupefei commented Nov 20, 2024

What changes were proposed in this pull request?

This PR changes the implementation of user-provided tags to be thread-local, so that tags added by two threads to the same SparkSession do not interfere with each other.

Overlaps (from the SparkContext perspective) are avoided by introducing a thread-local random UUID which is attached to all tags in the same thread.

Why are the changes needed?

To make tags isolated per thread.

Does this PR introduce any user-facing change?

Yes, user-provided tags are now isolated on the session level.

How was this patch tested?

Local test.

Was this patch authored or co-authored using generative AI tooling?

No.

@github-actions github-actions bot added the SQL label Nov 20, 2024
@xupefei xupefei changed the title [SPARK-50366] Isolate user-defined tags on thread level for SparkSession in Classic [SPARK-50366][SQL] Isolate user-defined tags on thread level for SparkSession in Classic Nov 20, 2024
* A UUID that is unique on the thread level. Used by managedJobTags to make sure that a same
* tag from two threads does not overlap in the underlying SparkContext/SQLExecution.
*/
private[sql] lazy val threadUuid = new InheritableThreadLocal[String] {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we have a simple test for this inheritance? Otherwise, looks fine from a cursory look.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@HyukjinKwon
Copy link
Member

cc @itholic too

Copy link
Contributor

@itholic itholic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good except for a nit comment

@HyukjinKwon
Copy link
Member

Merged to master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants