Skip to content

fix(storage): report a table as missing only when it does not exist - #9636

Merged
mengw15 merged 4 commits into
apache:mainfrom
mengw15:fix/9635-load-table-metadata-errors
Nov 23, 2026
Merged

mengw15 merged 4 commits into
apache:mainfrom
mengw15:fix/9635-load-table-metadata-errors

Conversation

@mengw15

@mengw15 mengw15 commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

What changes were proposed in this PR?

IcebergUtil.loadTableMetadata and the Python worker's load_table_metadata returned None for any failure, so a catalog that could not be read looked like a deleted table: result-service answered 404, or 200 with an empty page, and counts and reads came back empty. They now return None only when the table or its namespace does not exist, and raise anything else.

openDocument throws DocumentNotFoundException, a subtype of the IllegalArgumentException it always threw, so callers match the type instead of the message. The three places that clear results (deleting a workflow, deleting executions, and clearing a workflow's previous execution) now share clearDocument, which passes over a missing document and logs any other failure. Two of them swallowed every failure, so a table that could not be cleared was left behind unnoticed. Expiring the runtime statistics' snapshots now handles failures the same way.

One lookup stays best effort. Once an IcebergDocument iterator has returned every row of the table it resolved, it looks for rows committed since. Failing that should not fail a read that is complete, so it logs a warning and ends, as it did before.

Behavior change in the engine. When the catalog fails as a reader first resolves its materialized input, the reader now fails instead of giving the operator no input. As when opening the document fails today, the JVM reader thread rethrows and the Python reader logs, and neither ends its channel, so the operator waits rather than producing a wrong result.

Any related issues, documentation, discussions?

Closes #9635.

How was this PR tested?

  • Written first, and red on main: ResultResourceSpec answered 404 and 200 where it expects 500, IcebergDocumentSpec counted 0 and read empty, IcebergUtilSpec got None, and three Python cases did not raise.
  • IcebergUtilSpec pinned the old behavior ("return None when loading table metadata fails"). It now covers a missing table or namespace, and every other failure.
  • Removing the best-effort lookup turns its IcebergDocumentSpec case red.
  • WorkflowExecutionsResourceSpec covers clearDocument: dropping either branch, or the log, turns a case red.
  • The WorkflowCore suite (889 tests, on the rest and postgres catalogs), ResultResourceSpec, and, against a local Postgres, the amber unit suite (2443 tests) and the Python storage suite (144 tests) pass. scalafmt, scalafix and ruff are clean.

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

Generated-by: Claude Code (claude-opus-5-5)

loadTableMetadata, and load_table_metadata in the Python worker, returned
None for any failure, so a catalog that could not be read looked like a
deleted table. They now return None only when the table or its namespace
does not exist, and raise anything else. A look for newer rows after a
read is complete stays best effort.
@Yicong-Huang Yicong-Huang added release/v1.3 back porting to release/v1.3 release/v1.2 back porting to release/v1.2 labels Nov 23, 2026
@github-actions
github-actions Bot requested a review from xuang7 November 23, 2026 03:53
@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Backport auto-label report

This fix: PR was checked against each actively-supported release branch. A release/* label nominates a backport target; the branch's release manager approving this PR is what sends the fix there. The required Backport Approvals check stays red until every label below is approved, so each manager either approves or removes their own label — which is why the labels left on a merged PR are exactly the branches it reached.

Release branch Analysis
🚫 release/v1.3 Label was removed earlier (opt-out); not re-added. Re-add it by hand if this fix should be backported here after all — the branch's release manager then has to approve before this PR can merge.
🚫 release/v1.2 Label was removed earlier (opt-out); not re-added. Re-add it by hand if this fix should be backported here after all — the branch's release manager then has to approve before this PR can merge.

Auto-label run.

@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Automated Reviewer Suggestions

Based on the git blame history of the changed files, we recommend the following reviewers:

  • Committers with relevant context: @parshimers
    You can request their reviews formally with /request-review @parshimers.

  • Contributors with relevant context: @aglinxinyuan, @carloea2, @tanishqgandhi1908
    You can notify them by mentioning @aglinxinyuan, @carloea2, @tanishqgandhi1908 in a comment.

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.

🔵 Needs a closer look

Human operational validation is needed because catalog outages terminate materialization readers without closing channels or signaling workflow failure, leaving operators waiting with recovery, timeout, and cancellation behavior requiring review in both JVM and Python engines.

No open issues 🎉

What changed in this PR

Fixes #9635 by distinguishing missing Iceberg tables from catalog failures across Scala and Python storage code, preventing unavailable results from appearing deleted or empty.

Changes:

  • Return None only for missing tables or namespaces; propagate other catalog failures.
  • Introduce DocumentNotFoundException and replace message-based exception matching.
  • Preserve best-effort checks for newer rows after a completed read, with regression coverage for failure handling.
File Description
result-service/​src/​test/​scala/​org/​apache/​texera/​service/​resource/​ResultResourceSpec.scala Tests catalog failures return 500 rather than 404 or empty pages.
result-service/​src/​main/​scala/​org/​apache/​texera/​service/​resource/​ResultResource.scala Maps typed missing-document errors to 404.
common/​workflow-core/​src/​test/​scala/​org/​apache/​texera/​amber/​util/​IcebergUtilSpec.scala Tests missing metadata separately from catalog failures.
common/​workflow-core/​src/​test/​scala/​org/​apache/​texera/​amber/​core/​storage/​result/​iceberg/​IcebergDocumentSpec.scala Tests failed counts, failed reads, and best-effort refreshes.
common/​workflow-core/​src/​test/​scala/​org/​apache/​texera/​amber/​core/​storage/​result/​iceberg/​FailingCatalog.scala Adds a configurable catalog-failure test helper.
common/​workflow-core/​src/​test/​scala/​org/​apache/​texera/​amber/​core/​storage/​DocumentFactorySpec.scala Verifies the new exception type and backward compatibility.
common/​workflow-core/​src/​main/​scala/​org/​apache/​texera/​amber/​util/​IcebergUtil.scala Propagates failures unrelated to missing tables or namespaces.
common/​workflow-core/​src/​main/​scala/​org/​apache/​texera/​amber/​core/​storage/​result/​iceberg/​IcebergDocument.scala Logs and tolerates refresh failures after returning resolved rows.
common/​workflow-core/​src/​main/​scala/​org/​apache/​texera/​amber/​core/​storage/​DocumentFactory.scala Introduces and throws DocumentNotFoundException.
amber/​src/​test/​python/​core/​storage/​iceberg/​test_iceberg_utils_catalog.py Tests Python metadata lookup error classification.
amber/​src/​test/​python/​core/​storage/​iceberg/​test_iceberg_document.py Tests catalog failures propagate from counts and reads.
amber/​src/​main/​scala/​org/​apache/​texera/​web/​resource/​dashboard/​user/​workflow/​WorkflowResource.scala Uses typed missing-document handling during cleanup.
amber/​src/​main/​python/​core/​storage/​iceberg/​iceberg_utils.py Limits suppressed errors to missing tables or namespaces.

Review effort: Balanced

@mengw15 mengw15 removed release/v1.2 back porting to release/v1.2 release/v1.3 back porting to release/v1.3 labels Nov 23, 2026
@codecov-commenter

codecov-commenter commented Nov 23, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 87.50000% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 91.68%. Comparing base (95e2748) to head (ff0fee8).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...ard/user/workflow/WorkflowExecutionsResource.scala 75.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##               main    #9636   +/-   ##
=========================================
  Coverage     91.67%   91.68%           
  Complexity     5135     5135           
=========================================
  Files          1304     1304           
  Lines         58088    58098   +10     
  Branches       7582     7583    +1     
=========================================
+ Hits          53254    53265   +11     
  Misses         2922     2922           
+ Partials       1912     1911    -1     
Flag Coverage Δ *Carryforward flag
access-control-service 77.44% <ø> (ø)
agent-service 99.56% <ø> (ø) Carriedforward from a67428f
amber 85.77% <85.71%> (+<0.01%) ⬆️
computing-unit-managing-service 63.83% <ø> (ø)
config-service 87.50% <ø> (ø)
file-service 82.16% <ø> (ø)
frontend 96.45% <ø> (ø) Carriedforward from a67428f
notebook-migration-service 83.77% <ø> (ø)
pyamber 98.38% <100.00%> (+<0.01%) ⬆️
result-service 86.48% <ø> (+0.77%) ⬆️
workflow-compiling-service 78.30% <ø> (ø)

*This pull request uses carry forward flags. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mengw15
mengw15 requested review from bobbai00 and kunwp1 November 23, 2026 04:05
@github-actions

github-actions Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Benchmark changes need a look

🟢 4 better · 🔴 4 worse · ⚪ 7 noise (<±5%) · 0 without baseline

Compared against main 95e2748 benchmarked on this same runner, so the delta is largely free of cross-runner hardware noise. The "7d avg" column still reflects the gh-pages dashboard. Treat <±5% as noise unless repeated.

Dashboard · Run

config throughput MB/s latency max Δ latest / 7d
🔴 bs=10 sw=10 sl=64 437 0.266 21,993/29,002/29,002 us 🟢 -20.9% / 🔴 +117.3%
🔴 bs=100 sw=10 sl=64 938 0.573 105,559/121,627/121,627 us 🟢 -7.5% / 🔴 +40.9%
⚪ bs=1000 sw=10 sl=64 1,073 0.655 931,461/977,315/977,315 us ⚪ within ±5% / 🔴 -21.3%
Baseline details

Latest main 95e2748 from same runner

config metric PR latest main 7d avg Δ latest Δ 7d
bs=10 sw=10 sl=64 throughput 437 tuples/sec 466 tuples/sec 993.83 tuples/sec -6.2% -56.0%
bs=10 sw=10 sl=64 MB/s 0.266 MB/s 0.285 MB/s 0.607 MB/s -6.7% -56.1%
bs=10 sw=10 sl=64 p50 21,993 us 19,053 us 10,119 us +15.4% +117.3%
bs=10 sw=10 sl=64 p95 29,002 us 36,676 us 13,394 us -20.9% +116.5%
bs=10 sw=10 sl=64 p99 29,002 us 36,676 us 16,114 us -20.9% +80.0%
bs=100 sw=10 sl=64 throughput 938 tuples/sec 971 tuples/sec 1,327 tuples/sec -3.4% -29.3%
bs=100 sw=10 sl=64 MB/s 0.573 MB/s 0.593 MB/s 0.81 MB/s -3.4% -29.3%
bs=100 sw=10 sl=64 p50 105,559 us 100,442 us 79,097 us +5.1% +33.5%
bs=100 sw=10 sl=64 p95 121,627 us 131,478 us 86,335 us -7.5% +40.9%
bs=100 sw=10 sl=64 p99 121,627 us 131,478 us 94,338 us -7.5% +28.9%
bs=1000 sw=10 sl=64 throughput 1,073 tuples/sec 1,048 tuples/sec 1,363 tuples/sec +2.4% -21.3%
bs=1000 sw=10 sl=64 MB/s 0.655 MB/s 0.64 MB/s 0.832 MB/s +2.3% -21.3%
bs=1000 sw=10 sl=64 p50 931,461 us 965,712 us 774,633 us -3.5% +20.2%
bs=1000 sw=10 sl=64 p95 977,315 us 1,003,847 us 814,584 us -2.6% +20.0%
bs=1000 sw=10 sl=64 p99 977,315 us 1,003,847 us 858,914 us -2.6% +13.8%
Raw CSV
config_idx,batch_size,schema_width,string_len,num_batches,total_ms,total_tuples,total_bytes,tuples_per_sec,mb_per_sec,lat_p50_us,lat_p95_us,lat_p99_us
0,10,10,64,20,458.08,200,128000,437,0.266,21993.03,29001.88,29001.88
1,100,10,64,20,2131.76,2000,1280000,938,0.573,105559.01,121627.07,121627.07
2,1000,10,64,20,18637.75,20000,12800000,1073,0.655,931460.95,977315.34,977315.34

@mengw15 mengw15 closed this Nov 23, 2026
@mengw15 mengw15 reopened this Nov 23, 2026

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

I left some comments.

@kunwp1 kunwp1 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!

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

🟢 0 must-fix · 0 advisory · 0 polish: the narrowed catch fixes #9635 at its root in both languages, and the new tests pin each changed branch.

Verification trace

Traced the narrowed catch against every catalog Texera builds. In iceberg-core 1.9.2, BaseMetastoreCatalog.loadTable throws NoSuchTableException for a missing table (Hadoop and JDBC), and the REST error handler maps a 404 to NoSuchTableException or NoSuchNamespaceException. In pyiceberg 0.11.1, both SqlCatalog.load_table and RestCatalog.load_table raise NoSuchTableError. So a missing table still reads as missing on every catalog, and only real failures propagate.

The best-effort lookup in IcebergDocument keeps the Table whose snapshot set lastSnapshotId, so a failed later seek always lands in the no-new-data case (IcebergDocument.scala:315): it cannot re-read rows or open a file through a closed FileIO.

Every caller of the narrowed function lands in an existing catch, a Try, or a path that already failed at openDocument on the same outage, and no caller still matches the "No storage is found" message.

Also keep IcebergDocumentSpec's counting catalog out of the shared one.
@mengw15
mengw15 enabled auto-merge November 23, 2026 19:40
@mengw15
mengw15 added this pull request to the merge queue Nov 23, 2026
Merged via the queue into apache:main with commit c15f724 Nov 23, 2026
41 checks passed
@mengw15
mengw15 deleted the fix/9635-load-table-metadata-errors branch November 23, 2026 20:42
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.

loadTableMetadata treats every catalog failure as a missing table

6 participants