summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/create_indexes.cpp
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2014-05-23 13:17:22 -0400
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2014-05-28 16:13:48 -0400
commit0672061deb58aac931912bed68d014247c581968 (patch)
tree5ef08865cb578ee3f46995809b9ac6c7eb3e13df /src/mongo/db/commands/create_indexes.cpp
parentee3fb776c7f36d59b593db7e4165b0611a7a503f (diff)
downloadmongo-0672061deb58aac931912bed68d014247c581968.tar.gz
SERVER-13961 Pass LockState to DBWrite and DBRead directly
This is part of the changes to move LockState be part of OperationContext and not retrieved from TLS.
Diffstat (limited to 'src/mongo/db/commands/create_indexes.cpp')
-rw-r--r--src/mongo/db/commands/create_indexes.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/mongo/db/commands/create_indexes.cpp b/src/mongo/db/commands/create_indexes.cpp
index 2519bc75cc4..87582b75e07 100644
--- a/src/mongo/db/commands/create_indexes.cpp
+++ b/src/mongo/db/commands/create_indexes.cpp
@@ -51,13 +51,14 @@ namespace mongo {
virtual bool isWriteCommandForConfigServer() const { return false; }
virtual bool slaveOk() const { return false; } // TODO: this could be made true...
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(OperationContext* txn,
+ ClientBasic* client,
const std::string& dbname,
const BSONObj& cmdObj) {
ActionSet actions;
actions.addAction(ActionType::createIndex);
Privilege p(parseResourcePattern(dbname, cmdObj), actions);
- if ( client->getAuthorizationSession()->isAuthorizedForPrivilege(p) )
+ if (client->getAuthorizationSession()->isAuthorizedForPrivilege(txn, p))
return Status::OK();
return Status(ErrorCodes::Unauthorized, "Unauthorized");
}
@@ -132,9 +133,7 @@ namespace mongo {
// as many calls are ensureIndex (and hence no-ops), this is good so its a shared
// lock for common calls. We only take write lock if needed.
// Note: createIndexes command does not currently respect shard versioning.
- Client::ReadContext readContext( ns,
- storageGlobalParams.dbpath,
- false /* doVersion */ );
+ Client::ReadContext readContext(txn, ns, false /* doVersion */);
const Collection* collection = readContext.ctx().db()->getCollection( ns.ns() );
if ( collection ) {
for ( size_t i = 0; i < specs.size(); i++ ) {
@@ -164,9 +163,7 @@ namespace mongo {
// now we know we have to create index(es)
// Note: createIndexes command does not currently respect shard versioning.
- Client::WriteContext writeContext( ns.ns(),
- storageGlobalParams.dbpath,
- false /* doVersion */ );
+ Client::WriteContext writeContext(txn, ns.ns(), false /* doVersion */ );
Database* db = writeContext.ctx().db();
Collection* collection = db->getCollection( txn, ns.ns() );