summaryrefslogtreecommitdiff
path: root/src/mongo/s/d_split.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/s/d_split.cpp')
-rw-r--r--src/mongo/s/d_split.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/mongo/s/d_split.cpp b/src/mongo/s/d_split.cpp
index 04e17d553e3..8d54a271e4c 100644
--- a/src/mongo/s/d_split.cpp
+++ b/src/mongo/s/d_split.cpp
@@ -119,7 +119,7 @@ namespace mongo {
return false;
}
- Client::ReadContext ctx( ns );
+ Client::ReadContext ctx(txn, ns);
Collection* collection = ctx.ctx().db()->getCollection( ns );
if ( !collection ) {
errmsg = "ns not found";
@@ -223,10 +223,12 @@ namespace mongo {
" 'force' will produce one split point even if data is small; defaults to false\n"
"NOTE: This command may take a while to run";
}
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(OperationContext* txn,
+ ClientBasic* client,
const std::string& dbname,
const BSONObj& cmdObj) {
if (!client->getAuthorizationSession()->isAuthorizedForActionsOnResource(
+ txn,
ResourcePattern::forExactNamespace(NamespaceString(parseNs(dbname, cmdObj))),
ActionType::splitVector)) {
return Status(ErrorCodes::Unauthorized, "Unauthorized");
@@ -275,7 +277,7 @@ namespace mongo {
{
// Get the size estimate for this namespace
- Client::ReadContext ctx( ns );
+ Client::ReadContext ctx(txn, ns);
Collection* collection = ctx.ctx().db()->getCollection( ns );
if ( !collection ) {
errmsg = "ns not found";
@@ -515,10 +517,12 @@ namespace mongo {
virtual bool slaveOk() const { return false; }
virtual bool adminOnly() const { return true; }
virtual bool isWriteCommandForConfigServer() const { return false; }
- virtual Status checkAuthForCommand(ClientBasic* client,
+ virtual Status checkAuthForCommand(OperationContext* txn,
+ ClientBasic* client,
const std::string& dbname,
const BSONObj& cmdObj) {
if (!client->getAuthorizationSession()->isAuthorizedForActionsOnResource(
+ txn,
ResourcePattern::forExactNamespace(NamespaceString(parseNs(dbname, cmdObj))),
ActionType::splitChunk)) {
return Status(ErrorCodes::Unauthorized, "Unauthorized");
@@ -824,7 +828,7 @@ namespace mongo {
maxVersion.incMinor();
{
- Lock::DBWrite writeLk( ns );
+ Lock::DBWrite writeLk(txn->lockState(), ns);
shardingState.splitChunk( ns , min , max , splitKeys , maxVersion );
}
@@ -858,7 +862,7 @@ namespace mongo {
// If one of the chunks has only one object in it we should move it
for (int i=1; i >= 0 ; i--){ // high chunk more likely to have only one obj
- Client::ReadContext ctx( ns );
+ Client::ReadContext ctx(txn, ns);
Collection* collection = ctx.ctx().db()->getCollection( ns );
verify( collection );