apache/dolphinscheduler · error · RuntimeException

Update t_ds_process_instance error

Error message

Update t_ds_process_instance error

What it means

Thrown by V320DolphinSchedulerUpgrader.updateProjectCodeInProcessInstance when the UPDATE of t_ds_process_instance (setting project_code, tenant_code, executor_name) fails during the 3.2.0 upgrade. JDBC exceptions are wrapped in this RuntimeException.

Source

Thrown at dolphinscheduler-tools/src/main/java/org/apache/dolphinscheduler/tools/datasource/upgrader/v320/V320DolphinSchedulerUpgrader.java:258

            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);
        }
    }

    private void updateProjectCodeInTaskInstance(Integer id, Long projectCode, String processInstanceName,
                                                 String executorName) {
        try (
                Connection connection = dataSource.getConnection();
                PreparedStatement preparedStatement = connection.prepareStatement(
                        "update t_ds_task_instance set project_code = ?, process_instance_name = ?, executor_name = ? where id = ?")) {
            preparedStatement.setLong(1, projectCode);
            preparedStatement.setString(2, processInstanceName);
            preparedStatement.setString(3, executorName);
            preparedStatement.setInt(4, id);
            preparedStatement.executeUpdate();
        } catch (Exception ex) {
            throw new RuntimeException("Update t_ds_process_instance error", ex);
        }
    }

View on GitHub (pinned to 02eac45a1b)

Solutions

  1. Check 'Caused by' for the underlying SQLException
  2. Apply the 3.2.0->3.2.1 DDL first so project_code/tenant_code/executor_name columns exist
  3. Grant UPDATE on t_ds_process_instance to the upgrade user
  4. Stop running DolphinScheduler services during upgrade to avoid row locks
  5. If the update fails mid-way, restore the DB backup and re-run
Defensive patterns

Strategy: try-catch

Validate before calling

try (Connection c = dataSource.getConnection();
     ResultSet rs = c.createStatement().executeQuery(
         "select project_code, tenant_code, executor_name from t_ds_process_instance where 1=0")) {
} catch (SQLException e) {
    throw new IllegalStateException("Update preconditions unmet (columns missing?): " + e.getMessage(), e);
}

Try / catch

try {
    upgrader.upgrade();
} catch (RuntimeException e) {
    if (e.getMessage() != null && e.getMessage().contains("Update t_ds_process_instance error")) {
        log.error("Update failed: {}", e.getCause(), e);
        // restore from backup before re-running since upgrade is partially applied
    } else { throw e; }
}

Prevention

When it happens

Trigger: Executing upgradeWorkflowInstance when the UPDATE fails: missing project_code/tenant_code columns (schema SQL not applied), NOT NULL/constraint violation, row locked, or insufficient UPDATE privilege.

Common situations: Running the data upgrader before the DDL migration added the new columns; DB user is read-only; lock contention from a running DolphinScheduler instance using the same metadata DB.

Related errors


AI-assisted analysis of apache/dolphinscheduler@02eac45a1b (2026-09-06). Data as JSON: /api/errors/40deab6d96bb07dc. Report an issue: GitHub.