apache/hadoop · error · IOException

Failed to store delegation key in SQL secret manager

Error message

Failed to store delegation key in SQL secret manager

What it means

Wraps a SQLException raised while inserting a new DelegationKey row into the SQL token store in storeDelegationKey: the key serialization succeeded but the database insert failed (e.g. duplicate keyId or connectivity), surfaced as an IOException.

Solutions

  1. Storing the delegation key in SQL failed. Verify the keys table schema and database connectivity; see the chained SQLException.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/SQLDelegationTokenSecretManager.java:343 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/hadoop@2add963021 (2026-08-22). Data as JSON: /api/errors/cf48edeb848dfe5e. Report an issue: GitHub.

Appendix: source

Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/token/delegation/SQLDelegationTokenSecretManager.java:343

  }

  /**
   * Persists a DelegationKey into the SQL database. The delegation keyId
   * is expected to be unique and any duplicate key attempts will result
   * in an IOException.
   * @param key DelegationKey to persist into the SQL database.
   */
  @Override
  protected void storeDelegationKey(DelegationKey key) throws IOException {
    try (ByteArrayOutputStream bos = new ByteArrayOutputStream();
        DataOutputStream dos = new DataOutputStream(bos)) {
      key.write(dos);
      // Add delegation key to SQL database
      insertDelegationKey(key.getKeyId(), bos.toByteArray());
      // Add delegation key to local cache
      super.storeDelegationKey(key);
    } catch (SQLException e) {
      throw new IOException("Failed to store delegation key in SQL secret manager", e);
    }
  }

  /**
   * Updates an existing DelegationKey in the SQL database.
   * @param key Updated DelegationKey.
   */
  @Override
  protected void updateDelegationKey(DelegationKey key) throws IOException {
    try (ByteArrayOutputStream bos = new ByteArrayOutputStream();
        DataOutputStream dos = new DataOutputStream(bos)) {
      key.write(dos);
      // Update delegation key in SQL database
      updateDelegationKey(key.getKeyId(), bos.toByteArray());
      // Update delegation key in local cache
      super.updateDelegationKey(key);
    } catch (SQLException e) {
      throw new IOException("Failed to update delegation key in SQL secret manager", e);

View on GitHub (pinned to 2add963021)