Hi,
I have a requirement where every select should provide end user with a unique document. For this, I have used a sub-query select like below.
update default use keys ( select raw meta().id from default where type='New' and previousValueField = 'Data123' order by createdTimeStamp limit 1) set user='user1' and type='working' and previousValueField = 'DataABC123' returning meta().id as docId
This is working fine for concurrent users with minimum reties for CAS conflicts.
However, if a downstream system after the update using the above query fails; I do not have the provision to roll back the ‘previousValueField’ back to ‘Data123’ as I will not be able to capture individual field value for roll-back in a single n/w update call and keep it for rollback.
Requesting your help in understanding what can be done to achieve this.
If I divide the select query to provide the documentId and the before sate of the fields that helps to be capture (for rollback) before updating (2 network calls - one for select and other for update); the concurrency issue is experienced more (concurrent selects are giving the same doc().id but while the second network call is made to update, the document is already in updated state) and hence the number of retries increases causing a delay in getting unique cases (End user experience is not good)
CB Version - 6.5 EE
Regards,
bora.mohan