Does N1QL UPDATE query makes partial update incase of DML Error Concurrent update error

We are using Couchbase as a work queue and have multiple NodeJs clients update a bucket concurrently. The N1QL query run by clients tries to lock (sets a lock field) 200 documents at a time using UPDATE query with LIMIT. Frequently, DML Error due to concurrent update errors occurs. We know Couchbase reads 200 documents and then makes changes. We need to know if a client WHILE updating 200 documents say after making changes to 100 documents enoucnters DML error, then what happpens.

  1. Does Couchbase reverts the changes made to the updated 100 documents and returns error.
  2. Couchbase leaves the updated 100 documents with the changes and returns error.

Our observation shows Couchbase does the option 2). Can someone please confim.

N1QL doesn’t provide transactions. The update based on individual document based on CAS. So UPDATE involves multiple documents and error occurs in the middle it will NOT rollback. Yes it follows option 2.

6.50 JAVA SDK has transaction functionality directly through KV you can explore https://blog.couchbase.com/couchbase-brings-distributed-multi-document-acid-transactions-to-nosql/. cc @ingenthr

@vsr1 Thank you for confirming this. Thanks for the link.

As of now, have implemented a mechanism where only a single instance of NodeJs client can lock (UPDATE) at a time for a specific Job.