[core] Reject a merge fan-in below two up front - #10293
Open
LuciferYang wants to merge 1 commit into
Open
LuciferYang wants to merge 1 commit into
LuciferYang wants to merge 1 commit into
Conversation
A local-sort.max-num-file-handles of 1 has no validator; with at least two spilled runs the merge arithmetic overflowed (numMerges = ceil(n/0)) and the flush crashed with a confusing subList argument error, restart-looping the job on the same configuration. Reject a fan-in below 2 in the external merger constructor. Assisted-by: GLM-5.3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Purpose
local-sort.max-num-file-handles(the external-merge fan-in, default 128) has no lower-bound validation, so it can be set to 1. With fan-in = 1,AbstractBinaryExternalMerger.mergeChannelListdivides bymaxFanIn - 1 = 0once a second spill file forms, producingInteger.MAX_VALUEmerges and a negativesubListargument, so the sort crashes withIllegalArgumentException. Because it only triggers on the second spill, a fan-in of 1 passes small-data testing and then crash-loops in production as data grows (the job restarts on the same config and fails again).This adds a
checkArgument(maxFanIn >= 2, ...)in theAbstractBinaryExternalMergerconstructor naminglocal-sort.max-num-file-handles, converting the latent, data-volume-dependent crash into a deterministic, actionable configuration error at construction time. The merger constructor is the single chokepoint through which every fan-in call path passes. A fan-in of 1 is degenerate for a merge sort (it can never converge N runs), so this rejects no legitimate configuration.This closes #10292.
Tests
BinaryExternalSortBufferTest#testFanInBelowTwoFailsFastpins that constructing with a fan-in below two fails fast. Without the guard, construction succeeds and the crash only surfaces later on the second spill.API and Format
No.
Documentation
No.