diff options
author | Gregory Noma <gregory.noma@gmail.com> | 2020-04-30 17:05:01 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-04-30 21:36:40 +0000 |
commit | 39a6dfded77db512ddb729e202b13562bba4c58f (patch) | |
tree | 65a3c43eb367374075d2bff9c0394940983b0425 /src/mongo/db/logical_time_validator.cpp | |
parent | e48de0023a5df4f752bd46facef8da51b0bc31f7 (diff) | |
download | mongo-39a6dfded77db512ddb729e202b13562bba4c58f.tar.gz |
SERVER-47553 Prevent appendRequiredFieldsToResponse() from throwing inside noexcept block
Diffstat (limited to 'src/mongo/db/logical_time_validator.cpp')
-rw-r--r-- | src/mongo/db/logical_time_validator.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/mongo/db/logical_time_validator.cpp b/src/mongo/db/logical_time_validator.cpp index 6b3bfdaa2e6..793772dffb8 100644 --- a/src/mongo/db/logical_time_validator.cpp +++ b/src/mongo/db/logical_time_validator.cpp @@ -44,10 +44,14 @@ #include "mongo/db/service_context.h" #include "mongo/logv2/log.h" #include "mongo/util/assert_util.h" +#include "mongo/util/fail_point.h" namespace mongo { namespace { + +MONGO_FAIL_POINT_DEFINE(throwClientDisconnectInSignLogicalTimeForExternalClients); + const auto getLogicalClockValidator = ServiceContext::declareDecoration<std::unique_ptr<LogicalTimeValidator>>(); @@ -137,6 +141,16 @@ SignedLogicalTime LogicalTimeValidator::signLogicalTime(OperationContext* opCtx, } } + if (MONGO_unlikely( + throwClientDisconnectInSignLogicalTimeForExternalClients.shouldFail() && + opCtx->getClient()->session() && + !(opCtx->getClient()->session()->getTags() & transport::Session::kInternalClient))) { + // KeysCollectionManager::refreshNow() can throw an exception if the client has + // already disconnected. We simulate such behavior using this failpoint. + keyStatus = {ErrorCodes::ClientDisconnect, + "throwClientDisconnectInSignLogicalTimeForExternalClients failpoint enabled"}; + } + uassertStatusOK(keyStatus); return _getProof(keyStatusWith.getValue(), newTime); } |