mongo locking

143 views
Skip to first unread message

Liam Staskawicz

unread,
Mar 30, 2009, 11:57:47 PM3/30/09
to mongod...@googlegroups.com
Hello. Can anybody provide an update on the locking situation in
Mongo? http://www.mongodb.org/display/DOCS/Locking+in+Mongo informs
us that it should be included as of Alpha II...?

Also, the current roadmap tantalizes us with the phrase "Enhancements
to durability, concurrency, and locking" in the 1.5 release. Are
there any (rough, even) details that can be shared about what's
planned here? Ideally the locking page above could be updated with
any plans (marked as rough/temporary/subject to change, etc.) Thanks!

Liam

Geir Magnusson Jr.

unread,
Mar 31, 2009, 8:05:25 AM3/31/09
to mongod...@googlegroups.com
what kind of locking are you looking for?

Liam Staskawicz

unread,
Mar 31, 2009, 11:59:06 AM3/31/09
to mongod...@googlegroups.com
Mostly wondering if there's any kind of write-locking available (lock
a document, pull it out, modify, save it, unlock), or if this is
something applications need to be designed around. If this is
possible, at what 'resolution'? Per document, per enclosed object,
etc? Also, I couldn't easily find any doc on whether write operations
are atomic?

Of course any general design/philosophical overview thoughts would be
welcome as well.

Liam

dwight_10gen

unread,
Mar 31, 2009, 1:40:27 PM3/31/09
to mongodb-user
Look for a blog post on locking direction for mongo in the next few
days -- this is something that has been on the todo list, and we are
doing some work right now.

Liam Staskawicz

unread,
Mar 31, 2009, 1:48:41 PM3/31/09
to mongod...@googlegroups.com
Excellent - looking forward to it. Thanks.

Liam

Message has been deleted

Liam Staskawicz

unread,
Apr 9, 2009, 4:23:18 PM4/9/09
to mongod...@googlegroups.com
Hi again - thought I'd follow up on this...short of a blog post, is
there any general background info available on locking in Mongo or
lack thereof? Would be very helpful for evaluation/planning/etc.
Thanks!

Liam

On Mar 31, 2009, at 10:40 AM, dwight_10gen wrote:

>

Eliot

unread,
Apr 9, 2009, 5:17:45 PM4/9/09
to mongod...@googlegroups.com
I updated this page:  http://www.mongodb.org/display/DOCS/Locking

Its very sparse, but has the very very basics of our concurrent thinking.

If you have any questions, we can try to make that document clearer.

In general, we've been able to find solutions for most problems where transactions would be used in the past.

Liam Staskawicz

unread,
Apr 9, 2009, 5:42:35 PM4/9/09
to mongod...@googlegroups.com
Great - thanks very much.

Just to be explicit, in the example on the Locking page in the wiki, if db.foo.save(a) succeeds and db.foo.save(b)  or something else in the eval fails/throws an exception afterwards, db.foo.save(a) is not applied or is rolled back?  Or have I misinterpreted 'atomically' here?

Liam

Eliot

unread,
Apr 9, 2009, 5:44:21 PM4/9/09
to mongod...@googlegroups.com
You've misinterpreted atomic.
Atomic just means that nothing else can happen in between the 2 save operations.

Michael Dirolf

unread,
Apr 9, 2009, 5:45:55 PM4/9/09
to mongod...@googlegroups.com
afaik it won't roll back - just means nothing else will happen in
between the ops.

Peter Svensson

unread,
Apr 9, 2009, 5:50:34 PM4/9/09
to mongod...@googlegroups.com
Also, another quick question (Sorry if this have been mentioned before in other threads);
Does this scenario assume that there is only one shard/replica, or do eval marshall (hmm, that would be a lock, I suppose) to other shards.

Cheers,
PS

Rick R

unread,
Apr 9, 2009, 5:59:42 PM4/9/09
to mongod...@googlegroups.com
Also, on that same subject. With competing records in a sharded installation, can we be assured that the transaction that "wins" does win on every instance? e.g. consistency.
--
We can't solve problems by using the same kind of thinking we used when we created them.
   - A. Einstein

Eliot

unread,
Apr 9, 2009, 9:49:40 PM4/9/09
to mongod...@googlegroups.com
db.eval and sharding are a bit more complicated, and we haven't worked out all the details of that yet.  We're still making some decisions, so any input would be helpful.  Most likely there will be multiple modes, but again, haven't worked out the details.


Also, on that same subject. With competing records in a sharded installation, can we be assured that the transaction that "wins" does win on every instance? e.g. consistency.



In our sharded model, each shard (partition) only has 1 master at any point.  So there is never a possible cross server race condition.  So everything is always consistent, and yes, last transaction wins.
Reply all
Reply to author
Forward
0 new messages