apache / dolphinscheduler

Apache DolphinScheduler is the modern data orchestration platform. Agile to create high performance workflow with low-code
https://dolphinscheduler.apache.org/
Apache License 2.0
12.47k stars 4.51k forks source link

[Bug] [Master] fail when submit workflow instance #15753

Open HSLife1991 opened 4 months ago

HSLife1991 commented 4 months ago

Search before asking

What happened

Caused by: org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 2 at org.apache.ibatis.session.defaults.DefaultSqlSession.selectOne(DefaultSqlSession.java:80)

18:18 at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:485) at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:650) at org.apache.dolphinscheduler.server.master.runner.MasterSchedulerBootstrap.run(MasterSchedulerBootstrap.java:134) Caused by: org.mybatis.spring.MyBatisSystemException: nested exception is org.apache.ibatis.exceptions.TooManyResultsException: Expected one result (or null) to be returned by selectOne(), but found: 2 at org.mybatis.spring.MyBatisExceptionTranslator.translateExceptionIfPossible(MyBatisExceptionTranslator.java:96) at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:441) at com.sun.proxy.$Proxy134.selectOne(Unknown Source) at org.mybatis.spring.SqlSessionTemplate.selectOne(SqlSessionTemplate.java:160) at com.baomidou.mybatisplus.core.override.MybatisMapperMethod.execute(MybatisMapperMethod.java:89) at com.baomidou.mybatisplus.core.override.MybatisMapperProxy$PlainMethodInvoker.invoke(MybatisMapperProxy.java:148) at com.baomidou.mybatisplus.core.override.MybatisMapperProxy.invoke(MybatisMapperProxy.java:89) at com.sun.proxy.$Proxy175.queryByTypeAndJobId(Unknown Source) at org.apache.dolphinscheduler.service.process.TriggerRelationServiceImpl.queryByTypeAndJobId(TriggerRelationServiceImpl.java:50) at org.apache.dolphinscheduler.service.process.TriggerRelationServiceImpl.saveProcessInstanceTrigger(TriggerRelationServiceImpl.java:65) at org.apache.dolphinscheduler.service.process.ProcessServiceImpl.handleCommand(ProcessServiceImpl.java:342) at org.apache.dolphinscheduler.service.process.ProcessServiceImpl$$FastClassBySpringCGLIB$$9d3e18f9.invoke()

What you expected to happen

correct create workflow instance

How to reproduce

1.create a workflow with no scheduler 2.run the workflow

Anything else

no

Version

3.2.x

Are you willing to submit PR?

Code of Conduct

KevinLvLight commented 3 months ago

We met the same problem, and we found the SQL according log: TriggerRelationMapper.xml

` id, trigger_code, trigger_type, job_id, create_time, update_time

<select id="queryByTypeAndJobId" resultType="org.apache.dolphinscheduler.dao.entity.TriggerRelation">
    select
    <include refid="baseSql"/>
    from t_ds_trigger_relation
    WHERE trigger_type = #{triggerType} and job_id =  #{jobId}
</select>

` But we donot known how this occured and how to solve it.

peak-xu commented 3 months ago

I encountered the same problem

xuet0ng commented 2 months ago

meet the same problem. I take following 3 steps to temporarily avoid this issue:

  1. backup t_ds_trigger_relation
  2. delete from t_ds_trigger_relation
  3. restart dolphinscheduler
xuet0ng commented 2 months ago

the job_id of t_ds_trigger_relation based on id of t_ds_command which is auto incr by mysql but the auto incr is reset by some way (maybe truncate in a dev env.)

peak-xu commented 2 months ago

the job_id of t_ds_trigger_relation based on id of t_ds_command which is auto incr by mysql but the auto incr is reset by some way (maybe truncate in a dev env.)

It seems like a serious bug, but why haven't others encountered it?

SbloodyS commented 2 weeks ago

Did you upgrade from the lower version to this version?