summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorEvgeni Dobranov <evgeni.dobranov@mongodb.com>2019-09-11 21:26:35 +0000
committerevergreen <evergreen@mongodb.com>2019-09-11 21:26:35 +0000
commit1e4ecf48af15b8ee75f53601e7783e02171af982 (patch)
treec8b474394ef344d866e7a7a9f04124aa44f352f2 /src/mongo
parent1659ddcfb49050dcf18fef014cd9d5ebf5717650 (diff)
downloadmongo-1e4ecf48af15b8ee75f53601e7783e02171af982.tar.gz
SERVER-41597 Remove mmap collection option
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/db/catalog/collection_options.cpp30
-rw-r--r--src/mongo/db/catalog/collection_options.h4
-rw-r--r--src/mongo/db/catalog/collection_options_test.cpp17
-rw-r--r--src/mongo/db/catalog/create_collection.cpp3
-rw-r--r--src/mongo/s/commands/cluster_create_cmd.cpp3
5 files changed, 7 insertions, 50 deletions
diff --git a/src/mongo/db/catalog/collection_options.cpp b/src/mongo/db/catalog/collection_options.cpp
index 75c5fb91d14..9c1561e8192 100644
--- a/src/mongo/db/catalog/collection_options.cpp
+++ b/src/mongo/db/catalog/collection_options.cpp
@@ -156,15 +156,8 @@ StatusWith<CollectionOptions> CollectionOptions::parse(const BSONObj& options, P
return Status(ErrorCodes::BadValue,
"max in a capped collection has to be < 2^31 or not set");
} else if (fieldName == "$nExtents") {
- if (e.type() == Array) {
- BSONObjIterator j(e.Obj());
- while (j.more()) {
- BSONElement inner = j.next();
- collectionOptions.initialExtentSizes.push_back(inner.numberInt());
- }
- } else {
- collectionOptions.initialNumExtents = e.safeNumberLong();
- }
+ // Ignoring for backwards compatibility.
+ continue;
} else if (fieldName == "autoIndexId") {
if (e.trueValue())
collectionOptions.autoIndexId = YES;
@@ -287,11 +280,6 @@ void CollectionOptions::appendBSON(BSONObjBuilder* builder) const {
builder->appendNumber("max", cappedMaxDocs);
}
- if (initialNumExtents)
- builder->appendNumber("$nExtents", initialNumExtents);
- if (!initialExtentSizes.empty())
- builder->append("$nExtents", initialExtentSizes);
-
if (autoIndexId != DEFAULT)
builder->appendBool("autoIndexId", autoIndexId == YES);
@@ -349,20 +337,6 @@ bool CollectionOptions::matchesStorageOptions(const CollectionOptions& other,
return false;
}
- if (initialNumExtents != other.initialNumExtents) {
- return false;
- }
-
- if (initialExtentSizes.size() != other.initialExtentSizes.size()) {
- return false;
- }
-
- if (!std::equal(other.initialExtentSizes.begin(),
- other.initialExtentSizes.end(),
- initialExtentSizes.begin())) {
- return false;
- }
-
if (autoIndexId != other.autoIndexId) {
return false;
}
diff --git a/src/mongo/db/catalog/collection_options.h b/src/mongo/db/catalog/collection_options.h
index f5f63b0f72f..f1644c69dd8 100644
--- a/src/mongo/db/catalog/collection_options.h
+++ b/src/mongo/db/catalog/collection_options.h
@@ -108,10 +108,6 @@ struct CollectionOptions {
long long cappedSize = 0;
long long cappedMaxDocs = 0;
- // (MMAPv1) The following 2 are mutually exclusive, can only have one set.
- long long initialNumExtents = 0;
- std::vector<long long> initialExtentSizes;
-
// The behavior of _id index creation when collection created
void setNoIdIndex() {
autoIndexId = NO;
diff --git a/src/mongo/db/catalog/collection_options_test.cpp b/src/mongo/db/catalog/collection_options_test.cpp
index bd4fd992a02..6c0c76613f9 100644
--- a/src/mongo/db/catalog/collection_options_test.cpp
+++ b/src/mongo/db/catalog/collection_options_test.cpp
@@ -349,19 +349,8 @@ TEST(CollectionOptions, MaxNumberLimits) {
ASSERT_EQ(options.cappedMaxDocs, 0);
}
-TEST(CollectionOptions, NExtentsNumberLimits) {
- CollectionOptions options = assertGet(CollectionOptions::parse(fromjson("{$nExtents: 'a'}")));
- ASSERT_EQ(options.initialNumExtents, 0);
-
- options = assertGet(CollectionOptions::parse(fromjson("{$nExtents: '-1'}")));
- ASSERT_EQ(options.initialNumExtents, 0);
-
- options = assertGet(
- CollectionOptions::parse(fromjson("{$nExtents: '-9999999999999999999999999999999999'}")));
- ASSERT_EQ(options.initialNumExtents, 0);
-
- options = assertGet(
- CollectionOptions::parse(fromjson("{$nExtents: 9999999999999999999999999999999}")));
- ASSERT_EQ(options.initialNumExtents, LLONG_MAX);
+TEST(CollectionOptions, NExtentsNoError) {
+ // Check that $nExtents does not cause an error for backwards compatability
+ assertGet(CollectionOptions::parse(fromjson("{$nExtents: 'a'}")));
}
} // namespace mongo
diff --git a/src/mongo/db/catalog/create_collection.cpp b/src/mongo/db/catalog/create_collection.cpp
index b974ed83489..2c58395d3d4 100644
--- a/src/mongo/db/catalog/create_collection.cpp
+++ b/src/mongo/db/catalog/create_collection.cpp
@@ -161,8 +161,7 @@ Status createCollection(OperationContext* opCtx,
BSONObj options = optionsBuilder.obj();
uassert(14832,
"specify size:<n> when capped is true",
- !options["capped"].trueValue() || options["size"].isNumber() ||
- options.hasField("$nExtents"));
+ !options["capped"].trueValue() || options["size"].isNumber());
CollectionOptions collectionOptions;
{
diff --git a/src/mongo/s/commands/cluster_create_cmd.cpp b/src/mongo/s/commands/cluster_create_cmd.cpp
index 9b9ebab29e3..3c835f9465a 100644
--- a/src/mongo/s/commands/cluster_create_cmd.cpp
+++ b/src/mongo/s/commands/cluster_create_cmd.cpp
@@ -77,8 +77,7 @@ public:
uassert(ErrorCodes::InvalidOptions,
"specify size:<n> when capped is true",
- !cmdObj["capped"].trueValue() || cmdObj["size"].isNumber() ||
- cmdObj.hasField("$nExtents"));
+ !cmdObj["capped"].trueValue() || cmdObj["size"].isNumber());
ConfigsvrCreateCollection configCreateCmd(nss);
configCreateCmd.setDbName(NamespaceString::kAdminDb);