diff options
author | Henrik Edin <henrik.edin@mongodb.com> | 2017-09-25 14:24:24 -0400 |
---|---|---|
committer | Henrik Edin <henrik.edin@mongodb.com> | 2017-10-04 09:08:02 -0400 |
commit | a73cff087d5142c378dd05e6fad3f8f6825c5401 (patch) | |
tree | 955ac8bede1fe71d105403d5023d10feecd36ecd /src/mongo/db/repl/replication_info.cpp | |
parent | 939f2bcda18db41b774bbe3cf16e1d4928c58e5d (diff) | |
download | mongo-a73cff087d5142c378dd05e6fad3f8f6825c5401.tar.gz |
SERVER-31265 Mark new sessions as pending so terminateIfTagsDontMatch don't terminate sessions that haven't had their tags set yet. Clear this flag when we get the first set of tags.
Diffstat (limited to 'src/mongo/db/repl/replication_info.cpp')
-rw-r--r-- | src/mongo/db/repl/replication_info.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/mongo/db/repl/replication_info.cpp b/src/mongo/db/repl/replication_info.cpp index 33197d666d2..e29d748aa37 100644 --- a/src/mongo/db/repl/replication_info.cpp +++ b/src/mongo/db/repl/replication_info.cpp @@ -288,10 +288,7 @@ public: if (internalClientElement) { auto session = opCtx->getClient()->session(); if (session) { - // Unset kExternalClientKeepOpen, which is the default for new connections. - session->replaceTags( - (session->getTags() & ~transport::Session::kExternalClientKeepOpen) | - transport::Session::kInternalClient); + session->replaceTags(session->getTags() | transport::Session::kInternalClient); } uassert(ErrorCodes::TypeMismatch, @@ -340,6 +337,12 @@ public: uassert(ErrorCodes::BadValue, "Missing required field 'maxWireVersion' of 'internalClient'", foundMaxWireVersion); + } else { + auto session = opCtx->getClient()->session(); + if (session && !(session->getTags() & transport::Session::kInternalClient)) { + session->replaceTags(session->getTags() | + transport::Session::kExternalClientKeepOpen); + } } appendReplicationInfo(opCtx, result, 0); |