summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2019-05-03 16:21:24 -0400
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2019-05-09 07:40:56 -0400
commit2791817876636c0cfd60d867f31c7a83cf3f18c1 (patch)
tree3aefcb1999cccf4cb53b2401a44857549ba8722a /src/mongo/db/commands
parent1b8a9f5dc5c3314042b55e7415a2a25045b32a94 (diff)
downloadmongo-2791817876636c0cfd60d867f31c7a83cf3f18c1.tar.gz
SERVER-37837 Get rid of TransactionReaper (Part 1)
This change gets rid of the TransactionReaper's usage of the ReplicationCoordinator for checking whether it is primary or not and makes the LogicalSessionCache joinable on shutdown. It also removes the TransactionReaper's grouping per-shard optimization and moves it all under SessionCollectionSharded.
Diffstat (limited to 'src/mongo/db/commands')
-rw-r--r--src/mongo/db/commands/SConscript3
-rw-r--r--src/mongo/db/commands/end_sessions_command.cpp12
2 files changed, 10 insertions, 5 deletions
diff --git a/src/mongo/db/commands/SConscript b/src/mongo/db/commands/SConscript
index 7f83d0d192d..8c7fc3639ad 100644
--- a/src/mongo/db/commands/SConscript
+++ b/src/mongo/db/commands/SConscript
@@ -102,11 +102,12 @@ env.Library(
"kill_all_sessions_command.cpp",
"kill_sessions_command.cpp",
"parameters.cpp",
- env.Idlc('parameters.idl')[0],
"refresh_logical_session_cache_now.cpp",
"refresh_sessions_command.cpp",
"rename_collection_common.cpp",
"start_session_command.cpp",
+ env.Idlc('end_sessions.idl')[0],
+ env.Idlc('parameters.idl')[0],
],
LIBDEPS_PRIVATE=[
'$BUILD_DIR/mongo/bson/mutable/mutable_bson',
diff --git a/src/mongo/db/commands/end_sessions_command.cpp b/src/mongo/db/commands/end_sessions_command.cpp
index 9822eebd60c..b8325015cf1 100644
--- a/src/mongo/db/commands/end_sessions_command.cpp
+++ b/src/mongo/db/commands/end_sessions_command.cpp
@@ -33,11 +33,13 @@
#include "mongo/db/auth/authorization_session.h"
#include "mongo/db/client.h"
#include "mongo/db/commands.h"
+#include "mongo/db/commands/end_sessions_gen.h"
#include "mongo/db/logical_session_cache.h"
#include "mongo/db/logical_session_id_helpers.h"
#include "mongo/db/operation_context.h"
namespace mongo {
+namespace {
class EndSessionsCommand final : public BasicCommand {
EndSessionsCommand(const EndSessionsCommand&) = delete;
@@ -73,10 +75,10 @@ public:
}
}
- virtual bool run(OperationContext* opCtx,
- const std::string& db,
- const BSONObj& cmdObj,
- BSONObjBuilder& result) override {
+ bool run(OperationContext* opCtx,
+ const std::string& db,
+ const BSONObj& cmdObj,
+ BSONObjBuilder& result) override {
auto lsCache = LogicalSessionCache::get(opCtx);
auto cmd = EndSessionsCmdFromClient::parse("EndSessionsCmdFromClient"_sd, cmdObj);
@@ -84,6 +86,8 @@ public:
lsCache->endSessions(makeLogicalSessionIds(cmd.getEndSessions(), opCtx));
return true;
}
+
} endSessionsCommand;
+} // namespace
} // namespace mongo