duplicate primary keys in internal logicaldoc db tables

We tried to make LogicalDOC as intuitive as possible, but an advice is always welcome.

Moderator: car031

Ragnhild
Posts: 1
Joined: Tue Oct 24, 2017 8:33 am

duplicate primary keys in internal logicaldoc db tables

Tue Oct 24, 2017 9:06 am

Using Logicaldoc CE 7.4. I know that there is no support for CE. Still, perhaps someone can comment on the issues I am having.

I have noticed that, occasionally, the internal logicaldoc tables start using already used primary keys when populating tables ( history tables, document tables etc. ). This causes internal exceptions, and DB transactions are stopped. This issue seems to occur randomly, but is rather rare.

An example log:
03.10.2017 11:29:17,090 DEBUG (org.hibernate.SQL: 104) -- insert into ld_document (ld_recordversion, ld_lastmodified, ld_deleted, ld_tenantid, ld_immutable, ld_customid, ld_comment, ld_title, ld_version, ld_fileversion, ld_date, ld_creation, ld_publisher, ld_publisherid, ld_creator, ld_creatorid, ld_status, ld_type, ld_lockuserid, ld_source, ld_sourceauthor, ld_sourcedate, ld_sourceid, ld_sourcetype, ld_object, ld_coverage, ld_language, ld_filename, ld_filesize, ld_indexed, ld_barcoded, ld_signed, ld_stamped, ld_digest, ld_recipient, ld_exportstatus, ld_exportid, ld_exportname, ld_exportversion, ld_docref, ld_docreftype, ld_deleteuserid, ld_rating, ld_workflowstatus, ld_published, ld_startpublishing, ld_stoppublishing, ld_transactionid, ld_extresid, ld_tgs, ld_pages, ld_nature, ld_formid, ld_folderid, ld_templateid, ld_id) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
03.10.2017 11:29:17,096 DEBUG (org.hibernate.engine.jdbc.spi.SqlExceptionHelper: 139) -- ERROR: duplicate key value violates unique constraint "ld_document_pkey"
Detail: Key (ld_id)=(3473408) already exists. [n/a]
org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "ld_document_pkey"
Detail: Key (ld_id)=(3473408) already exists.
.... stack trace folows ....

After that, hybernate errors would be logged:

03.10.2017 11:29:17,103 DEBUG (org.hibernate.engine.jdbc.spi.SqlExceptionHelper: 139) -- ERROR: current transaction is aborted, commands ignored until end of transaction block [n/a]
org.postgresql.util.PSQLException: ERROR: current transaction is aborted, commands ignored until end of transaction block

.... stack trace folows ....

In my case, this has happened separately to following tables:
  • ld_document
    ld_user_history
I managed to resolve this when it came up by restarting logicaldoc several times in a row. (alternatively, of course, in case of history tables, they could be truncated if the data in them is not needed)
Does anyone know the cause of this issue? I have not manually fiddled with the logicaldoc db and thus have no idea why the pkeys would overlap at any point. It seems to me that this is an internal problem not related to the usage of logicaldoc.

While searching the forums, I have found only a single thread in which a user has a similar issue, albeit it seems to had accured due to the way that user restored the DB.

Regards,
Ragnhild
shatzing
Posts: 80
Joined: Tue Jan 21, 2014 9:46 am

Re: duplicate primary keys in internal logicaldoc db tables

Tue Jan 09, 2018 4:00 pm

Hi Ragnhild,
you should check the records stored in table hibernate_unique_key

Since this is a table without primary key, you should check that there is only one record for each tablename

Anyhow, my suggestion is to use a more recent version of LogicalDOC

Return to “Usage”

Who is online

Users browsing this forum: No registered users and 34 guests