summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands
diff options
context:
space:
mode:
authorVishnu Kaushik <vishnu.kaushik@mongodb.com>2019-07-08 10:31:49 -0400
committerVishnu Kaushik <vishnu.kaushik@mongodb.com>2019-07-08 15:06:36 -0400
commita3244d8ac0ae530e2394248e72aadb27241adba3 (patch)
treef2ee166391a35f1a92a8a4a3e159cda10b0aff96 /src/mongo/db/commands
parent5915e1114d1e45e79642767c8184d514ac957245 (diff)
downloadmongo-a3244d8ac0ae530e2394248e72aadb27241adba3.tar.gz
SERVER-38356 added functionality to forbid dropping the oplog, modified tests to get around Evergreen issue
Diffstat (limited to 'src/mongo/db/commands')
-rw-r--r--src/mongo/db/commands/dbcommands.cpp21
1 files changed, 16 insertions, 5 deletions
diff --git a/src/mongo/db/commands/dbcommands.cpp b/src/mongo/db/commands/dbcommands.cpp
index ba34046a899..291c5c36112 100644
--- a/src/mongo/db/commands/dbcommands.cpp
+++ b/src/mongo/db/commands/dbcommands.cpp
@@ -233,11 +233,22 @@ public:
BSONObjBuilder& result) {
const NamespaceString nsToDrop(CommandHelpers::parseNsCollectionRequired(dbname, cmdObj));
- if ((repl::ReplicationCoordinator::get(opCtx)->getReplicationMode() !=
- repl::ReplicationCoordinator::modeNone) &&
- nsToDrop.isOplog()) {
- errmsg = "can't drop live oplog while replicating";
- return false;
+ if (nsToDrop.isOplog()) {
+ if (repl::ReplicationCoordinator::get(opCtx)->isReplEnabled()) {
+ errmsg = "can't drop live oplog while replicating";
+ return false;
+ }
+
+ auto storageEngine = opCtx->getServiceContext()->getStorageEngine();
+ invariant(storageEngine);
+ if (storageEngine->supportsRecoveryTimestamp()) {
+ // We use the method supportsRecoveryTimestamp() to detect whether we are using
+ // the WiredTiger storage engine, which is currently only storage engine that
+ // supports the replSetResizeOplog command.
+ errmsg =
+ "can't drop oplog on storage engines that support replSetResizeOplog command";
+ return false;
+ }
}
uassertStatusOK(