summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/drop_indexes.cpp
diff options
context:
space:
mode:
authorSamy Lanka <samy.lanka@mongodb.com>2020-04-12 23:54:13 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-04-13 04:09:36 +0000
commit72cf1283ee2c249dcab8c185f64ee6108c00b02c (patch)
treeb67d7d7e4b836d412ac83aacc0fb7ffa014bbc29 /src/mongo/db/commands/drop_indexes.cpp
parent3cdbd3844a7b1087c0881f2d4ea5db5192938aec (diff)
downloadmongo-72cf1283ee2c249dcab8c185f64ee6108c00b02c.tar.gz
Revert "SERVER-44343 Make 'reIndex' a standalone-only command"
This reverts commit 2ad12521309aeccc6f712f4ccb532f113255d186.
Diffstat (limited to 'src/mongo/db/commands/drop_indexes.cpp')
-rw-r--r--src/mongo/db/commands/drop_indexes.cpp16
1 files changed, 2 insertions, 14 deletions
diff --git a/src/mongo/db/commands/drop_indexes.cpp b/src/mongo/db/commands/drop_indexes.cpp
index 38266a3cf48..1b48d355e5c 100644
--- a/src/mongo/db/commands/drop_indexes.cpp
+++ b/src/mongo/db/commands/drop_indexes.cpp
@@ -100,16 +100,13 @@ public:
class CmdReIndex : public ErrmsgCommandDeprecated {
public:
AllowedOnSecondary secondaryAllowed(ServiceContext*) const override {
- // Even though reIndex is a standalone-only command, this will return that the command is
- // allowed on secondaries so that it will fail with a more useful error message to the user
- // rather than with a NotMaster error.
- return AllowedOnSecondary::kAlways;
+ return AllowedOnSecondary::kAlways; // can reindex on a secondary
}
virtual bool supportsWriteConcern(const BSONObj& cmd) const override {
return false;
}
std::string help() const override {
- return "re-index a collection (can only be run on a standalone mongod)";
+ return "re-index a collection";
}
virtual void addRequiredPrivileges(const std::string& dbname,
const BSONObj& cmdObj,
@@ -131,15 +128,6 @@ public:
LOGV2(20457, "CMD: reIndex {toReIndexNss}", "toReIndexNss"_attr = toReIndexNss);
- if (repl::ReplicationCoordinator::get(opCtx)->getReplicationMode() !=
- repl::ReplicationCoordinator::modeNone) {
- uasserted(
- ErrorCodes::IllegalOperation,
- str::stream()
- << "reIndex is only allowed on a standalone mongod instance. Cannot reIndex '"
- << toReIndexNss << "' while replication is active");
- }
-
AutoGetCollection autoColl(opCtx, toReIndexNss, MODE_X);
Collection* collection = autoColl.getCollection();
if (!collection) {