Class TableCache

java.lang.Object
org.apache.beam.sdk.io.iceberg.TableCache

@Internal public class TableCache extends Object
Process-wide cache for Iceberg Tables.

Entries are keyed by catalog configuration and table identifier, so one machine can share table metadata across source and sink threads without colliding when different catalogs contain the same identifier. The underlying catalog is only resolved from IcebergCatalogConfig when the table has to be loaded. Refreshes are synchronized per table entry: if another thread refreshed after a caller started its request, the caller reuses that refresh instead of making another catalog call.

  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.apache.iceberg.Table
    get(IcebergCatalogConfig catalogConfig, String identifier)
    Returns the cached table for a string identifier, loading it on a cache miss.
    static org.apache.iceberg.Table
    get(IcebergCatalogConfig catalogConfig, org.apache.iceberg.catalog.TableIdentifier identifier)
    Returns the cached table, loading it from the catalog on a cache miss.
    static org.apache.iceberg.Table
    get(IcebergCatalogConfig catalogConfig, org.apache.iceberg.catalog.TableIdentifier identifier, Callable<org.apache.iceberg.Table> loader)
    Returns the cached table, using the given loader only on a cache miss.
    static org.apache.iceberg.Table
    getAndRefreshIfStale(IcebergCatalogConfig catalogConfig, String identifier)
     
    static org.apache.iceberg.Table
    getAndRefreshIfStale(IcebergCatalogConfig catalogConfig, org.apache.iceberg.catalog.TableIdentifier identifier)
    Returns the cached table, refreshing it only if it is older than DEFAULT_REFRESH_INTERVAL.
    static org.apache.iceberg.Table
    getAndRefreshIfStale(IcebergCatalogConfig catalogConfig, org.apache.iceberg.catalog.TableIdentifier identifier, Callable<org.apache.iceberg.Table> loader)
    Returns the cached table, using the loader on a miss and refreshing stale entries.
    static org.apache.iceberg.Table
    getRefreshed(IcebergCatalogConfig catalogConfig, String identifier)
    Returns the cached table for a string identifier after refreshing any pre-existing entry.
    static org.apache.iceberg.Table
    getRefreshed(IcebergCatalogConfig catalogConfig, org.apache.iceberg.catalog.TableIdentifier identifier)
    Returns the cached table after forcing a refresh of any pre-existing cache entry.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TableCache

      public TableCache()
  • Method Details

    • get

      public static org.apache.iceberg.Table get(IcebergCatalogConfig catalogConfig, org.apache.iceberg.catalog.TableIdentifier identifier)
      Returns the cached table, loading it from the catalog on a cache miss.
    • get

      public static org.apache.iceberg.Table get(IcebergCatalogConfig catalogConfig, String identifier)
      Returns the cached table for a string identifier, loading it on a cache miss.
    • get

      public static org.apache.iceberg.Table get(IcebergCatalogConfig catalogConfig, org.apache.iceberg.catalog.TableIdentifier identifier, Callable<org.apache.iceberg.Table> loader)
      Returns the cached table, using the given loader only on a cache miss.
    • getRefreshed

      public static org.apache.iceberg.Table getRefreshed(IcebergCatalogConfig catalogConfig, org.apache.iceberg.catalog.TableIdentifier identifier)
      Returns the cached table after forcing a refresh of any pre-existing cache entry.
    • getRefreshed

      public static org.apache.iceberg.Table getRefreshed(IcebergCatalogConfig catalogConfig, String identifier)
      Returns the cached table for a string identifier after refreshing any pre-existing entry.
    • getAndRefreshIfStale

      public static org.apache.iceberg.Table getAndRefreshIfStale(IcebergCatalogConfig catalogConfig, String identifier)
    • getAndRefreshIfStale

      public static org.apache.iceberg.Table getAndRefreshIfStale(IcebergCatalogConfig catalogConfig, org.apache.iceberg.catalog.TableIdentifier identifier)
      Returns the cached table, refreshing it only if it is older than DEFAULT_REFRESH_INTERVAL.
    • getAndRefreshIfStale

      public static org.apache.iceberg.Table getAndRefreshIfStale(IcebergCatalogConfig catalogConfig, org.apache.iceberg.catalog.TableIdentifier identifier, Callable<org.apache.iceberg.Table> loader)
      Returns the cached table, using the loader on a miss and refreshing stale entries.