Skip to content

SPARK-2791: Fix committing, reverting and state tracking in shuffle file consolidation - #1678

Closed
aarondav wants to merge 3 commits into
apache:masterfrom
aarondav:consol
Closed

aarondav wants to merge 3 commits into
apache:masterfrom
aarondav:consol

Conversation

@aarondav

Copy link
Copy Markdown
Contributor

All changes from this PR are by @mridulm and are drawn from his work in #1609. This patch is intended to fix all major issues related to shuffle file consolidation that @mridulm found, while minimizing changes to the code, with the hope that it may be more easily merged into 1.1.

This patch is not intended as a replacement for #1609, which provides many additional benefits, including fixes to ExternalAppendOnlyMap, improvements to DiskBlockObjectWriter's API, and several new unit tests.

If it is feasible to merge #1609 for the 1.1 deadline, that is a preferable option.

@SparkQA

SparkQA commented Jul 31, 2014

Copy link
Copy Markdown

QA tests have started for PR 1678. This patch merges cleanly.
View progress: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/17535/consoleFull

@aarondav aarondav mentioned this pull request Jul 31, 2014
5 tasks done
@SparkQA

SparkQA commented Jul 31, 2014

Copy link
Copy Markdown

QA results for PR 1678:
- This patch FAILED unit tests.
- This patch merges cleanly
- This patch adds no public classes

For more information see test ouptut:
https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/17535/consoleFull

aarondav added 2 commits July 30, 2014 19:08
All changes from this PR are by @mridulm and are drawn from his work in apache#1609.
This patch is intended to fix all major issues related to shuffle file consolidation
that @mridulm found, while minimizing changes to the code, with the hope that it may
be more easily merged into 1.1.

This patch is **not** intended as a replacement for apache#1609, which provides many
additional benefits, including fixes to ExternalAppendOnlyMap, improvements to
DiskBlockObjectWriter's API, and several new unit tests.

If it is feasible to merge apache#1609 for the 1.1 deadline, that is a preferable option.
@SparkQA

SparkQA commented Jul 31, 2014

Copy link
Copy Markdown

QA tests have started for PR 1678. This patch merges cleanly.
View progress: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/17537/consoleFull

@aarondav

Copy link
Copy Markdown
Contributor Author

@mridulm Please take a look if possible.

@mateiz This now interacts with the ExternalSorter stuff, and it's possible it partially helps fix a serialization bug (since some serializers apparently write things during a close() after a flush()).

@witgo

witgo commented Jul 31, 2014

Copy link
Copy Markdown
Contributor

We can also merge it to 1.0 branch.

@mateiz

mateiz commented Jul 31, 2014

Copy link
Copy Markdown
Contributor

That's true, this is small enough to add back into branch-1.0 too. We should see if we can do the same for the rest of #1609 too (ideally I would like to merge that whole PR into branch-1.0, but I'm not sure how easy that is).

@SparkQA

SparkQA commented Jul 31, 2014

Copy link
Copy Markdown

QA results for PR 1678:
- This patch FAILED unit tests.
- This patch merges cleanly
- This patch adds no public classes

For more information see test ouptut:
https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/17537/consoleFull

@SparkQA

SparkQA commented Jul 31, 2014

Copy link
Copy Markdown

QA tests have started for PR 1678. This patch merges cleanly.
View progress: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/17553/consoleFull

@SparkQA

SparkQA commented Jul 31, 2014

Copy link
Copy Markdown

QA results for PR 1678:
- This patch FAILED unit tests.
- This patch merges cleanly
- This patch adds no public classes

For more information see test ouptut:
https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/17553/consoleFull

@aarondav

Copy link
Copy Markdown
Contributor Author

Jenkins, retest this please.

@SparkQA

SparkQA commented Jul 31, 2014

Copy link
Copy Markdown

QA tests have started for PR 1678. This patch merges cleanly.
View progress: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/17565/consoleFull

@SparkQA

SparkQA commented Jul 31, 2014

Copy link
Copy Markdown

QA results for PR 1678:
- This patch FAILED unit tests.
- This patch merges cleanly
- This patch adds no public classes

For more information see test ouptut:
https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/17565/consoleFull

@aarondav

Copy link
Copy Markdown
Contributor Author

Both prior failures are due to being unable to bind to ports, which sounds like leftover state from other jenkins runs (especially since they were two entirely disjoint sets of failed tests related to port binding).

@aarondav

Copy link
Copy Markdown
Contributor Author

Jenkins, retest this please.

@SparkQA

SparkQA commented Jul 31, 2014

Copy link
Copy Markdown

QA tests have started for PR 1678. This patch merges cleanly.
View progress: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/17585/consoleFull

@SparkQA

SparkQA commented Jul 31, 2014

Copy link
Copy Markdown

QA results for PR 1678:
- This patch PASSES unit tests.
- This patch merges cleanly
- This patch adds no public classes

For more information see test ouptut:
https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/17585/consoleFull

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.

revert can throw exception : which will cause other writers to not revert.
We need to wrap it in try/catch, log and continue

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Revert actually doesn't throw, per its (updated) comment.

@mateiz

mateiz commented Aug 1, 2014

Copy link
Copy Markdown
Contributor

Jenkins, test this please

@SparkQA

SparkQA commented Aug 1, 2014

Copy link
Copy Markdown

QA tests have started for PR 1678. This patch merges cleanly.
View progress: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/17689/consoleFull

@SparkQA

SparkQA commented Aug 1, 2014

Copy link
Copy Markdown

QA results for PR 1678:
- This patch PASSES unit tests.
- This patch merges cleanly
- This patch adds no public classes

For more information see test ouptut:
https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/17689/consoleFull

@mateiz

mateiz commented Aug 1, 2014

Copy link
Copy Markdown
Contributor

@aarondav can you update the name of this PR to reference this sub-task JIRA instead: https://issues.apache.org/jira/browse/SPARK-2791?

@aarondav aarondav changed the title SPARK-2532: Minimal shuffle consolidation fixes SPARK-2791: Fix committing, reverting and state tracking in shuffle file consolidation Aug 1, 2014
@aarondav

aarondav commented Aug 1, 2014

Copy link
Copy Markdown
Contributor Author

Updated title.

@mateiz

mateiz commented Aug 1, 2014

Copy link
Copy Markdown
Contributor

Alright, going to merge it then. The changes look good to me.

@asfgit asfgit closed this in 78f2af5 Aug 1, 2014
xiliu82 pushed a commit to xiliu82/spark that referenced this pull request Sep 4, 2014
…ile consolidation

All changes from this PR are by mridulm and are drawn from his work in apache#1609. This patch is intended to fix all major issues related to shuffle file consolidation that mridulm found, while minimizing changes to the code, with the hope that it may be more easily merged into 1.1.

This patch is **not** intended as a replacement for apache#1609, which provides many additional benefits, including fixes to ExternalAppendOnlyMap, improvements to DiskBlockObjectWriter's API, and several new unit tests.

If it is feasible to merge apache#1609 for the 1.1 deadline, that is a preferable option.

Author: Aaron Davidson <aaron@databricks.com>

Closes apache#1678 from aarondav/consol and squashes the following commits:

53b3f6d [Aaron Davidson] Correct behavior when writing unopened file
701d045 [Aaron Davidson] Rebase with sort-based shuffle
9160149 [Aaron Davidson] SPARK-2532: Minimal shuffle consolidation fixes

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.

This catches Exception but it could catch IOException instead.

sunchao pushed a commit to sunchao/spark that referenced this pull request Jun 2, 2023
Co-authored-by: Russell Spitzer <russell.spitzer@gmail.com>
MaxGekk added a commit to MaxGekk/spark that referenced this pull request Nov 24, 2026
…e#1678)

### What changes were proposed in this pull request?

`varka-option-matrix.yml` can now run a pull request's option matrix on vecbricks/varka's runners, beside the fork's (MaxGekk/spark).

- New dispatch inputs `pr` and `sha`, for vecbricks/varka only. There a dispatch without them fails, and the fork refuses them. Each checkout (build, bins, report) takes vecbricks/varka at `sha`, which is the pull request's head. The first step of the build job checks with `git ls-remote` that `refs/pull/<pr>/head` is still `sha`, and fails the run if it is not. The run is named `Varka option matrix of #<pr> at <sha>`. Without `pr` the name stays `Varka option matrix`.
- New dispatch input `slots`, which sets the bins' `max-parallel`. If it is blank, the value is 16 on vecbricks/varka and 38 on other repositories, as before.
- The build job runs only for a dispatch, so it refuses the Sunday schedule on both repositories until row 522 moves the schedule to the fork (`m9/VARKA-522.md` 2.1, which gets a dated line). Before this change the schedule ran only on vecbricks/varka, where the workflow has been disabled since 29 October, so enabling it there would have started a full matrix on 20 runners every week.
- A run with `pr` does not look for the fork's Build. It compiles the test classes itself and says why in its warning.
- The workflow token is read-only (`contents: read`, `actions: read`), and the checkouts do not keep it. `report-failure` keeps its own permissions.
- A run with `pr` saves its sbt and Coursier caches under `pr-` keys, which no other run restores, and does not save the engine's Maven cache. The pull request's code writes those directories, and the run saves them in master's scope.
- `VARKA-638.md` section 8 gets a dated note: the owner's word of 23 November overtakes its "not a row now". `sql/varka/AGENTS.md` and `skills/testing-and-debugging.md` no longer mention a weekly option matrix.

### Why are the changes needed?

On 23 November about 380 option-matrix jobs waited on the fork's 40 runners at midday, while most of vecbricks/varka's 20 runners were idle between benchmarks. A pull request's branch lives on the fork, so a vecbricks/varka dispatch runs from master, and before this change the workflow could only test master there. With `pr` and `sha` it tests the pull request's head. The cap of 16 bins leaves runners for the benchmarks. A vecbricks/varka run cannot download the fork Build's artifacts without a token (an unauthenticated download returns 401), so it compiles and runs without the reach record. This makes it about 2.5 to 3 times slower than a run on an idle fork. The dispatcher outside the repository sends a matrix there only when the fork's queue is long.

### Does this PR introduce _any_ user-facing change?

No. It changes only a CI workflow, a plan and two developer documents.

### How was this patch tested?

Master `0d99ed25ba0` (with apache#1659, row 570's straggler stop, and apache#1677) is merged in `c26ba5e2878`. The one conflict was the dispatch inputs: master's `plant-straggler` now sits beside `pr`, `sha` and `slots`, and the rewritten "Run this bin's units" step merged unchanged under this branch's checkouts. After the merge `actionlint` and the selftests of `dev/varka_bin_units_test.py`, `varka_matrix_bins.py`, `varka_matrix_reuse.py`, `varka_matrix_stragglers.py`, `varka_ci_ledger.py` and `varka_scheduled_failure_test.py` pass, and the light gate passed on `088c275fc18`.

Before the merge, the local gate passed on `77cae98b6ba` as a light gate: master `323733401c6` already merged, no regeneration needed, lints, Error Prone and the push check passed (152 counted lines), no suite to sweep. Also `actionlint`, a YAML parse of the new expressions, and `dev/varka_bin_units_test.py --selftest`, which runs the bin step's shell from the workflow. A GitHub Actions run is the first real check: a fork dispatch without `pr` (the old path), then one vecbricks/varka dispatch with `pr`, after this merges and the workflow is enabled there.

### Review

`/code-review high` on `b619370a5f4` found four important problems and four nits. All are fixed in `a8bced1cb7e`, except one nit noted below. The important ones:
- A dispatch on vecbricks/varka without `pr` skipped every job instead of failing. It now fails in the input check.
- A fork dispatch with `pr` gave up the fork's own Build reuse, and the CI tools would have filed its results under the dispatched commit. The fork now refuses `pr`.
- A pull request run could save caches that master's runs restore. It now uses `pr-` keys.

The nits: the dead schedule (kept, since row 522 turns it to the fork, and the comments say so in `77cae98b6ba`), the docs that named a weekly run, a comment on the reuse step, and a note that the dispatcher, not a `concurrency` group, keeps vecbricks/varka to one matrix at a time. A group would cancel the older of two pending runs.

A second `/code-review high`, after the merge of master, found nothing in the resolution. Its nits are fixed in `088c275fc18`: the testing skill no longer promises a run "a day later", `AGENTS.md` says a vecbricks/varka run has no reach record and runs every test, and `VARKA-522.md` names `report-failure`'s condition instead of stale line numbers. Its important findings are trade-offs of this design, kept:
- Pull request runs share their `pr-` caches with each other, and a pull request's code runs in a job scoped to master's caches. Every pull request on vecbricks/varka is the owner's, and only the owner dispatches.
- On vecbricks/varka master's copy of the workflow runs over the pull request's scripts. The dispatcher refuses a pull request that changes this workflow, so such a pull request's matrix runs on the fork.
- The CI readers that look for a matrix by branch and head on the fork (`watch-any-ready.sh`, `watch-infra.sh`, `matrix-link.sh`, `dev/varka_ci_ledger.py`) do not see a vecbricks/varka run, whose branch is master and whose pull request head is only in its title. A follow-up teaches them the title lookup. Until then the run is read through its link on the pull request.
- There is still no `concurrency` group, for the reason above.

### Was this patch authored or co-authored using generative AI tooling?

Generated-by: Claude Code (Claude Opus 5.5)
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.

6 participants