apache/iceberg · error · RuntimeException

Interrupted in call to drop dropDatabase(name)

Error message

Interrupted in call to drop dropDatabase(name) <namespace> in Hive Metastore

What it means

dropNamespace restores the interrupt flag and throws a RuntimeException when the thread is interrupted during the metastore dropDatabase call. The drop may or may not have completed; the exception reflects cancellation, not metastore failure.

Solutions

  1. Use graceful shutdown so in-flight drops complete before interruption
  2. After catching it, verify with namespaceExists whether the database was actually dropped before retrying
  3. If cancellation was intended, exit cleanly — the interrupt flag is already restored
Defensive patterns

Strategy: try-catch

Validate before calling

if (Thread.currentThread().isInterrupted()) {
  throw new InterruptedException("Skipping dropNamespace: already interrupted");
}

Try / catch

try {
  catalog.dropNamespace(ns, false);
} catch (RuntimeException e) {
  if (Thread.currentThread().isInterrupted()) {
    // verify actual drop state before retry
    if (catalog.namespaceExists(ns)) { /* retry later */ }
    return;
  }
  throw e;
}

Prevention

When it happens

Trigger: Thread executing catalog.dropNamespace(...) is interrupted while the dropDatabase call runs (job cancel, shutdown, timeout watchdog).

Common situations: Cancelling a cleanup job mid-drop; application shutdown during namespace teardown; orchestration timeouts interrupting threads.

Understand the failure class

Background: Request timed out: what client-side request timeouts mean across libraries (Request timed out, TIMED_OUT, APITimeoutError) — this error's family across 39 libraries.

Related errors


AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12). Data as JSON: /api/errors/61e28be619e23ce0. Report an issue: GitHub.

Appendix: source

Thrown at hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java:624

            return null;
          });

      LOG.info("Dropped namespace: {}", namespace);
      return true;

    } catch (InvalidOperationException e) {
      throw new NamespaceNotEmptyException(
          e, "Namespace %s is not empty. One or more tables exist.", namespace);

    } catch (NoSuchObjectException e) {
      return false;

    } catch (TException e) {
      throw new RuntimeException("Failed to drop namespace " + namespace + " in Hive Metastore", e);

    } catch (InterruptedException e) {
      Thread.currentThread().interrupt();
      throw new RuntimeException(
          "Interrupted in call to drop dropDatabase(name) " + namespace + " in Hive Metastore", e);
    }
  }

  @Override
  public boolean setProperties(Namespace namespace, Map<String, String> properties) {
    Preconditions.checkArgument(
        (properties.get(HMS_DB_OWNER_TYPE) == null) == (properties.get(HMS_DB_OWNER) == null),
        "Setting %s and %s has to be performed together or not at all",
        HMS_DB_OWNER_TYPE,
        HMS_DB_OWNER);
    Map<String, String> parameter = Maps.newHashMap();

    parameter.putAll(loadNamespaceMetadata(namespace));
    parameter.putAll(properties);
    Database database = convertToDatabase(namespace, parameter);

    alterHiveDataBase(namespace, database);

View on GitHub (pinned to 86d9c8fc54)