Skip to content

[SPARK-41246][CORE] Parse RDD block ids whose RDD id overflowed to negative - #57893

Open
giriprakash wants to merge 4 commits into
apache:masterfrom
giriprakash:SPARK-41246-negative-rdd-block-id
Open

[SPARK-41246][CORE] Parse RDD block ids whose RDD id overflowed to negative#57893
giriprakash wants to merge 4 commits into
apache:masterfrom
giriprakash:SPARK-41246-negative-rdd-block-id

Conversation

@giriprakash

Copy link
Copy Markdown

What changes were proposed in this pull request?

Allow BlockId.apply to parse RDD block names whose RDD id is negative, e.g. rdd_-1330910599_36.

RDDBlockId.name already renders negative ids with a leading minus sign. The only change is to make the RDD id regex accept an optional minus so the name round-trips through BlockId.apply. The split index stays non-negative, and no other block id pattern is changed.

Why are the changes needed?

SparkContext hands out RDD ids from a 32-bit AtomicInteger that never resets while the application runs. After Int.MaxValue RDDs, the counter wraps to negative values. Cached blocks then get names such as rdd_-1330910599_36. Paths that reconstruct a BlockId from its name — including UpdateBlockInfo.readExternal — failed with UnrecognizedBlockId because the parser only accepted digits. The application stayed up, but queries kept failing until restart.

This matches the failure mode described in SPARK-41246.

Does this PR introduce any user-facing change?

Yes. Applications that previously failed with UnrecognizedBlockId after the RDD id counter overflowed can now parse and use those block ids. Behavior for all previously valid (non-negative) RDD block ids is unchanged.

How was this patch tested?

Added a unit test in BlockIdSuite that:

  • parses the reported failing name rdd_-1330910599_36
  • parses rdd_-2147483648_0 (Int.MinValue)
  • confirms positive ids still round-trip and remain distinct from their negative counterparts

Please run:

build/sbt "core/testOnly org.apache.spark.storage.BlockIdSuite"

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

Generated-by: Cursor Agent

…gative

RDD ids are handed out by a 32-bit counter that never resets while the
application runs, so an application creating more than Int.MaxValue RDDs
wraps around to negative ids. RDDBlockId.name already renders those with a
leading minus sign, but BlockId.apply only accepted digits, so it could not
parse its own output and every path reconstructing a BlockId from its name
(such as UpdateBlockInfo.readExternal) failed with UnrecognizedBlockId until
the application was restarted.

Allow an optional minus sign on the RDD id group so the name round-trips.
The split index stays non-negative and no other block id pattern changes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant