diff options
author | Jonathan Lee <jonathan.lee@mongodb.com> | 2021-09-28 14:29:54 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-09-28 15:46:10 +0000 |
commit | 64c8863c9d387b22d3ebd8b66836191837ece434 (patch) | |
tree | f1c51a1883cf26279869dab8eed5b1496fb97611 /src/mongo/db/initialize_operation_session_info.cpp | |
parent | c1f41cbaec4a4d570b072c75634f45d33472aec6 (diff) | |
download | mongo-64c8863c9d387b22d3ebd8b66836191837ece434.tar.gz |
SERVER-59703 Only support child sessions in sharded clusters
Diffstat (limited to 'src/mongo/db/initialize_operation_session_info.cpp')
-rw-r--r-- | src/mongo/db/initialize_operation_session_info.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/mongo/db/initialize_operation_session_info.cpp b/src/mongo/db/initialize_operation_session_info.cpp index d50af9c090c..dbde1760c24 100644 --- a/src/mongo/db/initialize_operation_session_info.cpp +++ b/src/mongo/db/initialize_operation_session_info.cpp @@ -36,6 +36,7 @@ #include "mongo/db/logical_session_cache.h" #include "mongo/db/logical_session_id_helpers.h" #include "mongo/db/operation_context.h" +#include "mongo/s/is_mongos.h" namespace mongo { @@ -103,6 +104,9 @@ OperationSessionInfoFromClient initializeOperationSessionInfo(OperationContext* uassert(ErrorCodes::InvalidOptions, "Internal sessions are not supported outside of transactions", osi.getTxnNumber() && osi.getAutocommit() && !osi.getAutocommit().value()); + uassert(ErrorCodes::InvalidOptions, + "Internal sessions are only supported in sharded clusters", + isMongos() || serverGlobalParams.clusterRole != ClusterRole::None); } opCtx->setLogicalSessionId(std::move(lsid)); |