summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2018-12-20 15:58:18 -0500
committerBenety Goh <benety@mongodb.com>2018-12-20 15:58:18 -0500
commita38bfed6f6347d7a1d8b4a96ad03a1581584a801 (patch)
tree91452d06d815ec340d8b8e77364eef6ada81781a
parent311f158a3f657fc1810437e72daa8d9428dd991c (diff)
downloadmongo-a38bfed6f6347d7a1d8b4a96ad03a1581584a801.tar.gz
Revert "SERVER-36416 Add dropConnections administrative command"
This reverts commit 9163a2cf69c8c2b66f67ff3b95859727101c0dc3.
-rw-r--r--jstests/core/views/views_all_commands.js1
-rw-r--r--jstests/noPassthrough/drop_connections_replSet.js28
-rw-r--r--jstests/noPassthrough/drop_connections_sharded.js32
-rw-r--r--src/mongo/db/auth/action_types.txt2
-rw-r--r--src/mongo/db/auth/role_graph_builtin_roles.cpp1
-rw-r--r--src/mongo/db/commands/SConscript2
-rw-r--r--src/mongo/db/commands/drop_connections.idl45
-rw-r--r--src/mongo/db/commands/drop_connections_command.cpp97
8 files changed, 1 insertions, 207 deletions
diff --git a/jstests/core/views/views_all_commands.js b/jstests/core/views/views_all_commands.js
index 045497b3033..708b5b56889 100644
--- a/jstests/core/views/views_all_commands.js
+++ b/jstests/core/views/views_all_commands.js
@@ -217,7 +217,6 @@
drop: {command: {drop: "view"}},
dropAllRolesFromDatabase: {skip: isUnrelated},
dropAllUsersFromDatabase: {skip: isUnrelated},
- dropConnections: {skip: isUnrelated},
dropDatabase: {command: {dropDatabase: 1}},
dropIndexes: {command: {dropIndexes: "view"}, expectFailure: true},
dropRole: {
diff --git a/jstests/noPassthrough/drop_connections_replSet.js b/jstests/noPassthrough/drop_connections_replSet.js
deleted file mode 100644
index ceaf382646e..00000000000
--- a/jstests/noPassthrough/drop_connections_replSet.js
+++ /dev/null
@@ -1,28 +0,0 @@
-(function() {
- "use strict";
-
- const rst = new ReplSetTest({nodes: 3});
- rst.startSet();
- rst.initiate();
-
- const primary = rst.getPrimary();
- rst.awaitSecondaryNodes();
-
- var cfg = primary.getDB('local').system.replset.findOne();
- var memberHost = cfg.members[2].host;
- var removedMember = cfg.members.splice(2, 1);
- cfg.version++;
-
- primary.adminCommand({replSetReconfig: cfg});
-
- assert.eq(1, primary.adminCommand({connPoolStats: 1}).hosts[memberHost].available);
- assert.commandWorked(primary.adminCommand({dropConnections: 1, hostAndPort: [memberHost]}));
- assert.eq(0, primary.adminCommand({connPoolStats: 1}).hosts[memberHost].available);
-
- // need to re-add removed node or test complain about the replset config
- cfg.members.push(removedMember[0]);
- cfg.version++;
- primary.adminCommand({replSetReconfig: cfg});
-
- rst.stopSet();
-})();
diff --git a/jstests/noPassthrough/drop_connections_sharded.js b/jstests/noPassthrough/drop_connections_sharded.js
deleted file mode 100644
index 64395d55954..00000000000
--- a/jstests/noPassthrough/drop_connections_sharded.js
+++ /dev/null
@@ -1,32 +0,0 @@
-(function() {
- "use strict";
-
- const st = new ShardingTest({shards: 1, rs0: {nodes: 3}, mongos: 1});
- const mongos = st.s0;
- const rst = st.rs0;
- const primary = rst.getPrimary();
-
- mongos.adminCommand({multicast: {ping: 0}});
-
- var cfg = primary.getDB('local').system.replset.findOne();
- var memberHost = cfg.members[2].host;
- var removedMember = cfg.members.splice(2, 1);
- cfg.version++;
-
- primary.adminCommand({replSetReconfig: cfg});
-
- function getAvailableConnections(stats, host) {
- return stats.hosts[host].available - stats.pools.global[host].available;
- }
-
- assert.eq(1, getAvailableConnections(mongos.adminCommand({connPoolStats: 1}), memberHost));
- assert.commandWorked(mongos.adminCommand({dropConnections: 1, hostAndPort: [memberHost]}));
- assert.eq(0, getAvailableConnections(mongos.adminCommand({connPoolStats: 1}), memberHost));
-
- // need to re-add removed node or test complain about the replset config
- cfg.members.push(removedMember[0]);
- cfg.version++;
- primary.adminCommand({replSetReconfig: cfg});
-
- st.stop();
-})();
diff --git a/src/mongo/db/auth/action_types.txt b/src/mongo/db/auth/action_types.txt
index 303022bf3a9..644f60e3928 100644
--- a/src/mongo/db/auth/action_types.txt
+++ b/src/mongo/db/auth/action_types.txt
@@ -39,7 +39,6 @@
"dropAllRolesFromDatabase", # Not used for permissions checks, but to id the event in logs.
"dropAllUsersFromDatabase", # Not used for permissions checks, but to id the event in logs.
"dropCollection",
-"dropConnections",
"dropDatabase",
"dropIndex",
"dropRole",
@@ -123,3 +122,4 @@
"validate",
"viewRole",
"viewUser"]
+
diff --git a/src/mongo/db/auth/role_graph_builtin_roles.cpp b/src/mongo/db/auth/role_graph_builtin_roles.cpp
index dd8bb4a8a15..3de5d8b2e53 100644
--- a/src/mongo/db/auth/role_graph_builtin_roles.cpp
+++ b/src/mongo/db/auth/role_graph_builtin_roles.cpp
@@ -209,7 +209,6 @@ MONGO_INITIALIZER(AuthorizationBuiltinRoles)(InitializerContext* context) {
<< ActionType::applicationMessage // clusterManager gets this also
<< ActionType::connPoolSync
<< ActionType::cpuProfiler
- << ActionType::dropConnections
<< ActionType::logRotate
<< ActionType::setParameter
<< ActionType::shutdown
diff --git a/src/mongo/db/commands/SConscript b/src/mongo/db/commands/SConscript
index 14547d299ab..eabb2df44fa 100644
--- a/src/mongo/db/commands/SConscript
+++ b/src/mongo/db/commands/SConscript
@@ -134,8 +134,6 @@ env.Library(
"conn_pool_stats.cpp",
"conn_pool_sync.cpp",
"connection_status.cpp",
- "drop_connections_command.cpp",
- env.Idlc('drop_connections.idl')[0],
"generic_servers.cpp",
"isself.cpp",
"mr_common.cpp",
diff --git a/src/mongo/db/commands/drop_connections.idl b/src/mongo/db/commands/drop_connections.idl
deleted file mode 100644
index 7d41e108889..00000000000
--- a/src/mongo/db/commands/drop_connections.idl
+++ /dev/null
@@ -1,45 +0,0 @@
-# Copyright (C) 2018-present MongoDB, Inc.
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the Server Side Public License, version 1,
-# as published by MongoDB, Inc.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# Server Side Public License for more details.
-#
-# You should have received a copy of the Server Side Public License
-# along with this program. If not, see
-# <http://www.mongodb.com/licensing/server-side-public-license>.
-#
-# As a special exception, the copyright holders give permission to link the
-# code of portions of this program with the OpenSSL library under certain
-# conditions as described in each individual source file and distribute
-# linked combinations including the program with the OpenSSL library. You
-# must comply with the Server Side Public License in all respects for
-# all of the code used other than as permitted herein. If you modify file(s)
-# with this exception, you may extend this exception to your version of the
-# file(s), but you are not obligated to do so. If you do not wish to do so,
-# delete this exception statement from your version. If you delete this
-# exception statement from all source files in the program, then also delete
-# it in the license file.
-#
-
-# dropConnections IDL File.
-
-global:
- cpp_namespace: "mongo"
-
-imports:
- - "mongo/idl/basic_types.idl"
- - "mongo/util/net/hostandport.idl"
-
-commands:
- dropConnections:
- description: "An administrative command which takes a list of host and ports and drops pooled connections to them"
- namespace: ignored
- fields:
- hostAndPort:
- description: "List of host and ports"
- type: array<HostAndPort>
diff --git a/src/mongo/db/commands/drop_connections_command.cpp b/src/mongo/db/commands/drop_connections_command.cpp
deleted file mode 100644
index 22d5aeffd5e..00000000000
--- a/src/mongo/db/commands/drop_connections_command.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-
-/**
- * Copyright (C) 2018-present MongoDB, Inc.
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the Server Side Public License, version 1,
- * as published by MongoDB, Inc.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * Server Side Public License for more details.
- *
- * You should have received a copy of the Server Side Public License
- * along with this program. If not, see
- * <http://www.mongodb.com/licensing/server-side-public-license>.
- *
- * As a special exception, the copyright holders give permission to link the
- * code of portions of this program with the OpenSSL library under certain
- * conditions as described in each individual source file and distribute
- * linked combinations including the program with the OpenSSL library. You
- * must comply with the Server Side Public License in all respects for
- * all of the code used other than as permitted herein. If you modify file(s)
- * with this exception, you may extend this exception to your version of the
- * file(s), but you are not obligated to do so. If you do not wish to do so,
- * delete this exception statement from your version. If you delete this
- * exception statement from all source files in the program, then also delete
- * it in the license file.
- */
-
-#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kCommand
-
-#include "mongo/platform/basic.h"
-
-#include "mongo/db/auth/authorization_session.h"
-#include "mongo/db/commands.h"
-#include "mongo/db/commands/drop_connections_gen.h"
-#include "mongo/executor/egress_tag_closer_manager.h"
-#include "mongo/util/log.h"
-#include "mongo/util/net/hostandport.h"
-
-namespace mongo {
-namespace {
-
-class DropConnectionsCmd final : public TypedCommand<DropConnectionsCmd> {
-public:
- using Request = DropConnections;
-
- std::string help() const override {
- return "Drop egress connections to specified host and port";
- }
-
- bool adminOnly() const override {
- return false;
- }
-
- AllowedOnSecondary secondaryAllowed(ServiceContext*) const override {
- return AllowedOnSecondary::kAlways;
- }
-
- class Invocation final : public InvocationBase {
- public:
- using InvocationBase::InvocationBase;
-
- void typedRun(OperationContext* opCtx) {
-
- const auto& hostAndPorts = request().getHostAndPort();
-
- auto& egressTagCloserManager =
- executor::EgressTagCloserManager::get(opCtx->getServiceContext());
-
- for (const auto& hostAndPort : hostAndPorts) {
- egressTagCloserManager.dropConnections(hostAndPort);
- }
- }
-
- NamespaceString ns() const override {
- return NamespaceString();
- }
-
- bool supportsWriteConcern() const override {
- return false;
- }
-
- void doCheckAuthorization(OperationContext* opCtx) const override {
- uassert(ErrorCodes::Unauthorized,
- "Unauthorized",
- AuthorizationSession::get(opCtx->getClient())
- ->isAuthorizedForActionsOnResource(ResourcePattern::forClusterResource(),
- ActionType::dropConnections));
- }
- };
-
-} dropConnectionsCmd;
-
-} // namespace
-} // namespace mongo