Bug #7316
closedduplicate key value error on Rudder
Description
After installing Rudder + enterprise module, the reporting failed, and I got the following error
ERROR com.normation.rudder.reports.execution.WoReportsExecutionSquerylRepository - Error when trying to update nodes report executions, reason is Batch entry 7 insert into "reportsexecution" ("complete", "date", "insertionid", "nodeconfigid", "nodeid") values ('1','2015-10-27 15:35:21.000000 +00:00:00',629,'-2141039261','root') was aborted. Call getNextException to see the cause. java.sql.BatchUpdateException: Batch entry 7 insert into "reportsexecution" ("complete", "date", "insertionid", "nodeconfigid", "nodeid") values ('1','2015-10-27 15:35:21.000000 +00:00:00',629,'-2141039261','root') was aborted. Call getNextException to see the cause.
on postgres
ERROR: duplicate key value violates unique constraint "reportsexecution_pkey"STATEMENT: insert into "reportsexecution" ("complete", "date", "insertionid", "nodeconfigid", "nodeid") values ($1,$2,$3,$4,$5)
happened on 3.1, may happen on every version
Updated by Nicolas CHARLES about 9 years ago
ok, the issue was:
1/ have rudder-agent running
2/ install cfengine enterprise
3/ runs rudder-agent and cfengine-enterprise are at the same time, but with node config id different (one is null, since initial promises, one is not null)
4/ duplicate entries in the database, because of that
5/ fail
Updated by Nicolas CHARLES about 9 years ago
- Assignee set to François ARMAND
- Target version changed from 3.1.5 to 2.11.17
solution would be in ReportsJdbcRepository.getReportsfromId
group by nodeid-executiontimestamp; if more than one entry, take the non-null (or a random one)
Profit
Updated by François ARMAND about 9 years ago
- Status changed from New to In progress
Updated by Nicolas CHARLES about 9 years ago
- Target version changed from 2.11.17 to 3.0.12
Updated by François ARMAND about 9 years ago
- Status changed from In progress to Pending technical review
- Assignee changed from François ARMAND to Nicolas CHARLES
- Pull Request set to https://github.com/Normation/rudder/pull/936
Updated by François ARMAND about 9 years ago
- Status changed from Pending technical review to Pending release
- % Done changed from 0 to 100
Applied in changeset rudder|3a275e065bcc2b33dac305fd66dfc701ffa82fcd.
Updated by Nicolas CHARLES about 9 years ago
Applied in changeset rudder|3f9a868c7c2e750588c755d93883a54678e51f57.
Updated by Nicolas CHARLES almost 9 years ago
to clean entries and restore rudder in a working state
delete from ruddersysevents where (executiontimestamp, nodeid) in (select executiontimestamp, nodeid from (select executiontimestamp, nodeid, count(*) as duplicate from ruddersysevents where keyvalue = 'StartRun' group by executiontimestamp, nodeid) as T where duplicate > 1);
Updated by Vincent MEMBRÉ almost 9 years ago
- Status changed from Pending release to Released
This bug has been fixed in Rudder 3.0.12 and 3.1.5 which were released today.
- 3.0: Announce Changelog
- 3.1: Announce Changelog
- Download: https://www.rudder-project.org/site/get-rudder/downloads/