apache/iceberg · error · UncheckedSQLException
Failed to get lock information for
Error message
Failed to get lock information for %s
What it means
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.
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
Defensive patterns
Strategy: retry
Validate before calling
// preflight: lock table exists and is readable
try (Connection c = DriverManager.getConnection(jdbcUrl, user, pass);
Statement s = c.createStatement()) { s.executeQuery("SELECT 1 FROM iceberg_lock"); } Try / catch
try { ... instanceId path ... } catch (UncheckedSQLException e) { LOG.error("lock info read failed: {}", e.getCause()); } Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Understand the failure class
Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.
Related errors
- Failed to remove lock
- Cannot check and eventually update SQL schema
- Cannot initialize JDBC catalog
- Cannot initialize JDBC table maintenance lock
- Cannot initialize JDBC table maintenance lock
AI-assisted analysis of apache/iceberg@86d9c8fc54 (2026-09-12).
Data as JSON: /api/errors/2f3ea6386dcfcc36.
Report an issue: GitHub.
Appendix: source
Thrown at flink/v2.3/flink/src/main/java/org/apache/iceberg/flink/maintenance/api/JdbcLockFactory.java:303
return pool.run(
conn -> {
try (PreparedStatement sql = conn.prepareStatement(GET_LOCK_SQL)) {
sql.setString(1, type.key);
sql.setString(2, lockId);
try (ResultSet rs = sql.executeQuery()) {
if (rs.next()) {
return rs.getString(1);
} else {
return null;
}
}
}
});
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
throw new UncheckedInterruptedException(e, "Interrupted during unlock");
} catch (SQLException e) {
throw new UncheckedSQLException(e, "Failed to get lock information for %s", type);
}
}
}
private enum Type {
MAINTENANCE("m"),
RECOVERY("r");
private final String key;
Type(String key) {
this.key = key;
}
}
}
View on GitHub (pinned to 86d9c8fc54)