mongodb - Mongo DB concurrent findAndModify with increment operation -
if 2 agents run update query concurrently on mongo cluster, expected value of updateversion
@ end?
db.task.findandmodify( { query:{"updateversion":21}, update:{$inc:{"updateversion":1}} } );
if answer "23", there way have guaranteed read/write synchronized operation?
mongodb have faq section concurrent operations.
in case, write conflict might happen mongodb still try execute both commands:
a situation in 2 concurrent operations, @ least 1 of write, attempt use resource in way violate constraints imposed storage engine using optimistic concurrency control. mongodb transparently abort , retry 1 of conflicting operations.
Comments
Post a Comment