Repository navigation
fix(storage): report a table as missing only when it does not exist - #9636
Conversation
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.
Backport auto-label reportThis
|
Automated Reviewer SuggestionsBased on the
|
There was a problem hiding this comment.
🔵 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
Noneonly for missing tables or namespaces; propagate other catalog failures. - Introduce
DocumentNotFoundExceptionand 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
Codecov Report❌ Patch coverage is
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
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
| 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
bobbai00
left a comment
There was a problem hiding this comment.
🟢 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.
What changes were proposed in this PR?
IcebergUtil.loadTableMetadataand the Python worker'sload_table_metadatareturnedNonefor 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 returnNoneonly when the table or its namespace does not exist, and raise anything else.openDocumentthrowsDocumentNotFoundException, a subtype of theIllegalArgumentExceptionit 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 shareclearDocument, 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
IcebergDocumentiterator 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?
ResultResourceSpecanswered 404 and 200 where it expects 500,IcebergDocumentSpeccounted 0 and read empty,IcebergUtilSpecgotNone, and three Python cases did not raise.IcebergUtilSpecpinned the old behavior ("return None when loading table metadata fails"). It now covers a missing table or namespace, and every other failure.IcebergDocumentSpeccase red.WorkflowExecutionsResourceSpeccoversclearDocument: dropping either branch, or the log, turns a case red.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)