cat /opt/metersphere/logs/result-hub/error.log:
2025-08-06 17:10:04,080 [MS-KAFKA-LISTENER-TASK-959] ERROR i.m.r.api.listener.ApiReportTask ? - Method[run][org.springframework.dao.DuplicateKeyException:
Error updating database. Cause: java.sql.SQLIntegrityConstraintViolationException: Duplicate entry ‘1061784635056129’ for key ‘api_scenario_report_log.PRIMARY’
The error may exist in io/metersphere/api/mapper/ApiScenarioReportLogMapper.xml
The error may involve io.metersphere.api.mapper.ApiScenarioReportLogMapper.insert-Inline
The error occurred while setting parameters
SQL: insert into api_scenario_report_log (id, report_id, console ) values (?, ?, ? )
Cause: java.sql.SQLIntegrityConstraintViolationException: Duplicate entry ‘1061784635056129’ for key ‘api_scenario_report_log.PRIMARY’
; Duplicate entry ‘1061784635056129’ for key ‘api_scenario_report_log.PRIMARY’]
org.springframework.dao.DuplicateKeyException:
Error updating database. Cause: java.sql.SQLIntegrityConstraintViolationException: Duplicate entry ‘1061784635056129’ for key ‘api_scenario_report_log.PRIMARY’
The error may exist in io/metersphere/api/mapper/ApiScenarioReportLogMapper.xml
The error may involve io.metersphere.api.mapper.ApiScenarioReportLogMapper.insert-Inline
The error occurred while setting parameters
SQL: insert into api_scenario_report_log (id, report_id, console ) values (?, ?, ? )
Cause: java.sql.SQLIntegrityConstraintViolationException: Duplicate entry ‘1061784635056129’ for key ‘api_scenario_report_log.PRIMARY’
; Duplicate entry ‘1061784635056129’ for key ‘api_scenario_report_log.PRIMARY’
任务中心显示执行中,里面有些步骤显示未执行,获取不到日志
查了下各种方法,AI说可以启用
metersphere-linux.properties中:
id.generator.type=enhanced-snowflake
snowflake.worker-id=0
snowflake.datacenter-id=1
最初试过一次好像没再出现了,后面重新部署又有这个问题了,增强版雪花算法有用吗?还是有别的方法解决报告ID重复的问题
版本:v3.6.5-lts