Skip to content

SPARK-983. Support external sorting in sortByKey() - #1677

Closed
mateiz wants to merge 1 commit into
apache:masterfrom
mateiz:spark-983
Closed

mateiz wants to merge 1 commit into
apache:masterfrom
mateiz:spark-983

Conversation

@mateiz

@mateiz mateiz commented Jul 31, 2014

Copy link
Copy Markdown
Contributor

This patch simply uses the ExternalSorter class from sort-based shuffle.

Closes #931 and Closes #1090

This patch simply uses the ExternalSorter class from sort-based shuffle.
@SparkQA

SparkQA commented Jul 31, 2014

Copy link
Copy Markdown

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

@SparkQA

SparkQA commented Jul 31, 2014

Copy link
Copy Markdown

QA results for PR 1677:
- 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/17532/consoleFull

@pwendell

Copy link
Copy Markdown
Contributor

@mateiz could you put "Closes #931 and Closes #1090 in the description?" This will clean up the earlier work on this feature.

@pwendell

Copy link
Copy Markdown
Contributor

Jenkins, test this please.

@SparkQA

SparkQA commented Jul 31, 2014

Copy link
Copy Markdown

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

@SparkQA

SparkQA commented Jul 31, 2014

Copy link
Copy Markdown

QA results for PR 1677:
- 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/17552/consoleFull

@mateiz

mateiz commented Jul 31, 2014

Copy link
Copy Markdown
Contributor Author

Added "closes" comment

@mateiz

mateiz commented Aug 1, 2014

Copy link
Copy Markdown
Contributor Author

@pwendell is this okay to merge?

@pwendell

pwendell commented Aug 1, 2014

Copy link
Copy Markdown
Contributor

Go for it

@asfgit asfgit closed this in 72e3369 Aug 1, 2014
xiliu82 pushed a commit to xiliu82/spark that referenced this pull request Sep 4, 2014
This patch simply uses the ExternalSorter class from sort-based shuffle.

Closes apache#931 and Closes apache#1090

Author: Matei Zaharia <matei@databricks.com>

Closes apache#1677 from mateiz/spark-983 and squashes the following commits:

96b3fda [Matei Zaharia] SPARK-983. Support external sorting in sortByKey()
MaxGekk added a commit to MaxGekk/spark that referenced this pull request Nov 23, 2026
…apache#1677)

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

Three changes made to the owner's local gate scripts on 23 November 2026 move into the repository's copies under `dev/varka_ops/`:

- `pre-pr.sh` runs the regeneration with `-Dvarka.widthAudit.childTimeoutSeconds=2400` in `JDK_JAVA_OPTIONS`, added to any value already set. `PRE_PR_WIDTH_AUDIT_TIMEOUT` changes the number. Only the regeneration sees it, so the extra gate and the arm sweep do not.
- `pre-pr-slot.sh` runs two gates at once: `PRE_PR_SLOTS` defaults to 2, not 1.
- Committed benchmark results (`sql/<module>/benchmarks/*.txt`) are no longer an input of the generated files (`ops_regen_inputs` in `common.sh`). So `pre-pr-slot.sh` treats a branch of only results as a light gate, which starts at once, and `pre-pr.sh` skips its regeneration and runs only the census check.
- A bad `PRE_PR_WIDTH_AUDIT_TIMEOUT` (not a positive whole number) stops the gate with exit 2 before the merge.

`README.md`, `INDEX.md` and `AGENTS.md` describe the new behaviour.

### Why are the changes needed?

- The width audit gives each probe JVM 600 s by default. Beside a second gate the probes ran past that: the 30-standins, 611 and 343b2a gates failed this way today. 103a2's regeneration used 2400 s and passed.
- One slot made every gate wait for the one before it. A two-slot trial today, 601's gate beside 612's, had no probe timeout, and the arm sweep is now narrowed (apache#1667), so a gate holds fewer JVMs.
- A branch of only benchmark results waited behind code gates, although no generated file reads those results and it runs no sweep.

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

No. It changes only the developer scripts under `dev/varka_ops/`.

### How was this patch tested?

The local gate passed on `86599a96f50` as a light gate: master `323733401c6` already merged, regeneration skipped, lints, Error Prone and the push check passed (74 counted lines), and no suite to sweep.

<details>
<summary>Full test record</summary>

- `bash -n` and `shellcheck` on `pre-pr.sh`, `pre-pr-slot.sh` and `common.sh`: no new findings (only the existing info notes).
- `PRE_PR_DRY=1 PRE_PR_FORCE_REGEN=1 pre-pr.sh` printed that the regeneration runs with `-Dvarka.widthAudit.childTimeoutSeconds=2400` added to `JDK_JAVA_OPTIONS`; an earlier version of the same run with `JDK_JAVA_OPTIONS=-Xss4m` and `PRE_PR_WIDTH_AUDIT_TIMEOUT=900` showed `-Xss4m -Dvarka.widthAudit.childTimeoutSeconds=900`. `PRE_PR_WIDTH_AUDIT_TIMEOUT=40m` and `=0` exit 2.
- `PRE_PR_DRY=1 pre-pr-slot.sh` on this branch printed the light-gate line.
- The filter on file lists: `sql/core/benchmarks/X-results.txt` and `sql/hive/benchmarks/X-results.txt` are no input; `sql/core/benchmarks/sub/x.txt`, a `FooBenchmark.scala` and a results file beside a `*Suite.scala` are heavy.

Not run: a CI Build and the option matrix.

</details>

### Review

`/code-review high` on `239b5258640` found two important problems and five nits, all fixed in `86599a96f50`. The two important ones: the slot called a results-only branch light, but the gate still ran its regeneration, which `dev/varka_regen_inputs.py` could turn into a full width audit (for Hive results, or after a JDK update). Now the results are no input of the generated files, so the gate skips that regeneration. The nits: the dry run printed the caller's `JDK_JAVA_OPTIONS` (now only the added option), the timeout was not checked, and some comments told history or fixed the defaults.

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

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

3 participants