summaryrefslogtreecommitdiff
path: root/src/mongo/db/instance.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/instance.cpp')
-rw-r--r--src/mongo/db/instance.cpp20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/mongo/db/instance.cpp b/src/mongo/db/instance.cpp
index 80bf95116ce..099492d607a 100644
--- a/src/mongo/db/instance.cpp
+++ b/src/mongo/db/instance.cpp
@@ -389,6 +389,7 @@ namespace {
Client& c = *txn->getClient();
if (!c.isInDirectClient()) {
+ LastError::get(c).startRequest();
AuthorizationSession::get(c)->startRequest(txn);
// We should not be holding any locks at this point
@@ -556,14 +557,14 @@ namespace {
}
}
catch (const UserException& ue) {
- setLastError(ue.getCode(), ue.getInfo().msg.c_str());
+ LastError::get(c).setLastError(ue.getCode(), ue.getInfo().msg);
MONGO_LOG_COMPONENT(3, responseComponent)
<< " Caught Assertion in " << opToString(op) << ", continuing "
<< ue.toString() << endl;
debug.exceptionInfo = ue.getInfo();
}
catch (const AssertionException& e) {
- setLastError(e.getCode(), e.getInfo().msg.c_str());
+ LastError::get(c).setLastError(e.getCode(), e.getInfo().msg);
MONGO_LOG_COMPONENT(3, responseComponent)
<< " Caught Assertion in " << opToString(op) << ", continuing "
<< e.toString() << endl;
@@ -604,6 +605,7 @@ namespace {
}
void receivedKillCursors(OperationContext* txn, Message& m) {
+ LastError::get(txn->getClient()).disable();
DbMessage dbmessage(m);
int n = dbmessage.pullInt();
@@ -700,7 +702,8 @@ namespace {
UpdateResult res = UpdateStage::makeUpdateResult(exec.get(), &op.debug());
// for getlasterror
- lastError.getSafe()->recordUpdate( res.existing , res.numMatched , res.upserted );
+ LastError::get(txn->getClient()).recordUpdate(
+ res.existing, res.numMatched, res.upserted);
return;
}
break;
@@ -753,7 +756,8 @@ namespace {
uassertStatusOK(exec->executePlan());
UpdateResult res = UpdateStage::makeUpdateResult(exec.get(), &op.debug());
- lastError.getSafe()->recordUpdate( res.existing , res.numMatched , res.upserted );
+ LastError::get(txn->getClient()).recordUpdate(
+ res.existing, res.numMatched, res.upserted);
} MONGO_WRITE_CONFLICT_RETRY_LOOP_END(txn, "update", nsString.ns());
}
@@ -811,7 +815,7 @@ namespace {
// Run the plan and get the number of docs deleted.
uassertStatusOK(exec->executePlan());
long long n = DeleteStage::getNumDeleted(exec.get());
- lastError.getSafe()->recordDelete(n);
+ LastError::get(txn->getClient()).recordDelete(n);
op.debug().ndeleted = n;
break;
@@ -1001,7 +1005,7 @@ namespace {
globalOpCounters.incInsertInWriteLock(i);
throw;
}
- setLastError(ex.getCode(), ex.getInfo().msg.c_str());
+ LastError::get(txn->getClient()).setLastError(ex.getCode(), ex.getInfo().msg);
// otherwise ignore and keep going
}
}
@@ -1055,7 +1059,7 @@ namespace {
convertSystemIndexInsertsToCommands(d, &allCmdsBuilder);
}
catch (const DBException& ex) {
- setLastError(ex.getCode(), ex.getInfo().msg.c_str());
+ LastError::get(txn->getClient()).setLastError(ex.getCode(), ex.getInfo().msg);
curOp.debug().exceptionInfo = ex.getInfo();
return;
}
@@ -1077,7 +1081,7 @@ namespace {
uassertStatusOK(Command::getStatusFromCommandResult(resultBuilder.done()));
}
catch (const DBException& ex) {
- setLastError(ex.getCode(), ex.getInfo().msg.c_str());
+ LastError::get(txn->getClient()).setLastError(ex.getCode(), ex.getInfo().msg);
curOp.debug().exceptionInfo = ex.getInfo();
if (!keepGoing) {
return;