Browse Source

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

* Fix query process instances by trigger code bug

* Add comment
3.2.1-prepare
Eric Gao 1 year 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 dry_run, test_flag, next_process_instance_id, restart_time, state_history
</sql> </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 id="queryDetailById" resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance">
select select
<include refid="baseSql"/> <include refid="baseSql"/>
@ -366,13 +356,14 @@
and next_process_instance_id = 0 and next_process_instance_id = 0
</update> </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 id="queryByTriggerCode" resultType="org.apache.dolphinscheduler.dao.entity.ProcessInstance">
select select
<include refid="baseSqlV2"> <include refid="baseSql"/>
<property name="alias" value="b"/> from t_ds_process_instance a
</include> join
from t_ds_trigger_relation a (select trigger_type, job_id, trigger_code from t_ds_trigger_relation) b
join t_ds_process_instance b on a.job_id = b.id on a.id = b.job_id
where a.trigger_type = 0 and a.trigger_code = #{triggerCode} where b.trigger_type = 0 and b.trigger_code = #{triggerCode}
</select> </select>
</mapper> </mapper>

Loading…
Cancel
Save