make locks for queries more fine-grained

This commit is contained in:
Eliot Horowitz
2010-02-03 11:52:15 -05:00
parent 6c18efe606
commit cff55fcc07
3 changed files with 13 additions and 15 deletions

View File

@@ -801,11 +801,11 @@ namespace mongo {
qr->startingFrom = 0;
qr->nReturned = n;
}
else {
/* regular query */
AuthenticationInfo *ai = currentClient.get()->ai;
uassert( 10106 , "unauthorized", ai->isReadOnlyAuthorized(c.database()->name.c_str()));
else { /* regular query */
mongolock lk(false); // read lock
Client::Context ctx( ns , dbpath , &lk );
AuthenticationInfo *ai = c.ai;
uassert( 10106 , "unauthorized", ai->isReadOnlyAuthorized(ctx.db()->name.c_str()));
/* we allow queries to SimpleSlave's -- but not to the slave (nonmaster) member of a replica pair
so that queries to a pair are realtime consistent as much as possible. use setSlaveOk() to
@@ -976,7 +976,7 @@ namespace mongo {
qr->startingFrom = 0;
qr->nReturned = n;
}
}
} // end else for regular query
int duration = t.millis();
bool dbprofile = curop.shouldDBProfile( duration );