Skip to content

ci: retry Maven downloads in the TPC-H and TPC-DS builds - #7828

Queued
adityavaish wants to merge 5 commits into
apache:mainfrom
adityavaish:adityavaish-retry-tpc-maven-downloads
Queued

adityavaish wants to merge 5 commits into
apache:mainfrom
adityavaish:adityavaish-retry-tpc-maven-downloads

Conversation

@adityavaish

@adityavaish adityavaish commented Dec 2, 2026 •

Copy link
Copy Markdown

Agent assessment

Self-reported assessment, not an independent review.

Assessed revision: 8caeb36fde623a099bef44aa74056a230b6c2a04

Dimension Assessment Rationale
Change confidence 9.5/10 ↑ Deduplicated the retry loop into dev/ci/mvn-retry.sh (100755, LF, Apache 2.0 header) across lint-java, both TPC-H/TPC-DS Build project steps, and both Generate TPC-H/TPC-DS data (exec:java) steps; passes bash -n, sh -n, YAML parsing, check-suites.py, all 18 check-ci-config.py invariants, and 13 behavioral retry tests.
↓ Live GitHub Actions execution and actionlint have not yet run on this branch.

Which issue does this PR close?

Closes #7759.

Rationale for this change

In cache-refresh-only mode, the TPC-H (verify-benchmark-results-tpch) and TPC-DS (verify-benchmark-results-tpcds) jobs are the only Maven builds in .github/workflows/pr_build_linux.yml. Without retry logic on transient Maven Central download failures (such as HTTP 403, cached 404, 429, or missing plugin/compiler artifacts), a failed build or exec:java data-generation step aborts the job before Save Maven dependencies runs and leaves fork caches cold.

What changes are included in this PR?

  • Added dev/ci/mvn-retry.sh, a shared executable bash helper that wraps any Maven invocation (dev/ci/mvn-retry.sh <mvnw> [args...]) with up to 4 attempts, 10s/20s/40s + 0-4s jitter backoff, -U on retries (so cached Maven 404s are refreshed), mktemp log cleanup via trap, and matching on [ERROR]/[FATAL] download failure markers (No plugin found for prefix, could not be resolved, Could not transfer, Could not find artifact, ClassNotFoundException: scala.tools.nsc.Main). Non-download failures (compile errors, lint violations) still fail on attempt 1.
  • Updated .github/workflows/pr_build_linux.yml to route five Maven steps through dev/ci/mvn-retry.sh and removed the duplicated inline retry script and shell: bash override:
    • lint-java: Run scalafix check
    • verify-benchmark-results-tpch: Build project and Generate TPC-H data (SF=1) (exec:java)
    • verify-benchmark-results-tpcds: Build project and Generate TPC-DS data (SF=1) (exec:java)

How are these changes tested?

  • git ls-files -s --eol dev/ci/mvn-retry.sh — confirmed mode 100755 and LF line endings.
  • bash -n dev/ci/mvn-retry.sh, yaml.safe_load on .github/workflows/pr_build_linux.yml, and sh -n on all 5 updated workflow step bodies — passed.
  • 13 behavioral tests against dev/ci/mvn-retry.sh under sh -e (root and spark/ subdirectory invocations with ../dev/ci/mvn-retry.sh ../mvnw, MAVEN_OPTS propagation, quoted -Dexec.args with spaces, 403/404/429/[FATAL]/Could not find artifact/No plugin found for prefix/ClassNotFoundException retries with -U, 4-attempt exhaustion, immediate failure on compile/lint errors, temp-file cleanup) — all 13 passed.
  • python dev/ci/check-suites.py — passed.
  • dev/ci/check-ci-config.py — all 18 workflow/policy/cache/checkout invariants and local_ci_config.config() passed, and confirmed dev/ci/mvn-retry.sh routes to build_linux / build_macos via dev/ci/** (running check_local_ci_config directly on Windows hits a pre-existing dev\local-ci.sh path separator quirk).

Wrap the `Build project` (`./mvnw -B -Prelease install -DskipTests`) steps
in `verify-benchmark-results-tpch` and `verify-benchmark-results-tpcds` in
`.github/workflows/pr_build_linux.yml` with the same bounded download-error
retry loop used by `lint-java` (up to 4 attempts, exponential backoff
10s/20s/40s + 0-4s jitter, `-U` on retries, `shell: bash`), so transient
Maven Central 429/403/404/transfer failures in cache-refresh-only mode do
not abort the build and skip saving the Maven cache.

Resolves apache#7759

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

@comphead comphead left a comment

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.

The loop is a faithful copy of the lint-java one, and .mvn/maven.config already retries transport errors and 408/429/5xx, so what this adds is retry for 403 and cached 404 with -U. Two things hold up as comments. The retried block is now copied three times, and the next Maven step in each job is still unprotected, so the stated goal (do not lose the cache save) is only partly met. I did not run any of this.

Comment thread .github/workflows/pr_build_linux.yml Outdated
Comment on lines +797 to +819
shell: bash
run: |
./mvnw -B -Prelease install -DskipTests
set -o pipefail
log=$(mktemp)
trap 'rm -f "$log"' EXIT
update=
for attempt in 1 2 3 4; do
if ./mvnw -B $update -Prelease install -DskipTests 2>&1 | tee "$log"; then
exit 0
fi
if ! grep -qE '^\[(ERROR|FATAL)\] .*(No plugin found for prefix|could not be resolved|Could not transfer|Could not find artifact|ClassNotFoundException: scala\.tools\.nsc\.Main)' "$log"; then
echo "::error::Maven failed for a reason other than a download, such as a compile error; not retrying."
exit 1
fi
if [ "$attempt" -eq 4 ]; then
echo "::error::Maven could not download a plugin or dependency after $attempt attempts."
exit 1
fi
delay=$((10 * (1 << (attempt - 1)) + RANDOM % 5))
echo "::warning::Maven failed to download a plugin or dependency (attempt $attempt of 4); retrying in ${delay}s with -U."
sleep "$delay"
update=-U
done

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 20-line script now exists three times (lint-java near line 223, here, and in verify-benchmark-results-tpcds near line 899), and the copies have already drifted: the new ones also match [FATAL] and Could not find artifact, lint-java does not. A single dev/ci/mvn-retry.sh taking the Maven arguments (called as dev/ci/mvn-retry.sh ./mvnw -B -Prelease install -DskipTests) would keep one regex and one backoff, remove the shell: bash and comment boilerplate from every call site, and let lint-java adopt the FATAL and Could not find artifact patterns too. These jobs already run actions/checkout, so a script path resolves.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Extracted into dev/ci/mvn-retry.sh in b6e54f869 (merged cleanly in 8caeb36fd) and wired lint-java, both TPC-H/TPC-DS Build project steps, and both data-generation steps through it, removing the duplicated inline retry loop and shell: bash boilerplate so all five call sites share one regex ([ERROR]/[FATAL], including Could not find artifact) and one backoff schedule.

Auto-replied by the GitHub Copilot app

update=-U
done

- name: Generate TPC-H data (SF=1)

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.

The step after the build, Generate TPC-H data, runs ../mvnw -B -Prelease exec:java ... (and Generate TPC-DS data does the same) with no retry. exec-maven-plugin is declared in spark/pom.xml only inside the generate-docs profile (line 638) and has no pluginManagement entry in the root pom.xml, so -Prelease install does not resolve it. I expect exec:java to do its own prefix lookup and plugin download, which is the No plugin found for prefix failure this PR retries one step earlier. A failure there also skips Save Maven dependencies, which is the problem the PR describes. Please either route these steps through the same retry or show that the build step already caches the plugin, for example from a cold-cache run.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Good catch—wrapped both Generate TPC-H data (SF=1) and Generate TPC-DS data (SF=1) (../mvnw -B -Prelease exec:java ...) with ../dev/ci/mvn-retry.sh in b6e54f869 (preserving cd spark, MAVEN_OPTS='-Xmx20g', and quoted -Dexec.args), so a transient exec-maven-plugin lookup/download failure is also retried before Save Maven dependencies.

Auto-replied by the GitHub Copilot app

@comphead comphead left a comment

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.

thanks @adityavaish, the PR goes into right direction, please check some nits!

@sunchao sunchao left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I exercised both install steps with Maven 3.9.6, a small test POM, and a local HTTP mirror, with the sleeps skipped. TPC-H recovered from a one-time 404 and TPC-DS from a one-time 403. Maven fetched the missing POM again with -U. A persistent 404 stopped after four attempts, and an invalid POM failed immediately. I found no additional issues in the install steps.

Automated review by Codex.

adityavaish and others added 3 commits December 2, 2026 17:18
…C data generation

Address review feedback on apache#7828:
- Extract the bounded Maven download-error retry loop into `dev/ci/mvn-retry.sh`
  so `lint-java` and the TPC-H/TPC-DS steps share one regex, backoff, `-U`
  retry flag injection, and temp-log cleanup without duplicating inline bash
  loops or `shell: bash` overrides in `.github/workflows/pr_build_linux.yml`.
- Route `Generate TPC-H data (SF=1)` and `Generate TPC-DS data (SF=1)`
  (`exec:java`) through `../dev/ci/mvn-retry.sh` as well, since
  `exec-maven-plugin` is not resolved during `-Prelease install` and a
  download failure there also skips saving the Maven cache.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
…loads' into adityavaish-retry-tpc-maven-downloads
@adityavaish

Copy link
Copy Markdown
Author

Thanks @comphead and @sunchao for the review! Addressed both comments in b6e54f8 / 8caeb36: extracted a shared \dev/ci/mvn-retry.sh\ script for \lint-java\ plus both TPC-H and TPC-DS \Build project\ steps, and also wrapped \Generate TPC-H data\ and \Generate TPC-DS data\ (\�xec:java) with it.

@comphead could you please approve the workflow runs on this updated commit (and queue for merge once CI is green)?

@github-actions github-actions Bot added build Build environment enhancement New feature or request area:ci CI/CD, GitHub Actions, build tooling labels Dec 3, 2026
@sunchao
sunchao added this pull request to the merge queue Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:ci CI/CD, GitHub Actions, build tooling build Build environment enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ci: retry Maven downloads in the TPC-H and TPC-DS builds

4 participants