Skip to content

[FileWrites] Allow maxNumWritersPerBundle to exceed DEFAULT_MAX_NUM_WRITERS_PER_BUNDLE (20) - #40842

Merged
Abacn merged 1 commit into
apache:masterfrom
darshan-sj:openWritersLimitIncrease
Oct 27, 2026
Merged

Abacn merged 1 commit into
apache:masterfrom
darshan-sj:openWritersLimitIncrease

Conversation

@darshan-sj

Copy link
Copy Markdown
Contributor

[Java SDK - WriteFiles] Allow maxNumWritersPerBundle to exceed DEFAULT_MAX_NUM_WRITERS_PER_BUNDLE (20)

Summary & Motivation

Currently, WriteFiles.withMaxNumWritersPerBundle(int) enforces an upper bound of DEFAULT_MAX_NUM_WRITERS_PER_BUNDLE (20):

While 20 is a conservative default to bound per-bundle buffer memory, pipelines writing to many dynamic destinations (especially when paired with .withEvictWritersWhenFull() introduced in #40200, or on workers with higher memory capacity) need the ability to increase maxNumWritersPerBundle above 20 (e.g., 50) to reduce writer eviction frequency or shuffle spilling.

As already documented in the WriteFiles.withMaxNumWritersPerBundle(int) Javadoc trade-offs, tuning maxNumWritersPerBundle higher trades additional worker memory for fewer writer evictions / less shuffle spilling.

Changes Made

  1. WriteFiles.withMaxNumWritersPerBundle(int) (WriteFiles.java):
    • Removed the maxNumWritersPerBundle <= DEFAULT_MAX_NUM_WRITERS_PER_BUNDLE upper-bound check while retaining maxNumWritersPerBundle > 0.
    • Updated the Javadoc to note that DEFAULT_MAX_NUM_WRITERS_PER_BUNDLE (20) is the default value rather than a hard maximum.
  2. Unit Tests (WriteFilesTest.java):
    • Added assertions in WriteFilesTest.testBuildWrite verifying that withMaxNumWritersPerBundle(50) succeeds and withMaxNumWritersPerBundle(0) throws IllegalArgumentException.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📋 Review Summary

This PR removes the upper-bound restriction (<= DEFAULT_MAX_NUM_WRITERS_PER_BUNDLE) in WriteFiles.withMaxNumWritersPerBundle(int) so users can configure a higher per-bundle writer limit when appropriate, while retaining the > 0 validation. The changes in WriteFiles.java and the unit tests in WriteFilesTest.java are clean, well-motivated, and safe.

🔍 General Feedback

  • The LinkedHashMap initialization and writer management in WriteUnshardedTempFilesFn handle values exceeding DEFAULT_MAX_NUM_WRITERS_PER_BUNDLE properly.
  • Javadoc and test updates accurately reflect the new behavior.

💡 Tip: Comment /gemini review on this pull request to trigger a new Gemini code review.

@github-actions github-actions Bot added java core size/s S: 10-49 lines changed labels Oct 27, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment assign set of reviewers

@bharadwaj-aditya bharadwaj-aditya left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

LGTM

@Abacn
Abacn merged commit 4fb2f32 into apache:master Oct 27, 2026
24 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core java size/s S: 10-49 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants