apache/hadoop · error · RuntimeException

Failed to set delegation key id in SQL secret manager

Error message

Failed to set delegation key id in SQL secret manager

What it means

Wraps a SQLException raised by updateKeyId in setCurrentKeyId: the SQL store refused the new last-key-id value, so the persisted counter would diverge from memory and the failure is rethrown as a RuntimeException.

Solutions

  1. Setting the delegation key id in SQL failed. Verify write access to the counter table; 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:437 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/0ab7a4f115f991f5. Report an issue: GitHub.

Appendix: source

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

  public int getCurrentKeyId() {
    try {
      return selectKeyId();
    } catch (SQLException e) {
      throw new RuntimeException(
          "Failed to get delegation key id in SQL secret manager", e);
    }
  }

  /**
   * Updates the value of the last delegation key id.
   * @param keyId Value to update the delegation key id to.
   */
  @Override
  public void setCurrentKeyId(int keyId) {
    try {
      updateKeyId(keyId);
    } catch (SQLException e) {
      throw new RuntimeException(
          "Failed to set delegation key id in SQL secret manager", e);
    }
  }

  /**
   * Obtains the next available delegation key id that can be allocated to a DelegationKey.
   * Delegation key id need to be reserved using the shared delegationKeyIdCounter,
   * which handles keyId allocation concurrently with other secret managers.
   * @return Next available delegation key id.
   */
  @Override
  public int incrementCurrentKeyId() {
    try {
      return incrementKeyId(1) + 1;
    } catch (SQLException e) {
      throw new RuntimeException(
          "Failed to increment delegation key id in SQL secret manager", e);
    }

View on GitHub (pinned to 2add963021)