Project

General

Profile

Actions

Bug #7316

closed

duplicate key value error on Rudder

Added by Nicolas CHARLES about 9 years ago. Updated almost 9 years ago.

Status:
Released
Priority:
N/A
Category:
Web - Config management
Target version:
Severity:
UX impact:
User visibility:
Effort required:
Priority:
Name check:
Fix check:
Regression:

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

Actions #1

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

Actions #2

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

Actions #3

Updated by François ARMAND about 9 years ago

  • Status changed from New to In progress
Actions #4

Updated by Nicolas CHARLES about 9 years ago

  • Target version changed from 2.11.17 to 3.0.12
Actions #5

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
Actions #6

Updated by François ARMAND about 9 years ago

  • Status changed from Pending technical review to Pending release
  • % Done changed from 0 to 100
Actions #8

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);

Actions #9

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.

Actions

Also available in: Atom PDF