Browse Source

[Bug][Core] Fix query process instances by trigger code bug (#14528)

* Fix query process instances by trigger code bug

* Add comment
revert-14193-dev
Eric Gao 11 months ago committed by GitHub
parent
commit
06b6ea81cf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 23
      dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessInstanceMapper.xml

23
dolphinscheduler-dao/src/main/resources/org/apache/dolphinscheduler/dao/mapper/ProcessInstanceMapper.xml

@ -28,16 +28,6 @@
dry_run, test_flag, next_process_instance_id, restart_time, state_history
</sql>
<sql id="baseSqlV2">
${alias}.id
, ${alias}.name, ${alias}.process_definition_version, ${alias}.process_definition_code, ${alias}.project_code, ${alias}.state, ${alias}.recovery, ${alias}.start_time, ${alias}.end_time, ${alias}.run_times,host,
command_type, ${alias}.command_param, ${alias}.task_depend_type, ${alias}.max_try_times, ${alias}.failure_strategy, ${alias}.warning_type,
warning_group_id, ${alias}.schedule_time, ${alias}.command_start_time, ${alias}.global_params, ${alias}.flag,
update_time, ${alias}.is_sub_process, ${alias}.executor_id, ${alias}.history_cmd,
process_instance_priority, ${alias}.worker_group,environment_code, ${alias}.timeout, ${alias}.tenant_code, ${alias}.var_pool,
dry_run, ${alias}.test_flag, ${alias}.next_process_instance_id, ${alias}.restart_time, ${alias}.state_history
</sql>
<select id="queryDetailById" resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance">
select
<include refid="baseSql"/>
@ -366,13 +356,14 @@
and next_process_instance_id = 0
</update>
<!-- There are some columns with the same names in both tables, we use a sub-query here to avoid ambiguity-->
<select id="queryByTriggerCode" resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance">
select
<include refid="baseSqlV2">
<property name="alias" value="b"/>
</include>
from t_ds_trigger_relation a
join t_ds_process_instance b on a.job_id = b.id
where a.trigger_type = 0 and a.trigger_code = #{triggerCode}
<include refid="baseSql"/>
from t_ds_process_instance a
join
(select trigger_type, job_id, trigger_code from t_ds_trigger_relation) b
on a.id = b.job_id
where b.trigger_type = 0 and b.trigger_code = #{triggerCode}
</select>
</mapper>

Loading…
Cancel
Save