From 583127818f1ead21b67a57eb117b9678232e5472 Mon Sep 17 00:00:00 2001 From: Mathias Stearn Date: Mon, 24 Jul 2017 15:59:24 -0400 Subject: SERVER-28510 Close incoming mongod connection on NotMaster error when handling fire-and-forget command --- src/mongo/db/lasterror.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/mongo/db/lasterror.cpp') 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; } -- cgit v1.2.1