0

In a case we wish to perform multiple update operations, being atomic and in isolation in MongoDB, so that other process or threads don't get data while these are in process. I'm aware of the fact that atomicity and isolation are being supported at document level only, also locks are maintained at db level.I have following queries wrt above case:

  • Is there a way we can do such multiple updates in isolation,in batch, as "$isolated" doesn't work for cluster, moreover, findAndModify() works for single document?
  • How can we do Concurrency control to achieve above case?
  • Can we use two phase commit here, by maintaining a transaction, will it be executed in isolated way?
  • While exploring I found MongoMVCC for multi-version concurrency control, if anyone have used it please share your experiences with respect to above use case.

1 Answers1

1

Is there a way we can do such multiple updates in isolation,in batch, as $isloated doesn't work for shard, moreover, findAndModify() works for single document?

No, $isolated is the closest thing

How can we do Concurrency control to achieve above case?

You cannot, MongoDBs own concurrency works by splitting off the I of ACID.

Can we use two phase commit here, by maintaining a transaction here, will it be executed is isolated way?

A two phase commit, not being an isolated transaction on the server side will not work.

While exploring I found MongoMVCC for multi-version concurrency control, if anyone have used it please share your experiences with respect to above use case.

This is written in Java on top of MongoDB, it is not actually MongoDB itself and cannot replace the I in ACID. Also MVCC is more about lockless databases than isolated operations.

Sammaye
  • 43,242
  • 7
  • 104
  • 146