Skip to content

[cherry-pick][2.59.0][Data] Count Materialized Data as Downstream Capacity (#66226) - #66371

Merged
elliot-barn merged 1 commit into
releases/2.59.0from
cherry-pick-66226-2.59.0
Sep 22, 2026
Merged

elliot-barn merged 1 commit into
releases/2.59.0from
cherry-pick-66226-2.59.0

Conversation

@elliot-barn

Copy link
Copy Markdown
Collaborator

Cherry-pick of #66226 (master commit b18315e) onto releases/2.59.0.

🤖 Generated with Claude Code

`lightgbm_train_batch_inference_benchmark_100G` times out at 600s with
`ReadParquet` pinned at `Tasks: 1
[backpressured:tasks(DownstreamCapacity)]`, turning a ~40s read into
400-560s.

Since #64456 the resource manager tracks object store memory with
`BlockRefCounter`, which counts a block until every reference to it is
gone. The train loop calls `materialize()` on its shard
(`train_batch_inference_benchmark.py:70`), so those blocks stay in the
producing operator's ref-counted output and
`DownstreamCapacityBackpressurePolicy` reads them as output waiting to
be consumed. The ratio only grows, and the producer is throttled for
memory it cannot release by slowing down.

The consumer now reports what it holds, and the policy counts it as
downstream capacity rather than as output waiting to be consumed.
Accounting is unchanged; those bytes really are in the object store and
still count toward every budget.

---------

Signed-off-by: Sirui Huang <[email protected]>
(cherry picked from commit b18315e)
Signed-off-by: elliot-barn <[email protected]>
@elliot-barn
elliot-barn requested a review from a team as a code owner September 22, 2026 14:14

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request ensures that the prefetched bytes stat is correctly updated during dataset materialization and reset between executions of the stream split iterator to prevent incorrect backpressure. A unit test has been added to verify this behavior. The review feedback correctly identifies a potential AttributeError in the materialization logic where the 'stats' object could be None, and suggests adding a null check to safeguard the operation.

Comment on lines +1253 to +1256
ref_bundles = []
for ref_bundle in ref_bundles_iter:
stats.iter_prefetched_bytes += ref_bundle.size_bytes()
ref_bundles.append(ref_bundle)

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.

high

The stats variable returned by _to_ref_bundle_iterator() is typed as Optional[DatasetStats] and can be None. Accessing stats.iter_prefetched_bytes directly without a null check will raise an AttributeError if stats is indeed None. Please add a guard to ensure stats is not None before updating iter_prefetched_bytes.

Suggested change
ref_bundles = []
for ref_bundle in ref_bundles_iter:
stats.iter_prefetched_bytes += ref_bundle.size_bytes()
ref_bundles.append(ref_bundle)
ref_bundles = []
for ref_bundle in ref_bundles_iter:
if stats is not None:
stats.iter_prefetched_bytes += ref_bundle.size_bytes()
ref_bundles.append(ref_bundle)

@elliot-barn
elliot-barn merged commit 05d558d into releases/2.59.0 Sep 22, 2026
3 of 5 checks passed
@elliot-barn
elliot-barn deleted the cherry-pick-66226-2.59.0 branch September 22, 2026 14:15
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.

2 participants