Copilot commented on code in PR #7539:
URL: https://github.com/apache/texera/pull/7539#discussion_r3762485380


##########
common/workflow-core/src/main/scala/org/apache/texera/amber/core/storage/result/iceberg/IcebergDocument.scala:
##########
@@ -72,7 +72,10 @@ private[storage] class IcebergDocument[T >: Null <: AnyRef](
 
   private val lock = new ReentrantReadWriteLock()
 
-  @transient lazy val catalog: Catalog = 
IcebergCatalogInstance.getInstance(warehouse)
+  // Resolved per use, never held: the catalog cache is bounded and closes 
evicted
+  // entries (#7290), so a pinned reference could outlive its catalog. A 
public def
+  // (not a lazy val) also means a replaced/rebuilt catalog is picked up 
immediately.
+  def catalog: Catalog = IcebergCatalogInstance.getInstance(warehouse)

Review Comment:
   This still leaves long-lived document readers holding a catalog-derived 
`Table`. `getUsingFileSequenceOrder` initializes its `table` once (lines 
173–174), and later `seekToUsableFile` calls `table.refresh()` without 
resolving this accessor again (lines 198–216). An actively polled reader 
therefore looks idle to this cache; after 60 minutes another cache operation 
can expire and close its REST catalog, and the next refresh uses the closed 
`RESTTableOperations`. Resolve a fresh table from the current catalog at each 
polling/refresh boundary (while retaining the snapshot ID), or keep a lease for 
the iterator's lifetime.



-- 
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