kunwp1 commented on code in PR #9636:
URL: https://github.com/apache/texera/pull/9636#discussion_r4661791410


##########
common/workflow-core/src/test/scala/org/apache/texera/amber/core/storage/result/iceberg/IcebergDocumentSpec.scala:
##########
@@ -427,6 +427,45 @@ class IcebergDocumentSpec extends AnyFlatSpec with 
Matchers with BeforeAndAfterA
     doc.asInstanceOf[IcebergDocument[Tuple]].tableNamespace shouldBe 
tableNamespace
     doc.asInstanceOf[IcebergDocument[Tuple]].tableName shouldBe name
   }
+
+  /**
+    * Writes `rows` rows, and returns a document that reads them through a 
catalog which lets
+    * `succeeding` `loadTable` calls through before it fails.
+    */
+  private def documentOnFailingCatalog(rows: Int, succeeding: Int): 
IcebergDocument[Tuple] = {
+    val tableName = freshTableName()
+    write(newDocument(tableName), (0 until rows).map(tuple))
+    val warehouse = "iceberg-doc-spec-failing"
+    IcebergCatalogInstance.replaceInstance(
+      new FailingCatalog(IcebergCatalogInstance.getInstance(), succeeding),
+      Some(warehouse)
+    )
+    new IcebergDocument[Tuple](
+      tableNamespace,
+      tableName,
+      icebergSchema,
+      serde,
+      deserde,
+      Some(warehouse)
+    )
+  }

Review Comment:
   This is what fails `build / amber`. The CI job runs with 
`STORAGE_ICEBERG_CATALOG_TYPE=postgres`, and for hadoop and postgres 
`IcebergCatalogInstance.cacheKey` ignores the warehouse name. So 
`replaceInstance(..., Some("iceberg-doc-spec-failing"))` replaces the shared 
default catalog, and the `FailingCatalog` stays installed for every later test. 
The second and third new cases then fail in `newDocument` with "FailingCatalog 
does not support namespaces", and so does the existing "re-resolve its catalog 
on every seek" case below. It only passes with the REST catalog.
   
   Putting the catalog back in a `finally` fixes it. 



##########
amber/src/main/scala/org/apache/texera/web/resource/dashboard/user/workflow/WorkflowResource.scala:
##########
@@ -679,7 +680,7 @@ class WorkflowResource extends LazyLogging {
             val (document, _) = DocumentFactory.openDocument(uri)
             document.clear()
           } catch {
-            case e: IllegalArgumentException if e.getMessage.contains("No 
storage is found") =>
+            case e: DocumentNotFoundException =>
               logger.warn(s"Storage for URI $uri not found, ignoring: 
${e.getMessage}")
             case NonFatal(e) =>
               logger.error(s"Failed to clear document for URI $uri", e)

Review Comment:
   Two other places clear result documents and still swallow every failure:
   - `WorkflowExecutionsResource.scala:400-405` uses `catch { case _: Throwable 
=> }`, commented "already deleted".
   - `WorkflowService.scala:418-427` catches `Throwable` and logs at debug.
   
   Now that a catalog failure surfaces, it would be lost there and the table 
left behind without a trace. Handling them like this one 
(`DocumentNotFoundException` quietly, `NonFatal` with a warning) would fit this 
PR, or it could be a follow-up.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to