[SERVER-4328] db level locking Created: 19/Nov/11  Updated: 06/Nov/17  Resolved: 03/May/12

Status: Closed
Project: Core Server
Component/s: Concurrency
Affects Version/s: None
Fix Version/s: 2.1.1

Type: Improvement Priority: Major - P3
Reporter: Dwight Merriman Assignee: Dwight Merriman
Resolution: Done Votes: 24
Labels: rn, todo_in_code
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-1240 Collection-level locking Closed
Duplicate
is duplicated by SERVER-6838 Remove globalLock.ratio from serverSt... Closed
Related
related to SERVER-1241 Document-level locking Closed
Participants:

 Comments   
Comment by Eric Milkie [ 15/Jun/12 ]

I think that last commit needs more polish - we should update the help text in stat.cpp, and also the columns no longer line up from line to line in mongostat since the variable length dbname appears in the middle of the line.

Comment by auto [ 12/Jun/12 ]

Author:

{u'date': u'2012-06-12T14:37:27-07:00', u'email': u'eliot@10gen.com', u'name': u'Eliot Horowitz'}

Message: SERVER-4328 refactor stats a bit and make mongostat db locking friendly
for db locks, mongostat will show the db with the highest lock % and what db it is
Branch: master
https://github.com/mongodb/mongo/commit/cdabc02ec2144d1dcbfff49199121181af77a22c

Comment by auto [ 12/Jun/12 ]

Author:

{u'login': u'erh', u'name': u'Eliot Horowitz', u'email': u'eliot@10gen.com'}

Message: SERVER-4328 - db and global lock and acquisition time for read and write
Branch: master
https://github.com/mongodb/mongo/commit/f58ba6e38cb3e3f62d6cbacdfd646364b005a17e

Comment by auto [ 13/Apr/12 ]

Author:

{u'login': u'dwight', u'name': u'Dwight', u'email': u'dwight@10gen.com'}

Message: SERVER-4328 continued work on lock reporting stats. take out mess i made mpreviously
Branch: master
https://github.com/mongodb/mongo/commit/de4a9b97e601e12101a6077584099a8071f1b102

Comment by auto [ 10/Apr/12 ]

Author:

{u'login': u'dwight', u'name': u'Dwight', u'email': u'dwight@10gen.com'}

Message: SERVER-4328 more reporting in serverStatus of the lock times for each individual db lock
Branch: master
https://github.com/mongodb/mongo/commit/d9ed3cad70fca82a56c08e6e5d2c52cfb2e58ad8

Comment by auto [ 10/Apr/12 ]

Author:

{u'login': u'erh', u'name': u'Eliot Horowitz', u'email': u'eliot@10gen.com'}

Message: SERVER-4328 enable db level locking by default
Branch: master
https://github.com/mongodb/mongo/commit/3609145e1bc425f8578754d9e5a8a6e96f2be884

Comment by auto [ 09/Apr/12 ]

Author:

{u'login': u'dwight', u'name': u'Dwight', u'email': u'dwight@10gen.com'}

Message: SERVER-4328 Some machinery for stats for locks.
here we have added qlock stats to serverStatus.
stats of the same sort for the db locks could easily be added as a next step; they will only
have two types instead of 4 of course.
thinking is that we will iterate on this a bit so want to just let folks take a look.
so db.serverStatus() or db.serverStatus().locks can be ran and inspected
Branch: master
https://github.com/mongodb/mongo/commit/c6431502ce9793a116a60b708a32f35cc92084d9

Comment by auto [ 09/Apr/12 ]

Author:

{u'login': u'dwight', u'name': u'Dwight', u'email': u'dwight@10gen.com'}

Message: SERVER-4328 switch the currentOp locks field notation to a format that starts with a period. after the period is the db name.
Branch: master
https://github.com/mongodb/mongo/commit/cd7c9cc352514104e672dcf1081f66f7c6e16171

Comment by Andy Schwerin [ 06/Apr/12 ]

Yeah, it happens.

Comment by Eric Milkie [ 06/Apr/12 ]

Guess what, I think I may have it backwards.. the above commit fixed the unit test failures with context. My internal clock is off.

Comment by Eric Milkie [ 05/Apr/12 ]

same failure in slowNightly with db locking turned on:
http://buildbot.mongodb.org/builders/Nightly%20Linux%2064-bit%20concurrency/builds/1/steps/test_1/logs/stdio

Comment by Eric Milkie [ 05/Apr/12 ]

I think that last submit broke several unit tests, all with an Assertion stating that the replset heartbeat thread tried to fetch a client context but it got back a null pointer instead.
e.g.
http://buildbot.mongodb.org/builders/Linux%2064-bit%20debug%20dur%20off/builds/1064/steps/test_3/logs/stdio
http://buildbot.mongodb.org/builders/Windows%2064-bit/builds/4624/steps/test_3/logs/stdio

Comment by auto [ 05/Apr/12 ]

Author:

{u'login': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@10gen.com'}

Message: SERVER-4328: Background tasks in mongod that take database locks need a client context.
Branch: master
https://github.com/mongodb/mongo/commit/ea220e2daee85cdf917f83d586c0b142826610de

Comment by auto [ 05/Apr/12 ]

Author:

{u'login': u'dwight', u'name': u'Dwight', u'email': u'dwight@10gen.com'}

Message: SERVER-4328 stub out some currentOp reporting of lockstate. to be iterated
Branch: master
https://github.com/mongodb/mongo/commit/de834d925921c3be654a12e339400d790ab653f7

Comment by auto [ 05/Apr/12 ]

Author:

{u'login': u'milkie', u'name': u'Eric Milkie', u'email': u'milkie@10gen.com'}

Message: SERVER-4328 SERVER-5509 fix deadlock in runExclusively

A deadlock was seen in slowNightly/background.js.
The dur thread was blocked waiting on X's condvar.
Meanwhile, another thread had finished its work and
released its w lock (rather than calling runExclusively);
however, the code does not signal X's condvar for that case,
and thus the dur thread never woke up to notice that X.n
and w.n counts were the same.
Branch: master
https://github.com/mongodb/mongo/commit/b987d96067b24e4d1eb6dede4c204f2dc0db8f57

Comment by auto [ 04/Apr/12 ]

Author:

{u'login': u'milkie', u'name': u'Eric Milkie', u'email': u'milkie@10gen.com'}

Message: SERVER-4328 db level locking is now off by default

After enabling this, many builds broke, mostly due to count8.js.
However, the special concurrency build itself is green and
remains green. We're going to take a step back and ensure greener
builders before turning this on again, and it may need to be
during a mini-submit freeze.
Branch: master
https://github.com/mongodb/mongo/commit/2db6342ad7e7b486664bc7b09d1774674ec7941b

Comment by auto [ 03/Apr/12 ]

Author:

{u'login': u'milkie', u'name': u'Eric Milkie', u'email': u'milkie@10gen.com'}

Message: SERVER-4328 db level locking is now on by default
Branch: master
https://github.com/mongodb/mongo/commit/95725b980bb33395216b55f61fbcdc2a893d8f5c

Comment by auto [ 26/Mar/12 ]

Author:

{u'login': u'dwight', u'name': u'Dwight', u'email': u'dwight@10gen.com'}

Message: some security refactoring
localhost connections sometimes have special priviliges in particular if there are no admin.system.user documents
this now makes that check be at connection opening instead of later
that way hopefully it is easier to do the locking
this is bad in the sense that the test result then "sticks" for the connection – but we are sticking auth
anyway so that can be revisited when fixed in total.
the old code i think was doing a query every single time on that code path? this won't.
please review.
let me know what this breaks, switching locations so going to push now.
SERVER-4328
Branch: master
https://github.com/mongodb/mongo/commit/6c05a8e9158f629b612f7e3ba2372bce48c9c3e5

Comment by auto [ 26/Mar/12 ]

Author:

{u'login': u'dwight', u'name': u'Dwight', u'email': u'dwight@10gen.com'}

Message: SERVER-4328 clarify the error message if a nested lcok
Branch: master
https://github.com/mongodb/mongo/commit/80e6aee73d2c8b192d2088feb5045a7f69bdcf7f

Comment by auto [ 21/Mar/12 ]

Author:

{u'login': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@10gen.com'}

Message: SERVER-4328: Fix locking around OpTime::last.
Branch: master
https://github.com/mongodb/mongo/commit/047bf554f6ea02330d2c6cd04a6abe6707804b67

Comment by auto [ 21/Mar/12 ]

Author:

{u'login': u'dwight', u'name': u'Dwight', u'email': u'dwight@10gen.com'}

Message: SERVER-4328 support nested locking of admin database. we need this for auth. more work to be done though as the acquisition of the lock isnt in the code yet in the higher layers afaik
Branch: master
https://github.com/mongodb/mongo/commit/0e140e78621fddc6da7a3e223cb6d6b887ef697c

Comment by auto [ 21/Mar/12 ]

Author:

{u'login': u'dwight', u'name': u'Dwight', u'email': u'dwight@10gen.com'}

Message: SERVER-4328 we will not allow runexclusively on nested db locks as that would deadlock so we need a check at this level to make sure that is not the case. if it is so we simply demur from the commitNow which might be fine or might be really bad.
Branch: master
https://github.com/mongodb/mongo/commit/f3bbe516bd6a22e8bff86a17cae20df0d2eef151

Comment by auto [ 21/Mar/12 ]

Author:

{u'login': u'milkie', u'email': u'milkie@10gen.com', u'name': u'Eric Milkie'}

Message: SERVER-4328 raising timeouts to get tests to pass
Branch: master
https://github.com/mongodb/mongo/commit/5d3433eb31a58a4fcd242f8a0437819f63df723e

Comment by auto [ 20/Mar/12 ]

Author:

{u'login': u'andy10gen', u'name': u'Andy Schwerin', u'email': u'schwerin@10gen.com'}

Message: SERVER-4328: Fix global-instance-vs-member-field confusion in QLock::runExclusively.
Branch: master
https://github.com/mongodb/mongo/commit/2ba612172edcbbf4d5b04a8b21d0b53b2ece8e53

Comment by auto [ 20/Mar/12 ]

Author:

{u'login': u'dwight', u'name': u'Dwight', u'email': u'dwight@10gen.com'}

Message: SERVER-4328 if a lock is potentially nestable, like the local db lock, do it after the "top lock"
otherwise, we could deadlock. this however means we can't commitIfNeeded on that database. the
claim is that that will be ok.
Branch: master
https://github.com/mongodb/mongo/commit/e240ec0cf9fd952e35a970322fbe38fad7f6c101

Comment by auto [ 19/Mar/12 ]

Author:

{u'login': u'dwight', u'name': u'Dwight', u'email': u'dwight@10gen.com'}

Message: SERVER-4328 refactor Lock::TempRelease to make it more readable and hopefully more clear
Branch: master
https://github.com/mongodb/mongo/commit/2ec272b22b8d0bb4067deebf3a6cd946696b00a5

Comment by auto [ 19/Mar/12 ]

Author:

{u'login': u'dwight', u'name': u'Dwight', u'email': u'dwight@10gen.com'}

Message: SERVER-4328 stubbing a concept for how to do temprelease. not sure if this is the way to go but it would be a bit cleaner tbd.
Branch: master
https://github.com/mongodb/mongo/commit/6390b00ea951c7151fa59a367c659c89516d3ad5

Comment by auto [ 18/Mar/12 ]

Author:

{u'login': u'dwight', u'name': u'Dwight', u'email': u'dwight@10gen.com'}

Message: SERVER-4328 cleaning of d_concurrency for readability. removed the 't' state for temprelease. that was making the code complicated it wasn't work it.
we can track that in LockState if we like, which would be good for assertion puproses, but this is better than the way it was.
Branch: master
https://github.com/mongodb/mongo/commit/3caf10e15c9ffb9582cd1eaa386fae5c33ba12fa

Comment by auto [ 16/Mar/12 ]

Author:

{u'login': u'dwight', u'name': u'Dwight', u'email': u'dwight@10gen.com'}

Message: SERVER-4328 lock the dblock first before the toplock
Branch: master
https://github.com/mongodb/mongo/commit/1881e047713e5c365c1429f963bcd63202fdb82c

Comment by auto [ 16/Mar/12 ]

Author:

{u'login': u'dwight', u'email': u'dwight@10gen.com', u'name': u'Dwight'}

Message: SERVER-4328 use a db level lock not a global for compact command
Branch: master
https://github.com/mongodb/mongo/commit/fda3f259ef8c59918c14a106b9adfc94f8565f17

Comment by auto [ 15/Mar/12 ]

Author:

{u'login': u'dwight', u'name': u'Dwight', u'email': u'dwight@10gen.com'}

Message: SERVER-4328 wrong lock for commitNow was messing up sharding with the new dblocking
Branch: master
https://github.com/mongodb/mongo/commit/29931c1a15f4ae32ca3cdcf26ade606a46f38d7b

Comment by auto [ 15/Mar/12 ]

Author:

{u'login': u'dwight', u'name': u'Dwight', u'email': u'dwight@10gen.com'}

Message: SERVER-4328 mongomutextest wasnt quite right. also now verifying that upgrade actually works and doesnt time out
Branch: master
https://github.com/mongodb/mongo/commit/2feeb81d0b1795b97ca670b88d8f980ac8278634

Comment by auto [ 15/Mar/12 ]

Author:

{u'login': u'dwight', u'name': u'Dwight', u'email': u'dwight@10gen.com'}

Message: SERVER-4328 QLock R_to_W was not right. fix attempted. probably fixes a buildbot issue.
Branch: master
https://github.com/mongodb/mongo/commit/57c0176eff861ed468c86a694ea25cdc4f1d6a42

Comment by auto [ 14/Mar/12 ]

Author:

{u'login': u'dwight', u'name': u'Dwight', u'email': u'dwight@10gen.com'}

Message: SERVER-4328 directoryperdb.js test was failing
Branch: master
https://github.com/mongodb/mongo/commit/fd96f42d716f34cf30c24258dd379c2af552dc4f

Comment by auto [ 14/Mar/12 ]

Author:

{u'login': u'dwight', u'name': u'Dwight', u'email': u'dwight@10gen.com'}

Message: SERVER-4328 fix slownightly/background.js
Branch: master
https://github.com/mongodb/mongo/commit/bdfc1eb360c8a9285cb0fc54a4a6f6b7efc45f0a

Generated at Thu Feb 08 03:05:40 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.