{"record":{"id":"2f3ea6386dcfcc36","repo":"apache/iceberg","slug":"failed-to-get-lock-information-for-s-2f3ea6","errorCode":null,"errorMessage":"Failed to get lock information for %s","messagePattern":"Failed to get lock information for (.+?)","errorType":"exception","errorClass":"UncheckedSQLException","httpStatus":null,"severity":"error","filePath":"flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/maintenance/api/JdbcLockFactory.java","lineNumber":303,"sourceCode":"        return pool.run(\n            conn -> {\n              try (PreparedStatement sql = conn.prepareStatement(GET_LOCK_SQL)) {\n                sql.setString(1, type.key);\n                sql.setString(2, lockId);\n                try (ResultSet rs = sql.executeQuery()) {\n                  if (rs.next()) {\n                    return rs.getString(1);\n                  } else {\n                    return null;\n                  }\n                }\n              }\n            });\n      } catch (InterruptedException e) {\n        Thread.currentThread().interrupt();\n        throw new UncheckedInterruptedException(e, \"Interrupted during unlock\");\n      } catch (SQLException e) {\n        throw new UncheckedSQLException(e, \"Failed to get lock information for %s\", type);\n      }\n    }\n  }\n\n  private enum Type {\n    MAINTENANCE(\"m\"),\n    RECOVERY(\"r\");\n\n    private final String key;\n\n    Type(String key) {\n      this.key = key;\n    }\n  }\n}\n","sourceCodeStart":285,"sourceCodeEnd":319,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/maintenance/api/JdbcLockFactory.java#L285-L319","documentation":"JdbcLockFactory.instanceId() wraps a SQLException raised while reading lock information rows from the JDBC catalog table in an UncheckedSQLException with message \"Failed to get lock information for %s\" (the lock Type). The maintenance lock could not be inspected, so lock acquisition cannot proceed safely.","triggerScenarios":"Calling JdbcLockFactory.create()/acquire paths that invoke instanceId() when the SELECT on the lock table fails: bad connection, missing lock table, SQL syntax/schema mismatch, deadlock or timeout.","commonSituations":"JDBC catalog URL or credentials misconfigured; lock table dropped or never initialized; DB under heavy load causing timeouts; permission denied on the lock table for the configured user.","solutions":["Inspect the wrapped SQLException cause for the concrete DB error","Verify the jdbc catalog initialization created the lock table and the user has SELECT rights","Test connectivity with the same JDBC URL/credentials outside Flink","Retry; transient DB issues resolve on the next maintenance cycle"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"// preflight: lock table exists and is readable\ntry (Connection c = DriverManager.getConnection(jdbcUrl, user, pass);\n     Statement s = c.createStatement()) { s.executeQuery(\"SELECT 1 FROM iceberg_lock\"); }","typeGuard":null,"tryCatchPattern":"try { ... instanceId path ... } catch (UncheckedSQLException e) { LOG.error(\"lock info read failed: {}\", e.getCause()); }","preventionTips":["Confirm lock table initialization on first deploy","Check user SELECT permissions on the lock table","Test JDBC URL/credentials outside Flink before launch","Retry transient DB failures instead of aborting the job"],"tags":["jdbc","sql","locking","database"],"backgroundTag":"database-query-failed","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"}