kunwp1 commented on code in PR #9636:
URL: https://github.com/apache/texera/pull/9636#discussion_r4662116340
##########
amber/src/main/scala/org/apache/texera/web/service/WorkflowService.scala:
##########
@@ -418,12 +418,7 @@ class WorkflowService(
(resultUris ++ consoleMessagesUris).foreach { uri =>
if (WarehouseReadGuard.skipWhileDisabled(uri)) {
logger.info(s"skipping cleanup of $uri: per-user warehouses are
disabled")
- } else
- try DocumentFactory.openDocument(uri)._1.clear()
- catch {
- case error: Throwable =>
- logger.debug(s"Error processing document at $uri:
${error.getMessage}")
- }
+ } else WorkflowExecutionsResource.clearDocument(uri)
}
// Expire any Iceberg snapshots for runtime statistics
Review Comment:
Optional: the snapshot expiry below, in the same method, still catches
`Throwable` and logs at debug, so a catalog failure there stays hidden the way
the cleanup's did. Treating it like `clearDocument`
(`DocumentNotFoundException` quietly, `NonFatal` as a warning) would match.
##########
common/workflow-core/src/test/scala/org/apache/texera/amber/core/storage/result/iceberg/IcebergDocumentSpec.scala:
##########
@@ -427,6 +427,37 @@ 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. The document
overrides its catalog
+ * rather than replacing a shared one: outside `rest`, every warehouse
shares one entry.
+ */
+ private def documentOnFailingCatalog(rows: Int, succeeding: Int):
IcebergDocument[Tuple] = {
+ val tableName = freshTableName()
+ write(newDocument(tableName), (0 until rows).map(tuple))
+ val failing = new FailingCatalog(IcebergCatalogInstance.getInstance(),
succeeding)
+ new IcebergDocument[Tuple](tableNamespace, tableName, icebergSchema,
serde, deserde) {
+ override def catalog: Catalog = failing
+ }
+ }
+
+ it should "throw rather than count 0 rows when its catalog is unavailable"
in {
+ val error = intercept[RuntimeException](documentOnFailingCatalog(3,
0).getCount)
+ error.getMessage shouldBe "catalog unavailable"
+ }
+
+ it should "throw rather than read as empty when its catalog is unavailable"
in {
+ val error = intercept[RuntimeException](documentOnFailingCatalog(3,
0).get().toList)
+ error.getMessage shouldBe "catalog unavailable"
+ }
+
+ it should "keep the rows it has read when its catalog fails while it looks
for newer ones" in {
+ // The first call resolves the table; the second is the look for files
committed since, made
+ // once every row of that snapshot has been returned.
+ documentOnFailingCatalog(3, 1).get().toList should have size 3
+ }
+
it should "re-resolve its catalog on every seek, keeping a polling reader's
entry live" in {
// #7290 review: a reader that refreshed a pinned Table never touched the
catalog
// cache again, so a long poll looked idle -- expiry could close the
catalog under
Review Comment:
Optional, and older than this PR: this test still calls
`replaceInstance(counting, Some("iceberg-doc-spec-counting"))` and never puts
the catalog back. Outside `rest` that replaces the shared entry with a
`CountingCatalog`, which can't create namespaces, and WorkflowCore's untagged
suites run in parallel in one forked JVM. Overriding `catalog` as your new
cases do avoids it, and the test still sees 2 loads.
--
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]