diff options
author | Amirsaman Memaripour <amirsaman.memaripour@mongodb.com> | 2020-06-17 00:26:46 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-06-17 22:21:40 +0000 |
commit | 3a759f941208612252c4a42fdddf1a2beaaf2063 (patch) | |
tree | 4f2203dbcb4c91c2304252e48cc80f721cb272af | |
parent | cbe0625a55256a3a0023223ae3e1fc6494e721af (diff) | |
download | mongo-3a759f941208612252c4a42fdddf1a2beaaf2063.tar.gz |
SERVER-48511 Improve ConnectionPool error messages
-rw-r--r-- | src/mongo/base/error_codes.yml | 3 | ||||
-rw-r--r-- | src/mongo/executor/connection_pool.cpp | 7 | ||||
-rw-r--r-- | src/mongo/executor/connection_pool_test.cpp | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/src/mongo/base/error_codes.yml b/src/mongo/base/error_codes.yml index cc97ab45b5d..64003942e20 100644 --- a/src/mongo/base/error_codes.yml +++ b/src/mongo/base/error_codes.yml @@ -373,6 +373,9 @@ error_codes: # The code below is for internal use only and must never be returned in a network response. - {code: 316,name: QueryTrialRunCompleted} + # The code below is for internal use only and must never be returned in a network response. + - {code: 317,name: ConnectionPoolExpired,categories: [NetworkError,RetriableError]} + # Error codes 4000-8999 are reserved. # Non-sequential error codes for compatibility only) diff --git a/src/mongo/executor/connection_pool.cpp b/src/mongo/executor/connection_pool.cpp index 19f6bbac6a4..1b390e51078 100644 --- a/src/mongo/executor/connection_pool.cpp +++ b/src/mongo/executor/connection_pool.cpp @@ -1133,9 +1133,8 @@ void ConnectionPool::SpecificPool::updateEventTimer() { std::pop_heap(begin(_requests), end(_requests), RequestComparator{}); auto& request = _requests.back(); - request.second.setError(Status( - ErrorCodes::NetworkInterfaceExceededTimeLimit, - fmt::format("Couldn't get a connection within the time limit of {}", timeout))); + request.second.setError(Status(ErrorCodes::NetworkInterfaceExceededTimeLimit, + "Couldn't get a connection within the time limit")); _requests.pop_back(); // Since we've failed a request, we've interacted with external users @@ -1199,7 +1198,7 @@ void ConnectionPool::SpecificPool::updateController() { invariant(pool->_requests.empty()); } - pool->triggerShutdown(Status(ErrorCodes::ShutdownInProgress, + pool->triggerShutdown(Status(ErrorCodes::ConnectionPoolExpired, str::stream() << "Pool for " << host << " has expired.")); } return; diff --git a/src/mongo/executor/connection_pool_test.cpp b/src/mongo/executor/connection_pool_test.cpp index 6a85a5a6a76..6d70ecc54ba 100644 --- a/src/mongo/executor/connection_pool_test.cpp +++ b/src/mongo/executor/connection_pool_test.cpp @@ -437,8 +437,6 @@ TEST_F(ConnectionPoolTest, TimeoutOnSetup) { ASSERT(!conn->isOK()); ASSERT_EQ(conn->getStatus(), ErrorCodes::NetworkInterfaceExceededTimeLimit); - ASSERT_STRING_CONTAINS(conn->getStatus().reason(), - fmt::format("{}", ConnectionPool::kHostRetryTimeout)); } /** |