apache/dolphinscheduler · error · RuntimeException
Query t_ds_user error
Error message
Query t_ds_user error
What it means
Thrown by V320DolphinSchedulerUpgrader.getUserMap when the JDBC query 'select id, user_name from t_ds_user' fails. The upgrader needs the id->user_name map to resolve executor names while backfilling project_code. Any exception in the query is wrapped in this RuntimeException.
Source
Thrown at dolphinscheduler-tools/src/main/java/org/apache/dolphinscheduler/tools/datasource/upgrader/v320/V320DolphinSchedulerUpgrader.java:157
return processInstanceList;
} catch (Exception ex) {
throw new RuntimeException("Query t_ds_process_instance error", ex);
}
}
private Map<Integer, String> getUserMap() {
Map<Integer, String> userMap = new HashMap<>();
try (
Connection connection = dataSource.getConnection();
PreparedStatement preparedStatement =
connection.prepareStatement("select id, user_name from t_ds_user");
ResultSet resultSet = preparedStatement.executeQuery()) {
while (resultSet.next()) {
userMap.put(resultSet.getInt("id"), resultSet.getString("user_name"));
}
} catch (Exception ex) {
throw new RuntimeException("Query t_ds_user error", ex);
}
return userMap;
}
private List<Map<String, Object>> getProcessInstanceWhichProjectCodeIsNull() {
List<Map<String, Object>> processInstanceList = new ArrayList<>();
try (
Connection connection = dataSource.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement(
"select id, process_definition_code, process_definition_version, executor_id from t_ds_process_instance where project_code is null limit 1000");
ResultSet resultSet = preparedStatement.executeQuery()) {
while (resultSet.next()) {
Map<String, Object> row = new HashMap<>();
row.put("id", resultSet.getInt("id"));
row.put("process_definition_code", resultSet.getLong("process_definition_code"));
row.put("process_definition_version", resultSet.getInt("process_definition_version"));
row.put("executor_id", resultSet.getInt("executor_id"));
processInstanceList.add(row);View on GitHub (pinned to 02eac45a1b)
Solutions
- Inspect the 'Caused by' exception for the underlying JDBC error
- Verify the DB account can SELECT from t_ds_user
- Confirm t_ds_user exists in the schema being upgraded (correct database/schema selected)
- Check DB availability and re-run the upgrade tool
Defensive patterns
Strategy: try-catch
Validate before calling
try (Connection c = dataSource.getConnection();
Statement s = c.createStatement()) {
s.executeQuery("select id, user_name from t_ds_user limit 1");
} catch (SQLException e) {
throw new IllegalStateException("t_ds_user not readable: " + e.getMessage(), e);
} Try / catch
try {
upgrader.upgrade();
} catch (RuntimeException e) {
if (e.getMessage() != null && e.getMessage().contains("Query t_ds_user error")) {
log.error("Cannot read t_ds_user: {}", e.getCause(), e);
} else { throw e; }
} Prevention
- Grant SELECT on t_ds_user to the migration DB account
- Confirm the target database/schema name in config points at the real metadata DB
- Test connectivity with the same JDBC driver version used by the tool
When it happens
Trigger: Running the v3.2.0 upgrade when t_ds_user does not exist, the DB user lacks SELECT on it, or the connection/driver fails during getUserMap.
Common situations: Upgrading against a metadata DB from a different/older version missing t_ds_user; restricted DB account; transient connection loss mid-upgrade.
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
- Query t_ds_process_instance error
- Query t_ds_process_definition_log error
- Query t_ds_schedules error
- Update t_ds_process_instance error
- Execute ddl file failed, meet an unknown exception
AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06).
Data as JSON: /api/errors/d25b0ce1a06d8d59.
Report an issue: GitHub.