summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDianna Hohensee <dianna.hohensee@10gen.com>2018-02-22 16:37:38 -0500
committerDianna Hohensee <dianna.hohensee@10gen.com>2018-02-23 13:11:59 -0500
commit9a5fd32bfcdbf356a35961e45ed3d6693e85b89e (patch)
tree75e2c6336bfbbf556acdef0345fe4cc3425a312b
parent0f1a697cea94307c4aec72e8309372254e1f3570 (diff)
downloadmongo-9a5fd32bfcdbf356a35961e45ed3d6693e85b89e.tar.gz
SERVER-33014 Remove unreachable featureCompatibilityVersion document op observers
-rw-r--r--src/mongo/db/commands/feature_compatibility_version.cpp26
-rw-r--r--src/mongo/db/commands/feature_compatibility_version.h12
-rw-r--r--src/mongo/db/op_observer_impl.cpp14
3 files changed, 9 insertions, 43 deletions
diff --git a/src/mongo/db/commands/feature_compatibility_version.cpp b/src/mongo/db/commands/feature_compatibility_version.cpp
index 60014e63785..1781a956435 100644
--- a/src/mongo/db/commands/feature_compatibility_version.cpp
+++ b/src/mongo/db/commands/feature_compatibility_version.cpp
@@ -335,32 +335,6 @@ void FeatureCompatibilityVersion::onInsertOrUpdate(OperationContext* opCtx, cons
});
}
-void FeatureCompatibilityVersion::onDelete(OperationContext* opCtx, const BSONObj& doc) {
- auto idElement = doc["_id"];
- if (idElement.type() != BSONType::String ||
- idElement.String() != FeatureCompatibilityVersion::kParameterName) {
- return;
- }
-
- log() << "setting featureCompatibilityVersion to "
- << FeatureCompatibilityVersionCommandParser::kVersion34;
- opCtx->recoveryUnit()->onCommit([]() {
- serverGlobalParams.featureCompatibility.setVersion(
- ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo34);
- updateMinWireVersion();
- });
-}
-
-void FeatureCompatibilityVersion::onDropCollection(OperationContext* opCtx) {
- log() << "setting featureCompatibilityVersion to "
- << FeatureCompatibilityVersionCommandParser::kVersion36;
- opCtx->recoveryUnit()->onCommit([]() {
- serverGlobalParams.featureCompatibility.setVersion(
- ServerGlobalParams::FeatureCompatibility::Version::kFullyDowngradedTo36);
- updateMinWireVersion();
- });
-}
-
void FeatureCompatibilityVersion::updateMinWireVersion() {
WireSpec& spec = WireSpec::instance();
diff --git a/src/mongo/db/commands/feature_compatibility_version.h b/src/mongo/db/commands/feature_compatibility_version.h
index aab764f7ea9..1c3916565b0 100644
--- a/src/mongo/db/commands/feature_compatibility_version.h
+++ b/src/mongo/db/commands/feature_compatibility_version.h
@@ -152,18 +152,6 @@ public:
static void onInsertOrUpdate(OperationContext* opCtx, const BSONObj& doc);
/**
- * Examines the _id of a document removed from admin.system.version. If it is the
- * featureCompatibilityVersion document, resets the server parameter to its default value
- * on commit.
- */
- static void onDelete(OperationContext* opCtx, const BSONObj& doc);
-
- /**
- * Resets the server parameter to its default value on commit.
- */
- static void onDropCollection(OperationContext* opCtx);
-
- /**
* Sets the server's outgoing and incomingInternalClient minWireVersions according to the
* current featureCompatibilityVersion value.
*/
diff --git a/src/mongo/db/op_observer_impl.cpp b/src/mongo/db/op_observer_impl.cpp
index 8ba3bfd13be..4a1977ebf7d 100644
--- a/src/mongo/db/op_observer_impl.cpp
+++ b/src/mongo/db/op_observer_impl.cpp
@@ -602,9 +602,11 @@ void OpObserverImpl::onDropDatabase(OperationContext* opCtx, const std::string&
kUninitializedStmtId,
{});
- if (dbName == FeatureCompatibilityVersion::kDatabase) {
- FeatureCompatibilityVersion::onDropCollection(opCtx);
- } else if (dbName == NamespaceString::kSessionTransactionsTableNamespace.db()) {
+ uassert(50714,
+ "dropping the admin database is not allowed.",
+ dbName != FeatureCompatibilityVersion::kDatabase);
+
+ if (dbName == NamespaceString::kSessionTransactionsTableNamespace.db()) {
SessionCatalog::get(opCtx)->invalidateSessions(opCtx, boost::none);
}
@@ -636,10 +638,12 @@ repl::OpTime OpObserverImpl::onDropCollection(OperationContext* opCtx,
{});
}
+ uassert(50715,
+ "dropping the admin.system.version collection is not allowed.",
+ collectionName.ns() != FeatureCompatibilityVersion::kCollection);
+
if (collectionName.coll() == DurableViewCatalog::viewsCollectionName()) {
DurableViewCatalog::onExternalChange(opCtx, collectionName);
- } else if (collectionName.ns() == FeatureCompatibilityVersion::kCollection) {
- FeatureCompatibilityVersion::onDropCollection(opCtx);
} else if (collectionName == NamespaceString::kSessionTransactionsTableNamespace) {
SessionCatalog::get(opCtx)->invalidateSessions(opCtx, boost::none);
}