cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible that nuxeo generates duplicate uid with his UIDSequencer?

ftorchet_
Champ in-the-making
Champ in-the-making

We use the extension poins "generators" to generate references stored in uid:uid ... Now we have documents that have the same references. After analyzing the creation timestamp, I would say that these are documents created simultaneously ... When I look at the code, I would say it is possible: the last index is read in base, incremented by the code and persisted. If two accesses occur at the same time, it must result in duplicate uid right?

(Obviously, this behavior is a bit problematic for us...)

We use nuxeo 5.8.0-HF30...

1 ACCEPTED ANSWER

Florent_Guillau
World-Class Innovator
World-Class Innovator

Yes, UIDSequencer has a flawed implementation that's not thread-safe, which is a problem in many situations. We don't recommend using it anymore.

To generate truly unique sequential ids, we recommend using a SQL directory with <autoincrementIdField>true</autoincrementIdField> specified, and inserting new entries when needed. Although this makes the directory grow, which may or may not be a problem.

Otherwise use an external mechanism to get incremental ids, like a Hibernate sequence, or a Redis INCR-based counter.

View answer in original post

3 REPLIES 3

Florent_Guillau
World-Class Innovator
World-Class Innovator

Yes, UIDSequencer has a flawed implementation that's not thread-safe, which is a problem in many situations. We don't recommend using it anymore.

To generate truly unique sequential ids, we recommend using a SQL directory with <autoincrementIdField>true</autoincrementIdField> specified, and inserting new entries when needed. Although this makes the directory grow, which may or may not be a problem.

Otherwise use an external mechanism to get incremental ids, like a Hibernate sequence, or a Redis INCR-based counter.

Using SQL directory is not possible in my case, I choose to specialize postgreSQL dialect (add a function to get next value of a sequence with insertion BEFORE return) for nxuidsequencer... It's not easy to test (mandatory postgreSQL) but it works without external tool...

Alice_J
Champ in-the-making
Champ in-the-making

Hello,

Getting started

Find what you came for

We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.