{"record":{"id":"a6883bd6c3ac86a4","repo":"apache/iceberg","slug":"interrupted-in-call-to-check-table-existence-of","errorCode":null,"errorMessage":"Interrupted in call to check table existence of ${baseTableIdentifier}","messagePattern":"Interrupted in call to check table existence of (.+?)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java","lineNumber":500,"sourceCode":"        return false;\n      } else {\n        baseTableIdentifier = TableIdentifier.of(identifier.namespace().levels());\n      }\n    }\n\n    String database = baseTableIdentifier.namespace().level(0);\n    String tableName = baseTableIdentifier.name();\n    try {\n      Table table = clients.run(client -> client.getTable(database, tableName));\n      HiveOperationsBase.validateTableIsIceberg(table, fullTableName(name, baseTableIdentifier));\n      return true;\n    } catch (NoSuchTableException | NoSuchObjectException e) {\n      return false;\n    } catch (TException e) {\n      throw new RuntimeException(\"Failed to check table existence of \" + baseTableIdentifier, e);\n    } catch (InterruptedException e) {\n      Thread.currentThread().interrupt();\n      throw new RuntimeException(\n          \"Interrupted in call to check table existence of \" + baseTableIdentifier, e);\n    }\n  }\n\n  @Override\n  public boolean viewExists(TableIdentifier viewIdentifier) {\n    if (!isValidIdentifier(viewIdentifier)) {\n      return false;\n    }\n\n    String database = viewIdentifier.namespace().level(0);\n    String viewName = viewIdentifier.name();\n    try {\n      Table table = clients.run(client -> client.getTable(database, viewName));\n      HiveOperationsBase.validateTableIsIcebergView(table, fullTableName(name, viewIdentifier));\n      return true;\n    } catch (NoSuchIcebergViewException | NoSuchObjectException e) {\n      return false;","sourceCodeStart":482,"sourceCodeEnd":518,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java#L482-L518","documentation":"Thrown when the thread is interrupted while HiveCatalog.tableExists waits on the metastore getTable call. Iceberg restores the interrupt status and throws this RuntimeException. No existence answer is returned, so callers must treat the state as unknown.","triggerScenarios":"tableExists (directly or via renameTableOrView/registerTable) during thread interruption — job cancellation, executor shutdown, or interruption during a slow metastore call.","commonSituations":"Spark/Flink task cancellation during planning; shutdown hooks interrupting worker threads; framework watchdogs interrupting long metastore waits.","solutions":["Re-run the existence check after understanding the interruption source (cancellation usually means you should abort, not retry).","Reduce metastore call latency (network, connection pool sizing) so calls complete before watchdog interrupts.","Preserve and respect the interrupt flag in calling code rather than suppressing it."],"exampleFix":"// before\nboolean exists = catalog.tableExists(identifier);\n// after\ntry {\n  boolean exists = catalog.tableExists(identifier);\n} catch (RuntimeException e) {\n  if (Thread.currentThread().isInterrupted()) {\n    throw new IllegalStateException(\"Cancelled during existence check\", e);\n  }\n  throw e;\n}","handlingStrategy":"try-catch","validationCode":"if (Thread.currentThread().isInterrupted()) { throw new IllegalStateException(\"Interrupted before existence check\"); }","typeGuard":null,"tryCatchPattern":"try { boolean ok = catalog.tableExists(id); } catch (RuntimeException e) { if (Thread.currentThread().isInterrupted()) { /* abort: state unknown */ } throw e; }","preventionTips":["Treat interruption as 'unknown', never as 'table absent'","Restore and honor the interrupt flag in caller code","Reduce metastore latency to avoid watchdog interrupts"],"tags":["hive-metastore","table-exists","interrupted","cancellation"],"backgroundTag":"request-timeout","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}