Commit c685c43
[SPARK-46700][CORE] Count the last spilling for the shuffle disk spilling bytes metric
### What changes were proposed in this pull request?
This PR fixes a long-standing bug in ShuffleExternalSorter about the "spilled disk bytes" metrics. When we close the sorter, we will spill the remaining data in the buffer, with a flag `isLastFile = true`. This flag means the spilling will not increase the "spilled disk bytes" metrics. This makes sense if the sorter has never spilled before, then the final spill file will be used as the final shuffle output file, and we should keep the "spilled disk bytes" metrics as 0. However, if spilling did happen before, then we simply miscount the final spill file for the "spilled disk bytes" metrics today.
This PR fixes this issue, by setting that flag when closing the sorter only if this is the first spilling.
### Why are the changes needed?
make metrics accurate
### Does this PR introduce _any_ user-facing change?
no
### How was this patch tested?
updated tests
### Was this patch authored or co-authored using generative AI tooling?
no
Closes apache#44709 from cloud-fan/shuffle.
Authored-by: Wenchen Fan <wenchen@databricks.com>
Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
(cherry picked from commit 4ea3742)
Signed-off-by: Dongjoon Hyun <dhyun@apple.com>1 parent a88eb7e commit c685c43
File tree
3 files changed
+33
-27
lines changed- core/src
- main/java/org/apache/spark/shuffle/sort
- test/java/org/apache/spark/shuffle/sort
3 files changed
+33
-27
lines changedLines changed: 20 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
153 | | - | |
154 | | - | |
155 | | - | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
156 | 156 | | |
157 | | - | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
158 | 168 | | |
159 | 169 | | |
160 | 170 | | |
| |||
167 | 177 | | |
168 | 178 | | |
169 | 179 | | |
170 | | - | |
| 180 | + | |
171 | 181 | | |
172 | 182 | | |
173 | 183 | | |
174 | 184 | | |
175 | 185 | | |
176 | 186 | | |
| 187 | + | |
177 | 188 | | |
178 | 189 | | |
179 | 190 | | |
| |||
246 | 257 | | |
247 | 258 | | |
248 | 259 | | |
249 | | - | |
| 260 | + | |
250 | 261 | | |
251 | 262 | | |
252 | 263 | | |
| |||
281 | 292 | | |
282 | 293 | | |
283 | 294 | | |
284 | | - | |
285 | | - | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | 295 | | |
291 | 296 | | |
292 | 297 | | |
| |||
440 | 445 | | |
441 | 446 | | |
442 | 447 | | |
443 | | - | |
444 | | - | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
445 | 451 | | |
446 | 452 | | |
447 | 453 | | |
| |||
Lines changed: 0 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
327 | 327 | | |
328 | 328 | | |
329 | 329 | | |
330 | | - | |
331 | | - | |
332 | | - | |
333 | | - | |
334 | | - | |
335 | | - | |
336 | 330 | | |
337 | 331 | | |
338 | 332 | | |
| |||
Lines changed: 13 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
69 | 69 | | |
70 | 70 | | |
71 | 71 | | |
| 72 | + | |
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
| |||
96 | 97 | | |
97 | 98 | | |
98 | 99 | | |
| 100 | + | |
99 | 101 | | |
100 | 102 | | |
101 | 103 | | |
| |||
160 | 162 | | |
161 | 163 | | |
162 | 164 | | |
163 | | - | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
164 | 170 | | |
165 | 171 | | |
166 | 172 | | |
| |||
284 | 290 | | |
285 | 291 | | |
286 | 292 | | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
287 | 296 | | |
288 | 297 | | |
289 | 298 | | |
| |||
425 | 434 | | |
426 | 435 | | |
427 | 436 | | |
428 | | - | |
429 | | - | |
430 | 437 | | |
| 438 | + | |
431 | 439 | | |
432 | 440 | | |
433 | 441 | | |
| |||
517 | 525 | | |
518 | 526 | | |
519 | 527 | | |
520 | | - | |
521 | | - | |
522 | 528 | | |
| 529 | + | |
523 | 530 | | |
524 | 531 | | |
525 | 532 | | |
| |||
550 | 557 | | |
551 | 558 | | |
552 | 559 | | |
553 | | - | |
554 | | - | |
555 | 560 | | |
| 561 | + | |
556 | 562 | | |
557 | 563 | | |
558 | 564 | | |
| |||
0 commit comments