Repository navigation
ci: retry Maven downloads in the TPC-H and TPC-DS builds - #7828
adityavaish wants to merge 5 commits into
Conversation
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
left a comment
There was a problem hiding this comment.
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.
| 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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
thanks @adityavaish, the PR goes into right direction, please check some nits!
sunchao
left a comment
There was a problem hiding this comment.
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.
…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
|
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)? |
Agent assessment
Self-reported assessment, not an independent review.
Assessed revision:
8caeb36fde623a099bef44aa74056a230b6c2a04dev/ci/mvn-retry.sh(100755, LF, Apache 2.0 header) acrosslint-java, both TPC-H/TPC-DSBuild projectsteps, and bothGenerate TPC-H/TPC-DS data(exec:java) steps; passesbash -n,sh -n, YAML parsing,check-suites.py, all 18check-ci-config.pyinvariants, and 13 behavioral retry tests.↓ Live GitHub Actions execution and
actionlinthave not yet run on this branch.Which issue does this PR close?
Closes #7759.
Rationale for this change
In
cache-refresh-onlymode, 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 orexec:javadata-generation step aborts the job beforeSave Maven dependenciesruns and leaves fork caches cold.What changes are included in this PR?
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-4sjitter backoff,-Uon retries (so cached Maven 404s are refreshed),mktemplog cleanup viatrap, 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..github/workflows/pr_build_linux.ymlto route five Maven steps throughdev/ci/mvn-retry.shand removed the duplicated inline retry script andshell: bashoverride:lint-java:Run scalafix checkverify-benchmark-results-tpch:Build projectandGenerate TPC-H data (SF=1)(exec:java)verify-benchmark-results-tpcds:Build projectandGenerate TPC-DS data (SF=1)(exec:java)How are these changes tested?
git ls-files -s --eol dev/ci/mvn-retry.sh— confirmed mode100755and LF line endings.bash -n dev/ci/mvn-retry.sh,yaml.safe_loadon.github/workflows/pr_build_linux.yml, andsh -non all 5 updated workflow step bodies — passed.dev/ci/mvn-retry.shundersh -e(root andspark/subdirectory invocations with../dev/ci/mvn-retry.sh ../mvnw,MAVEN_OPTSpropagation, quoted-Dexec.argswith spaces, 403/404/429/[FATAL]/Could not find artifact/No plugin found for prefix/ClassNotFoundExceptionretries 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 andlocal_ci_config.config()passed, and confirmeddev/ci/mvn-retry.shroutes tobuild_linux/build_macosviadev/ci/**(runningcheck_local_ci_configdirectly on Windows hits a pre-existingdev\local-ci.shpath separator quirk).