Is it possible that nuxeo generates duplicate uid with his UIDSequencer?
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…
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.
I planned to be interested in Redis in the near future… Thanks