dolphinscheduler icon indicating copy to clipboard operation
dolphinscheduler copied to clipboard

[Bug] [API&MASTER] 3.2.0 The restart of MySQL 5.7 can cause an Auto Increment ID reset, potentially resulting in the inability to execute command.

Open Zzih96 opened this issue 1 year ago • 2 comments

Search before asking

  • [X] I had searched in the issues and found no similar issues.

What happened

When calling thestartProcessInstance API (/executors/start-process-instance), no workflow instance is generated. Upon checking the dolphinscheduler-master log, I found the following Exception: image

I found that https://github.com/apache/dolphinscheduler/pull/13184 added the method queryByTypeAndJobId and the table t_ds_trigger_relation. In the t_ds_trigger_relation table, the job_id corresponds to the id in the t_ds_command table.

When MySQL 5.7 is restarted, it will reset the auto-increment ID of thet_ds_command table. This will lead to duplicatedjob_id entries in thet_ds_trigger_relation table. Subsequently, when querying using thequeryByTypeAndJobId method, an error message may occur: 'Expected one result (or null) to be returned by selectOne(), but found: 2'. image

The job_id in the t_ds_trigger_relation table has already exceeded 7000. image the auto-increment ID of thet_ds_command table has become 418. image

Similarly,t_ds_error_command cannot be inserted.

What you expected to happen

I think I can add a 'code' field to the 't_ds_command' table, and then establish associations with other tables using this 'code' field.is there any other better way?

How to reproduce

restart mysql.exec process.

Anything else

No response

Version

3.2.x

Are you willing to submit PR?

  • [X] Yes I am willing to submit a PR!

Code of Conduct

Zzih96 avatar Jan 31 '24 08:01 Zzih96

I think add a code field would be better

liukunyuan avatar Jan 31 '24 10:01 liukunyuan

I think add a code field would be better

I noticed that the job_id field in the t_ds_trigger_relation table also holds the id field from the t_ds_process_instance table. If I add a code field to the t_ds_command table, should I also add a code field to the t_ds_process_instance table for association? This change may have significant implications, so I believe it warrants further discussion. image

Zzih96 avatar Feb 01 '24 08:02 Zzih96

This issue has been automatically marked as stale because it has not had recent activity for 30 days. It will be closed in next 7 days if no further activity occurs.

github-actions[bot] avatar Mar 04 '24 00:03 github-actions[bot]

This issue has been closed because it has not received response for too long time. You could reopen it if you encountered similar problems in the future.

github-actions[bot] avatar Mar 11 '24 00:03 github-actions[bot]