Commit 0c38ebb
fix: drop input plan early in
## Which issue does this PR close?
<!--
We generally require a GitHub issue to be filed for all bug fixes and
enhancements and this helps us generate change logs for our releases.
You can link an issue to this PR using the GitHub syntax. For example
`Closes #123` indicates that this PR will close issue #123.
-->
- Closes #22016
## Rationale for this change
<!--
Why are you proposing this change? If this is already explained clearly
in the issue then this section is not needed.
Explaining clearly why changes are proposed helps reviewers understand
your changes and offer better suggestions for fixes.
-->
- `CoalescePartitionsExec` uses `RecordBatchReceiverStreamBuilder` which
was holding to an Arc ref of the input plan, until the stream was done.
- More details in the issue.
## What changes are included in this PR?
<!--
There is no need to duplicate the description in the issue here but it
is sometimes worth providing a summary of the individual changes in this
PR.
-->
- Now we drop the input plan early.
- The only other usage of `input` was in debug prints, to display the
input plan. We now take the display string early, but only when debug
logging is enabled.
## Are these changes tested?
<!--
We typically require tests for all PRs in order to:
1. Prevent the code from being accidentally broken by subsequent changes
2. Serve as another way to document the expected behavior of the code
If tests are not included in your PR, please explain why (for example,
are they covered by existing tests)?
-->
- Added a test that ensures this. Verified that the test fails without
the fix.
The reproducer (Samyak2#1) before the
fix:
```
repartition_task_group=0 input_partition=0 kind=pull_from_input drop_elapsed_ms=68
repartition_task_group=1 input_partition=0 kind=pull_from_input drop_elapsed_ms=80
repartition_task_group=1 input_partition=1 kind=pull_from_input drop_elapsed_ms=85
output_partitions=32 input_rows_per_partition=1024000 all_repartition_operator_drop_elapsed_ms=80
all_repartition_task_drop_elapsed_ms=85
all_observed_drop_elapsed_ms=85
```
~85ms to cancel repartition tasks.
After fix:
```
repartition_task_group=0 input_partition=0 kind=pull_from_input drop_elapsed_ms=16
repartition_task_group=1 input_partition=0 kind=pull_from_input drop_elapsed_ms=0
repartition_task_group=1 input_partition=1 kind=pull_from_input drop_elapsed_ms=0
output_partitions=32 input_rows_per_partition=1024000 all_repartition_operator_drop_elapsed_ms=0
all_repartition_task_drop_elapsed_ms=16
all_observed_drop_elapsed_ms=16
```
~16ms to cancel repartition tasks.
## Are there any user-facing changes?
<!--
If there are user-facing changes then we may require documentation to be
updated before approving the PR.
-->
<!--
If there are any breaking changes to public APIs, please add the `api
change` label.
-->
CPU/memory gets released earlier on cancellation
---------
Co-authored-by: Kumar Ujjawal <ujjawalpathak6@gmail.com>CoalescePartitionsExec (#22017)1 parent 6b27d2d commit 0c38ebb
2 files changed
Lines changed: 56 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
351 | 351 | | |
352 | 352 | | |
353 | 353 | | |
354 | | - | |
| 354 | + | |
355 | 355 | | |
356 | 356 | | |
357 | 357 | | |
358 | 358 | | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
359 | 362 | | |
360 | 363 | | |
361 | 364 | | |
| |||
390 | 393 | | |
391 | 394 | | |
392 | 395 | | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
393 | 435 | | |
394 | 436 | | |
395 | 437 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
330 | 330 | | |
331 | 331 | | |
332 | 332 | | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
333 | 338 | | |
334 | 339 | | |
335 | 340 | | |
| |||
338 | 343 | | |
339 | 344 | | |
340 | 345 | | |
341 | | - | |
342 | | - | |
| 346 | + | |
343 | 347 | | |
344 | 348 | | |
345 | 349 | | |
346 | 350 | | |
347 | 351 | | |
348 | 352 | | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
349 | 358 | | |
350 | 359 | | |
351 | 360 | | |
| |||
355 | 364 | | |
356 | 365 | | |
357 | 366 | | |
358 | | - | |
359 | | - | |
| 367 | + | |
360 | 368 | | |
361 | 369 | | |
362 | 370 | | |
363 | 371 | | |
364 | 372 | | |
365 | 373 | | |
366 | 374 | | |
367 | | - | |
368 | | - | |
369 | | - | |
370 | | - | |
| 375 | + | |
371 | 376 | | |
372 | 377 | | |
373 | 378 | | |
| |||
0 commit comments