apache/dolphinscheduler · error · RuntimeException
Query t_ds_schedules error
Error message
Query t_ds_schedules error
What it means
Thrown by V320DolphinSchedulerUpgrader.getSchedulerByProcessDefinitionCode when the SELECT against t_ds_schedules fails. The upgrade uses scheduler rows to derive tenant_code while backfilling process instances. Any exception in the JDBC block is wrapped in this RuntimeException.
Source
Thrown at dolphinscheduler-tools/src/main/java/org/apache/dolphinscheduler/tools/datasource/upgrader/v320/V320DolphinSchedulerUpgrader.java:242
}
private Map<String, Object> getSchedulerByProcessDefinitionCode(Long processDefinitionCode) {
try (
Connection connection = dataSource.getConnection();
PreparedStatement preparedStatement = connection
.prepareStatement("select * from t_ds_schedules where process_definition_code = ?")) {
preparedStatement.setLong(1, processDefinitionCode);
try (ResultSet resultSet = preparedStatement.executeQuery()) {
while (resultSet.next()) {
Map<String, Object> row = new HashMap<>();
row.put("tenant_code", resultSet.getString("tenant_code"));
return row;
}
}
return Collections.emptyMap();
} catch (Exception ex) {
throw new RuntimeException("Query t_ds_schedules error", ex);
}
}
private void updateProjectCodeInProcessInstance(Integer processInstanceId, Long projectCode, String tenantCode,
String executorName) {
try (
Connection connection = dataSource.getConnection();
PreparedStatement preparedStatement = connection.prepareStatement(
"update t_ds_process_instance set project_code = ?, tenant_code = ?, executor_name = ? where id = ?")) {
preparedStatement.setLong(1, projectCode);
preparedStatement.setString(2, tenantCode);
preparedStatement.setString(3, executorName);
preparedStatement.setInt(4, processInstanceId);
preparedStatement.executeUpdate();
} catch (Exception ex) {
throw new RuntimeException("Update t_ds_process_instance error", ex);
}
}View on GitHub (pinned to 02eac45a1b)
Solutions
- Inspect the cause chain for the real SQLException
- Confirm t_ds_schedules exists and matches the 3.2.0 schema
- Grant SELECT on t_ds_schedules to the upgrade user
- Re-run the upgrade after restoring DB connectivity/schema
Defensive patterns
Strategy: try-catch
Validate before calling
try (Connection c = dataSource.getConnection();
ResultSet rs = c.createStatement().executeQuery(
"select process_definition_code, tenant_code from t_ds_schedules where 1=0")) {
} catch (SQLException e) {
throw new IllegalStateException("t_ds_schedules unreadable or missing columns: " + e.getMessage(), e);
} Try / catch
try {
upgrader.upgrade();
} catch (RuntimeException e) {
if (e.getMessage() != null && e.getMessage().contains("Query t_ds_schedules error")) {
log.error("Scheduler lookup failed: {}", e.getCause(), e);
} else { throw e; }
} Prevention
- Verify t_ds_schedules matches the expected schema before upgrading
- Grant the migration user SELECT on schedule tables
- Test the upgrade against a staging copy of the metadata DB
When it happens
Trigger: Running the 3.2.0 upgrade when t_ds_schedules is missing, lacks expected columns (e.g. tenant_code / process_definition_code), or the connection fails during scheduler lookup.
Common situations: Metadata DB partially migrated so t_ds_schedules schema differs; DB user without SELECT privilege; transient DB outage 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_user error
- Query t_ds_process_definition_log 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/edd0569c2951e185.
Report an issue: GitHub.