Skip to content

[GLUTEN-12743][VL] Avoid blocking on failed Delta statistics workers - #13678

Merged
zhztheplayer merged 2 commits into
apache:mainfrom
felipepessoto:felipepessoto-delta-worker-failure-handling
Nov 23, 2026
Merged

zhztheplayer merged 2 commits into
apache:mainfrom
felipepessoto:felipepessoto-delta-worker-failure-handling

Conversation

@felipepessoto

@felipepessoto felipepessoto commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

What changes are proposed in this pull request?

Relates to #12743. This is the focused follow-up to the blocking newRow.put() review on #13578 and the follow-up acknowledgment.

  • Share the existing 500 ms timed-offer/worker-future checks between batch submission and end-of-stream signaling in both Delta 3.3 and Delta 4. A failed worker now propagates its exception instead of leaving the producer blocked indefinitely.
  • Preserve synchronous backpressure, interruptible submission, and ownership transfer only after a successful handoff. Rejected batches still release their retained reference in finally.
  • Extend the existing Velox lifecycle suite with bounded regressions for failures before submission and during a blocked submission, checking exception propagation, batch reference counts, producer ownership, and resource cleanup. The Delta 4 suite remains the existing Git symlink.
  • Cover a worker failure mid-stream, without calling closeFile() or sending end-of-stream, addressing the review feedback. After a valid native batch is consumed, a deliberately non-offloaded batch fails in the actual worker's input iterator. The next newRow() must surface that failure and release its retained batch reference; task completion must also release the worker-owned input.

This branch starts directly from upstream main at cb154e189, which includes merged #13578. Task-completion listener ordering and worker-before-native-resource cleanup are unchanged; the unbounded shutdown wait is deliberately out of scope. No fallback, fixture, configuration, or quarantine changes are included. Complementary #13510 also touches the two trackers and remains a separate unsupported-statistics-plan fallback change.

How was this patch tested?

Actual Maven-backed execution of org.apache.spark.sql.delta.GlutenDeltaStatsLifecycleSuite in isolated Linux source exports under WSL Ubuntu-24.04, using apache/gluten:centos-9-jdk17:

Configuration Final result Original blocking implementation
Spark 3.5.5 / Delta 3.3.2 / Scala 2.12 / JDK 17 6 passed; none skipped or canceled 3 passed; all three regressions failed at their bounded 30-second newRow deadline
Spark 4.1.1 / Delta 4.4.1 / Scala 2.13 / JDK 17 6 passed; none skipped or canceled 3 passed; all three regressions failed at their bounded 30-second newRow deadline

For each negative control, only the production trackers in isolated validation copies were temporarily reverted to their original implementation; the published branch was not reverted. Both test JVMs exited normally rather than hanging. Reapplying the fix made all six tests pass again, including the existing successful-write, aborted-write, and cancellation/registry-lock tests. The final tested source blobs match aef2d8fc3.

Representative commands (both profile sets were built and tested; the test-only review update reused the matching installed sibling modules):

./build/mvn -B -q install -pl backends-velox -am \
  -Pfast-build,backends-velox,spark-3.5,scala-2.12,java-17,delta,spark-ut \
  -Dmaven.compiler.release=17 -DskipTests
./build/mvn -B -q test-compile scalatest:test -pl backends-velox \
  -Pfast-build,backends-velox,spark-3.5,scala-2.12,java-17,delta,spark-ut \
  -Dmaven.compiler.release=17 \
  -DwildcardSuites=org.apache.spark.sql.delta.GlutenDeltaStatsLifecycleSuite \
  -DargLine=-Dspark.test.home=/opt/shims/spark35/spark_home
# Repeat with spark-4.1, scala-2.13, and /opt/shims/spark41/spark_home.
./dev/format-scala-code.sh
./dev/format-scala-code.sh check
./.github/workflows/util/check.py header main --fix

Formatting and license checks passed. Native libraries were downloaded for the original validation from successful native build 134590129323, artifact 14400261816, built at ad96f33f7 with Velox 67fa1bbee62e9f8752b3c34cc92f179022cd2ac6, and reused for this test-only update after verifying their hashes. The comparison to this branch's cb154e189 base contains only unrelated Bolt/ClickHouse tests, so native source/build inputs match. Native libraries were not rebuilt locally. The full upstream Delta/Spark test matrix was not run locally for this revision; there are no remaining blockers for the focused validation.

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

Generated-by: GitHub Copilot CLI 1.0.106-8.unstable.r43566476370.g869eef3 (GPT-6 Astra)

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@github-actions github-actions Bot added the VELOX label Nov 19, 2026
@felipepessoto
felipepessoto marked this pull request as ready for review November 19, 2026 18:13
Copilot AI balanced review requested due to automatic review settings November 19, 2026 18:13

Copilot AI 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.

🟢 Approval recommended

No active review issues are recorded for the Delta statistics worker-failure handling changes.

No open issues 🎉

What changed in this PR

This focused follow-up to #13578 prevents Velox Delta statistics producers from blocking indefinitely when a worker fails, covering both Delta 3.3 and Delta 4.

Changes:

  • Share timed queue offers and worker-failure checks between batch submission and end-of-stream signaling.
  • Preserve backpressure, interruptibility, and retained-batch cleanup when submission fails.
  • Add bounded regressions for worker failures before and during submission, checking exception propagation, batch ownership, and resource cleanup.
File Description
backends-velox/​src-delta4/​main/​scala/​org/​apache/​spark/​sql/​delta/​stats/​GlutenDeltaJobStatsTracker.scala Use failure-aware enqueue logic for Delta 4 batches and end-of-stream signals.
backends-velox/​src-delta33/​test/​scala/​org/​apache/​spark/​sql/​delta/​GlutenDeltaStatsLifecycleSuite.scala Add two bounded worker-failure lifecycle regressions.
backends-velox/​src-delta33/​main/​scala/​org/​apache/​spark/​sql/​delta/​stats/​GlutenDeltaJobStatsTracker.scala Apply the same failure-aware enqueue logic to Delta 3.3.

Review effort: Balanced

@felipepessoto

Copy link
Copy Markdown
Contributor Author

Hi @malinjawi @zhztheplayer @philo-he, could you review #13678?

This addresses the blocking newRow.put() follow-up from #13578 comment: #13578 (review). Both Delta implementations now use timed offers with worker-future checks, preserving backpressure and retained-batch cleanup. Worker shutdown behavior is unchanged.

The regressions cover worker failure before and during submission. All five lifecycle tests pass on both Delta variants; restoring the old implementation reproduces both failures without hanging the test JVM. Thanks!

@zhztheplayer zhztheplayer 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.

LGTM

@malinjawi malinjawi 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.

LGTM, just one non-blocking nit.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 21, 2026 16:39

Copilot AI 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.

🟢 Approval recommended

No active review issues remain for the changes aimed at preventing indefinite blocking after statistics-worker failures.

No open issues 🎉

Review effort: Balanced

@zhztheplayer
zhztheplayer merged commit d40dbbc into apache:main Nov 23, 2026
54 checks passed
@felipepessoto
felipepessoto deleted the felipepessoto-delta-worker-failure-handling branch November 23, 2026 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants