The idea is to provide a pattern which to get a document if it already exists or create and get the document of it does not (according to a PathRef for instance), in an atomic cluster-safe manner.
This will be useful for use case such as:
- UserWorkspaceRoot creation. Currently with concurrent requests at first access, we can possibly end up with more than one UserWorkspaceRoot. i.e. 2 documents with the same path /default-domain/UserWorkspaceRoot which relentlessly leads to duplicated user workspace for each user
- Direct results are: 2 different Favorites document, unability to fetch/retrieve existing user collections, etc.
The pattern will internally need to use transaction management, and cluster-wide locking (through the key/value service compareAndSet, which is atomic).
The following algorithm will be used:
- a lock key is chosen to be unique based on what needs to be created, for instance repository name + parent id + child name — this can be abstracted into a lambda for genericity
- set the lock; if locking fails then retry a few times with exponential backoff and on failure return ConcurrentUpdateException
- commit transaction + start new transaction
- critical section: check if the doc exists; if not, create it — this can be abstracted into a lambda for genericity
- commit transaction + start new transaction
- remove the lock
- depends on
-
NXP-22138 Temporarily disable collections.feature test
- Resolved
-
NXP-19085 Nuxeo Locking Service
- Open
-
NXP-21870 Key/Value Service
- Resolved
-
NXP-14553 Nuxeo Shared State Manager
- Open
-
NXP-23065 Move Key/Value Service to its own bundle
- Resolved
- is related to
-
NXP-23203 Fix UT failure with atomic creation + MYSQL
- Resolved
-
NXP-23189 Fix random UT failure in TestAtomicOperationsOnDocument
- Resolved
-
NXDRIVE-926 Automatically retry on 409 (Conflict)
- Resolved
- is required by
-
NXP-21973 Prevent duplicated User Workspaces when fetching Collections or Favorites for the very first time
- Resolved
-
NXP-15808 Fix user profile crash when the repository contains only customs domains
- Resolved
-
NXP-18907 Fix duplicated Favorites collection
- Resolved