diff options
author | Jason Carey <jcarey@argv.me> | 2017-11-02 15:06:54 -0400 |
---|---|---|
committer | Jason Carey <jcarey@argv.me> | 2017-11-09 18:35:00 -0500 |
commit | bf53cbe298bc6724b1f2b5bf16afbd9e3876c623 (patch) | |
tree | e09009ab740b9d3d15c48b1b9a3ec09c2086637b /src | |
parent | c3c736d3f2755e7e8b59638fd94cb000265abdf3 (diff) | |
download | mongo-bf53cbe298bc6724b1f2b5bf16afbd9e3876c623.tar.gz |
SERVER-31777 deactivate logical sessions for fcv34
For anything less than fully upgraded to 3.6:
* suppress logicalSessionTimeoutMinutes in isMaster
* fail any commands that passes lsid
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/initialize_operation_session_info.cpp | 14 | ||||
-rw-r--r-- | src/mongo/db/repl/replication_info.cpp | 5 | ||||
-rw-r--r-- | src/mongo/s/commands/cluster_is_master_cmd.cpp | 5 | ||||
-rw-r--r-- | src/mongo/shell/utils.js | 1 |
4 files changed, 18 insertions, 7 deletions
diff --git a/src/mongo/db/initialize_operation_session_info.cpp b/src/mongo/db/initialize_operation_session_info.cpp index 87003e8cc80..8ed477c17a3 100644 --- a/src/mongo/db/initialize_operation_session_info.cpp +++ b/src/mongo/db/initialize_operation_session_info.cpp @@ -31,6 +31,7 @@ #include "mongo/db/initialize_operation_session_info.h" #include "mongo/db/auth/authorization_session.h" +#include "mongo/db/commands/feature_compatibility_version.h" #include "mongo/db/logical_session_cache.h" #include "mongo/db/logical_session_id_helpers.h" #include "mongo/db/operation_context.h" @@ -46,11 +47,6 @@ void initializeOperationSessionInfo(OperationContext* opCtx, return; } - if (serverGlobalParams.featureCompatibility.getVersion() != - ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) { - return; - } - { // If we're using the localhost bypass, logical sessions are disabled AuthorizationSession* authSession = AuthorizationSession::get(opCtx->getClient()); @@ -62,6 +58,14 @@ void initializeOperationSessionInfo(OperationContext* opCtx, auto osi = OperationSessionInfoFromClient::parse("OperationSessionInfo"_sd, requestBody); if (osi.getSessionId()) { + uassert(ErrorCodes::InvalidOptions, + str::stream() << "cannot pass logical session id unless fully upgraded to " + "featureCompatibilityVersion 3.4. See " + << feature_compatibility_version::kDochubLink + << " .", + serverGlobalParams.featureCompatibility.getVersion() == + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36); + stdx::lock_guard<Client> lk(*opCtx->getClient()); opCtx->setLogicalSessionId(makeLogicalSessionId(osi.getSessionId().get(), opCtx)); diff --git a/src/mongo/db/repl/replication_info.cpp b/src/mongo/db/repl/replication_info.cpp index 7729eaccda3..76388589f95 100644 --- a/src/mongo/db/repl/replication_info.cpp +++ b/src/mongo/db/repl/replication_info.cpp @@ -362,7 +362,10 @@ public: result.appendNumber("maxMessageSizeBytes", MaxMessageSizeBytes); result.appendNumber("maxWriteBatchSize", write_ops::kMaxWriteBatchSize); result.appendDate("localTime", jsTime()); - result.append("logicalSessionTimeoutMinutes", localLogicalSessionTimeoutMinutes); + if (serverGlobalParams.featureCompatibility.getVersion() == + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) { + result.append("logicalSessionTimeoutMinutes", localLogicalSessionTimeoutMinutes); + } if (internalClientElement) { result.append("minWireVersion", diff --git a/src/mongo/s/commands/cluster_is_master_cmd.cpp b/src/mongo/s/commands/cluster_is_master_cmd.cpp index c8180d2e539..fa4d556d922 100644 --- a/src/mongo/s/commands/cluster_is_master_cmd.cpp +++ b/src/mongo/s/commands/cluster_is_master_cmd.cpp @@ -112,7 +112,10 @@ public: result.appendNumber("maxMessageSizeBytes", MaxMessageSizeBytes); result.appendNumber("maxWriteBatchSize", write_ops::kMaxWriteBatchSize); result.appendDate("localTime", jsTime()); - result.append("logicalSessionTimeoutMinutes", localLogicalSessionTimeoutMinutes); + if (serverGlobalParams.featureCompatibility.getVersion() == + ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo36) { + result.append("logicalSessionTimeoutMinutes", localLogicalSessionTimeoutMinutes); + } // Mongos tries to keep exactly the same version range of the server for which // it is compiled. diff --git a/src/mongo/shell/utils.js b/src/mongo/shell/utils.js index 359a543075c..638580ebf3c 100644 --- a/src/mongo/shell/utils.js +++ b/src/mongo/shell/utils.js @@ -260,6 +260,7 @@ jsTestOptions = function() { excludedDBsFromDBHash: TestData.excludedDBsFromDBHash, alwaysInjectTransactionNumber: TestData.alwaysInjectTransactionNumber, skipGossipingClusterTime: TestData.skipGossipingClusterTime || false, + disableEnableSessions: TestData.disableEnableSessions, }); } return _jsTestOptions; |