Project

General

Profile

Bug #7316

duplicate key value error on Rudder

Added by Nicolas CHARLES over 5 years ago. Updated about 5 years ago.

Status:
Released
Priority:
N/A
Category:
Web - Config management
Target version:
Severity:
User visibility:
Effort required:
Priority:

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

#1

Updated by Nicolas CHARLES over 5 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

#2

Updated by Nicolas CHARLES over 5 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

#3

Updated by François ARMAND over 5 years ago

  • Status changed from New to In progress
#4

Updated by Nicolas CHARLES over 5 years ago

  • Target version changed from 2.11.17 to 3.0.12
#5

Updated by François ARMAND over 5 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
#6

Updated by François ARMAND over 5 years ago

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

Updated by Nicolas CHARLES over 5 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);

#9

Updated by Vincent MEMBRÉ about 5 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.

Also available in: Atom PDF