Repository navigation
[cherry-pick][2.59.0][Data] Count Materialized Data as Downstream Capacity (#66226) - #66371
Conversation
`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]>
There was a problem hiding this comment.
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.
| ref_bundles = [] | ||
| for ref_bundle in ref_bundles_iter: | ||
| stats.iter_prefetched_bytes += ref_bundle.size_bytes() | ||
| ref_bundles.append(ref_bundle) |
There was a problem hiding this comment.
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.
| 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) |
Cherry-pick of #66226 (master commit b18315e) onto releases/2.59.0.
🤖 Generated with Claude Code