BatchUpdateException while creating a document

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.
0 votes

1 answers

1235 views

ANSWER



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.

1 votes