Skip to content

Conversation

dongjoon-hyun
Copy link
Member

@dongjoon-hyun dongjoon-hyun commented Oct 14, 2025

What changes were proposed in this pull request?

This PR aims to support spark.kubernetes.allocation.maximum.

Why are the changes needed?

Since we use AtomicInteger ID generator, we hit the overflow at Int.MaxValue. We had better throw exceptions explicitly in this case because it's highly a malfunctioning situation when a Spark driver tries to create 2147483647 (Int.MaxValue) executor pods.

$ jshell
|  Welcome to JShell -- Version 21.0.8
|  For an introduction type: /help intro

jshell> var x = new java.util.concurrent.atomic.AtomicInteger(Integer.MAX_VALUE)
x ==> 2147483647

jshell> x.incrementAndGet()
$2 ==> -2147483648

jshell> x.incrementAndGet()
$3 ==> -2147483647

jshell> x.incrementAndGet()
$4 ==> -2147483646

jshell> var x = new java.util.concurrent.atomic.AtomicInteger(-1)
x ==> -1

jshell> x.incrementAndGet()
$6 ==> 0

jshell> x.incrementAndGet()
$7 ==> 1

Does this PR introduce any user-facing change?

Practically no because a normal Spark job and K8s cluster cannot handle 2147483647 executor pod creation. If a user has this case, it means the ID overflow happens and the ID will be rotated to 0 and the executor IDs will be reused. It's already a bug situation.

How was this patch tested?

Pass the CIs with newly added test cases.

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

No.

Copy link
Contributor

@kazuyukitanimura kazuyukitanimura left a comment

Choose a reason for hiding this comment

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

Thank you @dongjoon-hyun LGTM

@dongjoon-hyun
Copy link
Member Author

Thank you, @kazuyukitanimura .

cc @peter-toth

@vrozov
Copy link
Member

vrozov commented Oct 14, 2025

+1, LGTM

@dongjoon-hyun
Copy link
Member Author

Thank you, @vrozov .

@dongjoon-hyun
Copy link
Member Author

Thank you, @HyukjinKwon . Merged to master for Apache Spark 4.1.0-preview3.

@dongjoon-hyun dongjoon-hyun deleted the SPARK-53907 branch October 15, 2025 00:19
dongjoon-hyun added a commit that referenced this pull request Oct 15, 2025
### What changes were proposed in this pull request?

This PR aims to document newly added K8s configurations as a part of Apache Spark 4.1.0 preparation.

### Why are the changes needed?

To sync the document with K8s `Config.scala`. For now, three PRs added four configurations.
- #51522
- #51811
- #52615

### Does this PR introduce _any_ user-facing change?

No behavior change. This is only adding new configuration documents.

### How was this patch tested?

Manual review.

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

No.

Closes #52618 from dongjoon-hyun/SPARK-53913.

Authored-by: Dongjoon Hyun <dongjoon@apache.org>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
Copy link
Contributor

@peter-toth peter-toth left a comment

Choose a reason for hiding this comment

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

Late LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants