cancel
Showing results for 
Search instead for 
Did you mean: 

BatchUpdateException while creating a document

Ankush_Bandil
Confirmed Champ
Confirmed Champ

I doing performance testing of Nuxeo instance but I am sometime getting BatchUpdateException. I am uploading same file repeatedly with different metadata. I am using Postgres as backend DB.

Failed to save session, java.sql.BatchUpdateException: Batch entry 0 INSERT INTO \"hierarchy\" (\"id\", \"parentid\", \"pos\", \"name\", \"isproperty\", \"primarytype\", \"mixintypes\", \"ischeckedin\", \"baseversionid\", \"majorversion\", \"minorversion\", \"isversion\", \"isretentionactive\", \"istrashed\", \"systemchangetoken\", \"changetoken\") VALUES (75680, 909, NULL, 'AADHAAR_CARD.1593524158152', 'FALSE', 'Picture', NULL, NULL, NULL, 0, 0, NULL, NULL, NULL, 0, 0) was aborted: ERROR: duplicate key value violates unique constraint \"hierarchy_unique_child\"\n  Detail: Key (parentid, name)=(909, AADHAAR_CARD.1593524158152) already exists.  Call getNextException to see other errors in the batch.
1 ACCEPTED ANSWER

Florent_Guillau
World-Class Innovator
World-Class Innovator

You're trying to create several documents in the same folder with the same name (AADHAAR_CARD). The Nuxeo code attempts to detect pre-existing documents with the same name and provide a new one (AADHAAR_CARD.1593524158152) but this is not perfect, as it will fail if done with high concurrency. You should do your creations with different names for different documents in the same folder.

View answer in original post

1 REPLY 1

Florent_Guillau
World-Class Innovator
World-Class Innovator

You're trying to create several documents in the same folder with the same name (AADHAAR_CARD). The Nuxeo code attempts to detect pre-existing documents with the same name and provide a new one (AADHAAR_CARD.1593524158152) but this is not perfect, as it will fail if done with high concurrency. You should do your creations with different names for different documents in the same folder.