summaryrefslogtreecommitdiff
path: root/src/mongo/db/lasterror.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/lasterror.cpp')
-rw-r--r--src/mongo/db/lasterror.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/mongo/db/lasterror.cpp b/src/mongo/db/lasterror.cpp
index 370c38f9f6f..2521fa99466 100644
--- a/src/mongo/db/lasterror.cpp
+++ b/src/mongo/db/lasterror.cpp
@@ -52,6 +52,9 @@ void LastError::setLastError(int code, std::string msg) {
reset(true);
_code = code;
_msg = std::move(msg);
+
+ if (ErrorCodes::isNotMasterError(ErrorCodes::fromInt(_code)))
+ _hadNotMasterError = true;
}
void LastError::recordUpdate(bool updateObjects, long long nObjects, BSONObj upsertedId) {
@@ -107,7 +110,13 @@ void LastError::disable() {
_nPrev--; // caller is a command that shouldn't count as an operation
}
-void LastError::startRequest() {
+void LastError::startTopLevelRequest() {
+ _disabled = false;
+ ++_nPrev;
+ _hadNotMasterError = false;
+}
+
+void LastError::startDirectClientRequest() {
_disabled = false;
++_nPrev;
}