Does mgo txn support concurrent transactions from multiple processes?

已查看 147 次
跳至第一个未读帖子

kondal boreddy

未读,
2017年8月31日 17:19:202017/8/31
收件人 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?

回复全部
回复作者
转发
0 个新帖子