Does mgo txn support concurrent transactions from multiple processes?

147 views
Skip to first unread message

kondal boreddy

unread,
Aug 31, 2017, 5:19:20 PM8/31/17
to mgo-users
Is it ok to update same set of documents using mgo txn from multiple processes, or will it only work in case of multiple threads in a single process?
Also if I have asserts, how they are applied? 
Consider the following case

First transaction: 
Read document version v1 from db
Add assert to maker sure document is still at version v1
Update document to version v2

Second transaction:
Read document version v1 from db
Add assert to maker sure document is still at version v1
Update document to version v3

If these two transactions are attempted from same process, I assume mgo txn possibly uses a mutex to make sure that assert & updates are done atomically. But if the two transactions are done from two different processes, how can mgo txn ensure that assert & updates are done atomically?

Reply all
Reply to author
Forward
0 new messages