We use gocb and open a transaction to insert/replace around 100 documents.
We use goroutines and operate the documents concurrently since timing is important for us.
So, we create the transaction, then we create goroutines and concurrently insert/replace within the transaction.
However, we noticed that we get error in that kind of structure.
deadline expired before WWC was resolved on BucketName._default._default._txn:atr-790-#822
I’m not the go transactions expert, but I think you should be able to do that without issue - provided that you adhere to the transactions mechanics. Specifically - whenever a document is replaced, the original get result that was fed into the replace will no longer be valid and another get will need to be issued if there is another replace on the same document in the same transactions.
Thank you for your response.
I understand the concerns regarding the docId and the data consistency during get/replace scenarios.
However in my case, I don’t have such situations where I can have conflicts regarding the same docId usage.
In my case, I just have a single transaction where I have lots of concurrent threads that tries to insert/replace within this transaction with different Ids when it comes to get/replace.