summaryrefslogtreecommitdiff
path: root/src/mongo/dbtests
diff options
context:
space:
mode:
authorMax Hirschhorn <max.hirschhorn@mongodb.com>2016-09-14 20:49:17 -0400
committerMax Hirschhorn <max.hirschhorn@mongodb.com>2016-09-14 20:49:17 -0400
commit8302d0735b34a16cac000e5e345722487536e5bc (patch)
treec9ef60fe493eda60feacddfd67c0ec298939c4ef /src/mongo/dbtests
parent46acb1b94944bc7aa68ff6a8b3cd2d340b272c6f (diff)
downloadmongo-8302d0735b34a16cac000e5e345722487536e5bc.tar.gz
SERVER-24033 Write full index spec in oplog entry for index creation.
This ensures that the index version (aka the "v" field) is always present in the oplog entry when creating indexes on a 3.4 primary. We can therefore assume that if the "v" field isn't present in the corresponding oplog entry, then a v=1 index should be built. Changes MultiBlockIndex::init() to return the index specifications that were actually created. The "repairDatabase", "compact", "copydb", and "cloneCollection" commands no longer automatically upgrade the index version to the current default version. Instead, the only command that does so is the "reIndex" command.
Diffstat (limited to 'src/mongo/dbtests')
-rw-r--r--src/mongo/dbtests/counttests.cpp6
-rw-r--r--src/mongo/dbtests/dbtests.cpp13
-rw-r--r--src/mongo/dbtests/indexcatalogtests.cpp16
-rw-r--r--src/mongo/dbtests/indexupdatetests.cpp74
-rw-r--r--src/mongo/dbtests/multikey_paths_test.cpp31
-rw-r--r--src/mongo/dbtests/query_stage_ixscan.cpp8
-rw-r--r--src/mongo/dbtests/querytests.cpp8
-rw-r--r--src/mongo/dbtests/rollbacktests.cpp24
-rw-r--r--src/mongo/dbtests/validate_tests.cpp28
9 files changed, 163 insertions, 45 deletions
diff --git a/src/mongo/dbtests/counttests.cpp b/src/mongo/dbtests/counttests.cpp
index 2e28621b833..689b87fe599 100644
--- a/src/mongo/dbtests/counttests.cpp
+++ b/src/mongo/dbtests/counttests.cpp
@@ -36,6 +36,7 @@
#include "mongo/db/db_raii.h"
#include "mongo/db/dbdirectclient.h"
#include "mongo/db/dbhelpers.h"
+#include "mongo/db/index/index_descriptor.h"
#include "mongo/db/json.h"
#include "mongo/stdx/thread.h"
@@ -43,6 +44,10 @@
namespace CountTests {
+namespace {
+const auto kIndexVersion = IndexDescriptor::IndexVersion::kV2;
+} // namespace
+
class Base {
public:
Base()
@@ -83,6 +88,7 @@ protected:
Helpers::ensureIndex(&_txn,
_collection,
key,
+ kIndexVersion,
/*unique=*/false,
/*name=*/key.firstElementFieldName());
}
diff --git a/src/mongo/dbtests/dbtests.cpp b/src/mongo/dbtests/dbtests.cpp
index 96ad9253f08..8ddd7f4aa4c 100644
--- a/src/mongo/dbtests/dbtests.cpp
+++ b/src/mongo/dbtests/dbtests.cpp
@@ -39,6 +39,7 @@
#include "mongo/db/catalog/index_create.h"
#include "mongo/db/commands.h"
#include "mongo/db/db_raii.h"
+#include "mongo/db/index/index_descriptor.h"
#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/repl/replication_coordinator_mock.h"
#include "mongo/db/service_context.h"
@@ -54,6 +55,9 @@
namespace mongo {
namespace dbtests {
+namespace {
+const auto kIndexVersion = IndexDescriptor::IndexVersion::kV2;
+} // namespace
void initWireSpec() {
WireSpec& spec = WireSpec::instance();
@@ -67,9 +71,12 @@ void initWireSpec() {
Status createIndex(OperationContext* txn, StringData ns, const BSONObj& keys, bool unique) {
BSONObjBuilder specBuilder;
- specBuilder << "name" << DBClientBase::genIndexName(keys) << "ns" << ns << "key" << keys;
+ specBuilder.append("name", DBClientBase::genIndexName(keys));
+ specBuilder.append("ns", ns);
+ specBuilder.append("key", keys);
+ specBuilder.append("v", static_cast<int>(kIndexVersion));
if (unique) {
- specBuilder << "unique" << true;
+ specBuilder.appendBool("unique", true);
}
return createIndexFromSpec(txn, ns, specBuilder.done());
}
@@ -84,7 +91,7 @@ Status createIndexFromSpec(OperationContext* txn, StringData ns, const BSONObj&
wunit.commit();
}
MultiIndexBlock indexer(txn, coll);
- Status status = indexer.init(spec);
+ Status status = indexer.init(spec).getStatus();
if (status == ErrorCodes::IndexAlreadyExists) {
return Status::OK();
}
diff --git a/src/mongo/dbtests/indexcatalogtests.cpp b/src/mongo/dbtests/indexcatalogtests.cpp
index ef2f1effb81..068ede905a1 100644
--- a/src/mongo/dbtests/indexcatalogtests.cpp
+++ b/src/mongo/dbtests/indexcatalogtests.cpp
@@ -29,6 +29,9 @@
#include "mongo/dbtests/dbtests.h"
namespace IndexCatalogTests {
+namespace {
+const auto kIndexVersion = IndexDescriptor::IndexVersion::kV2;
+} // namespace
static const char* const _ns = "unittests.indexcatalog";
@@ -135,12 +138,13 @@ public:
OldClientWriteContext ctx(&txn, _ns);
const std::string indexName = "x_1";
- ASSERT_OK(dbtests::createIndexFromSpec(&txn,
- _ns,
- BSON("name" << indexName << "ns" << _ns << "key"
- << BSON("x" << 1)
- << "expireAfterSeconds"
- << 5)));
+ ASSERT_OK(dbtests::createIndexFromSpec(
+ &txn,
+ _ns,
+ BSON("name" << indexName << "ns" << _ns << "key" << BSON("x" << 1) << "v"
+ << static_cast<int>(kIndexVersion)
+ << "expireAfterSeconds"
+ << 5)));
const IndexDescriptor* desc = _catalog->findIndexByName(&txn, indexName);
ASSERT(desc);
diff --git a/src/mongo/dbtests/indexupdatetests.cpp b/src/mongo/dbtests/indexupdatetests.cpp
index 6b9ee3e23ae..0a379851b09 100644
--- a/src/mongo/dbtests/indexupdatetests.cpp
+++ b/src/mongo/dbtests/indexupdatetests.cpp
@@ -48,6 +48,10 @@ namespace IndexUpdateTests {
using std::unique_ptr;
+namespace {
+const auto kIndexVersion = IndexDescriptor::IndexVersion::kV2;
+} // namespace
+
static const char* const _ns = "unittests.indexupdate";
/**
@@ -376,12 +380,14 @@ public:
<< coll->ns().ns()
<< "key"
<< BSON("a" << 1)
+ << "v"
+ << static_cast<int>(kIndexVersion)
<< "unique"
<< true
<< "background"
<< background);
- ASSERT_OK(indexer.init(spec));
+ ASSERT_OK(indexer.init(spec).getStatus());
ASSERT_OK(indexer.insertAllDocumentsInCollection());
WriteUnitOfWork wunit(&_txn);
@@ -428,12 +434,14 @@ public:
<< coll->ns().ns()
<< "key"
<< BSON("a" << 1)
+ << "v"
+ << static_cast<int>(kIndexVersion)
<< "unique"
<< true
<< "background"
<< background);
- ASSERT_OK(indexer.init(spec));
+ ASSERT_OK(indexer.init(spec).getStatus());
const Status status = indexer.insertAllDocumentsInCollection();
ASSERT_EQUALS(status.code(), ErrorCodes::DuplicateKey);
}
@@ -479,12 +487,14 @@ public:
<< coll->ns().ns()
<< "key"
<< BSON("a" << 1)
+ << "v"
+ << static_cast<int>(kIndexVersion)
<< "unique"
<< true
<< "background"
<< background);
- ASSERT_OK(indexer.init(spec));
+ ASSERT_OK(indexer.init(spec).getStatus());
std::set<RecordId> dups;
ASSERT_OK(indexer.insertAllDocumentsInCollection(&dups));
@@ -524,7 +534,9 @@ public:
// Request an interrupt.
getGlobalServiceContext()->setKillAllOperations();
BSONObj indexInfo = BSON("key" << BSON("a" << 1) << "ns" << _ns << "name"
- << "a_1");
+ << "a_1"
+ << "v"
+ << static_cast<int>(kIndexVersion));
// The call is interrupted because mayInterrupt == true.
ASSERT_TRUE(buildIndexInterrupted(indexInfo, true));
// only want to interrupt the index build
@@ -557,7 +569,9 @@ public:
// Request an interrupt.
getGlobalServiceContext()->setKillAllOperations();
BSONObj indexInfo = BSON("key" << BSON("a" << 1) << "ns" << _ns << "name"
- << "a_1");
+ << "a_1"
+ << "v"
+ << static_cast<int>(kIndexVersion));
// The call is not interrupted because mayInterrupt == false.
ASSERT_FALSE(buildIndexInterrupted(indexInfo, false));
// only want to interrupt the index build
@@ -593,7 +607,9 @@ public:
// Request an interrupt.
getGlobalServiceContext()->setKillAllOperations();
BSONObj indexInfo = BSON("key" << BSON("_id" << 1) << "ns" << _ns << "name"
- << "_id_");
+ << "_id_"
+ << "v"
+ << static_cast<int>(kIndexVersion));
// The call is interrupted because mayInterrupt == true.
ASSERT_TRUE(buildIndexInterrupted(indexInfo, true));
// only want to interrupt the index build
@@ -629,7 +645,9 @@ public:
// Request an interrupt.
getGlobalServiceContext()->setKillAllOperations();
BSONObj indexInfo = BSON("key" << BSON("_id" << 1) << "ns" << _ns << "name"
- << "_id_");
+ << "_id_"
+ << "v"
+ << static_cast<int>(kIndexVersion));
// The call is not interrupted because mayInterrupt == false.
ASSERT_FALSE(buildIndexInterrupted(indexInfo, false));
// only want to interrupt the index build
@@ -653,7 +671,7 @@ public:
// Request an interrupt.
getGlobalServiceContext()->setKillAllOperations();
// The call is not interrupted.
- Helpers::ensureIndex(&_txn, collection(), BSON("a" << 1), false, "a_1");
+ Helpers::ensureIndex(&_txn, collection(), BSON("a" << 1), kIndexVersion, false, "a_1");
// only want to interrupt the index build
getGlobalServiceContext()->unsetKillAllOperations();
// The new index is listed in getIndexSpecs because the index build completed.
@@ -721,7 +739,7 @@ public:
Status IndexBuildBase::createIndex(const std::string& dbname, const BSONObj& indexSpec) {
MultiIndexBlock indexer(&_txn, collection());
- Status status = indexer.init(indexSpec);
+ Status status = indexer.init(indexSpec).getStatus();
if (status == ErrorCodes::IndexAlreadyExists) {
return Status::OK();
}
@@ -750,7 +768,9 @@ public:
<< "ns"
<< _ns
<< "key"
- << BSON("x" << 1 << "y" << 1))));
+ << BSON("x" << 1 << "y" << 1)
+ << "v"
+ << static_cast<int>(kIndexVersion))));
}
};
@@ -767,7 +787,9 @@ public:
<< "unique"
<< true
<< "key"
- << BSON("x" << 1 << "y" << 1))));
+ << BSON("x" << 1 << "y" << 1)
+ << "v"
+ << static_cast<int>(kIndexVersion))));
}
};
@@ -780,7 +802,9 @@ public:
<< "ns"
<< _ns
<< "key"
- << BSON("x" << 1 << "y" << 1))));
+ << BSON("x" << 1 << "y" << 1)
+ << "v"
+ << static_cast<int>(kIndexVersion))));
}
};
@@ -795,7 +819,9 @@ public:
<< "ns"
<< _ns
<< "key"
- << BSON("y" << 1 << "x" << 1))));
+ << BSON("y" << 1 << "x" << 1)
+ << "v"
+ << static_cast<int>(kIndexVersion))));
}
};
@@ -818,7 +844,9 @@ public:
<< 3600
<< "key"
<< BSON("superIdx"
- << "2d"))));
+ << "2d")
+ << "v"
+ << static_cast<int>(kIndexVersion))));
}
};
@@ -840,7 +868,9 @@ public:
<< 1
<< "key"
<< BSON("superIdx"
- << "2d"))));
+ << "2d")
+ << "v"
+ << static_cast<int>(kIndexVersion))));
}
};
@@ -864,7 +894,9 @@ public:
<< 3600
<< "key"
<< BSON("superIdx"
- << "2d"))));
+ << "2d")
+ << "v"
+ << static_cast<int>(kIndexVersion))));
}
};
@@ -887,7 +919,9 @@ public:
<< 3600
<< "key"
<< BSON("superIdx"
- << "2d"))));
+ << "2d")
+ << "v"
+ << static_cast<int>(kIndexVersion))));
}
};
@@ -908,7 +942,9 @@ public:
<< 2400
<< "key"
<< BSON("superIdx"
- << "2d"))));
+ << "2d")
+ << "v"
+ << static_cast<int>(kIndexVersion))));
}
};
@@ -959,6 +995,8 @@ protected:
<< _ns
<< "key"
<< BSON("a" << 1)
+ << "v"
+ << static_cast<int>(kIndexVersion)
<< "storageEngine"
<< storageEngineValue);
}
diff --git a/src/mongo/dbtests/multikey_paths_test.cpp b/src/mongo/dbtests/multikey_paths_test.cpp
index ccbaa741983..b9ad16ce17b 100644
--- a/src/mongo/dbtests/multikey_paths_test.cpp
+++ b/src/mongo/dbtests/multikey_paths_test.cpp
@@ -34,6 +34,7 @@
#include "mongo/db/catalog/index_create.h"
#include "mongo/db/client.h"
#include "mongo/db/db_raii.h"
+#include "mongo/db/index/index_descriptor.h"
#include "mongo/db/index/multikey_paths.h"
#include "mongo/db/namespace_string.h"
#include "mongo/db/service_context.h"
@@ -44,6 +45,8 @@
namespace mongo {
namespace {
+const auto kIndexVersion = IndexDescriptor::IndexVersion::kV2;
+
/**
* Fixture for testing correctness of multikey paths.
*
@@ -157,7 +160,9 @@ TEST_F(MultikeyPathsTest, PathsUpdatedOnIndexCreation) {
<< "ns"
<< _nss.ns()
<< "key"
- << keyPattern));
+ << keyPattern
+ << "v"
+ << static_cast<int>(kIndexVersion)));
assertMultikeyPaths(collection, keyPattern, {std::set<size_t>{}, {0U}});
}
@@ -191,7 +196,9 @@ TEST_F(MultikeyPathsTest, PathsUpdatedOnIndexCreationWithMultipleDocuments) {
<< "ns"
<< _nss.ns()
<< "key"
- << keyPattern));
+ << keyPattern
+ << "v"
+ << static_cast<int>(kIndexVersion)));
assertMultikeyPaths(collection, keyPattern, {{0U}, {0U}});
}
@@ -208,7 +215,9 @@ TEST_F(MultikeyPathsTest, PathsUpdatedOnDocumentInsert) {
<< "ns"
<< _nss.ns()
<< "key"
- << keyPattern));
+ << keyPattern
+ << "v"
+ << static_cast<int>(kIndexVersion)));
{
WriteUnitOfWork wuow(_opCtx.get());
@@ -251,7 +260,9 @@ TEST_F(MultikeyPathsTest, PathsUpdatedOnDocumentUpdate) {
<< "ns"
<< _nss.ns()
<< "key"
- << keyPattern));
+ << keyPattern
+ << "v"
+ << static_cast<int>(kIndexVersion)));
{
WriteUnitOfWork wuow(_opCtx.get());
@@ -304,7 +315,9 @@ TEST_F(MultikeyPathsTest, PathsNotUpdatedOnDocumentDelete) {
<< "ns"
<< _nss.ns()
<< "key"
- << keyPattern));
+ << keyPattern
+ << "v"
+ << static_cast<int>(kIndexVersion)));
{
WriteUnitOfWork wuow(_opCtx.get());
@@ -348,7 +361,9 @@ TEST_F(MultikeyPathsTest, PathsUpdatedForMultipleIndexesOnDocumentInsert) {
<< "ns"
<< _nss.ns()
<< "key"
- << keyPatternAB));
+ << keyPatternAB
+ << "v"
+ << static_cast<int>(kIndexVersion)));
BSONObj keyPatternAC = BSON("a" << 1 << "c" << 1);
createIndex(collection,
@@ -357,7 +372,9 @@ TEST_F(MultikeyPathsTest, PathsUpdatedForMultipleIndexesOnDocumentInsert) {
<< "ns"
<< _nss.ns()
<< "key"
- << keyPatternAC));
+ << keyPatternAC
+ << "v"
+ << static_cast<int>(kIndexVersion)));
{
WriteUnitOfWork wuow(_opCtx.get());
OpDebug* const nullOpDebug = nullptr;
diff --git a/src/mongo/dbtests/query_stage_ixscan.cpp b/src/mongo/dbtests/query_stage_ixscan.cpp
index 3d22cf19fd9..7ad4e1a0b84 100644
--- a/src/mongo/dbtests/query_stage_ixscan.cpp
+++ b/src/mongo/dbtests/query_stage_ixscan.cpp
@@ -32,11 +32,15 @@
#include "mongo/db/db_raii.h"
#include "mongo/db/exec/index_scan.h"
#include "mongo/db/exec/working_set.h"
+#include "mongo/db/index/index_descriptor.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/json.h"
#include "mongo/dbtests/dbtests.h"
namespace QueryStageIxscan {
+namespace {
+const auto kIndexVersion = IndexDescriptor::IndexVersion::kV2;
+} // namespace
class IndexScanTest {
public:
@@ -57,7 +61,9 @@ public:
ASSERT_OK(_coll->getIndexCatalog()->createIndexOnEmptyCollection(
&_txn,
BSON("ns" << ns() << "key" << BSON("x" << 1) << "name"
- << DBClientBase::genIndexName(BSON("x" << 1)))));
+ << DBClientBase::genIndexName(BSON("x" << 1))
+ << "v"
+ << static_cast<int>(kIndexVersion))));
wunit.commit();
}
diff --git a/src/mongo/dbtests/querytests.cpp b/src/mongo/dbtests/querytests.cpp
index 888d9bd4454..de55f54f45d 100644
--- a/src/mongo/dbtests/querytests.cpp
+++ b/src/mongo/dbtests/querytests.cpp
@@ -40,6 +40,7 @@
#include "mongo/db/dbdirectclient.h"
#include "mongo/db/dbhelpers.h"
#include "mongo/db/global_timestamp.h"
+#include "mongo/db/index/index_descriptor.h"
#include "mongo/db/json.h"
#include "mongo/db/lasterror.h"
#include "mongo/db/query/find.h"
@@ -56,6 +57,10 @@ using std::endl;
using std::string;
using std::vector;
+namespace {
+const auto kIndexVersion = IndexDescriptor::IndexVersion::kV2;
+} // namespace
+
class Base {
public:
Base() : _scopedXact(&_txn, MODE_X), _lk(_txn.lockState()), _context(&_txn, ns()) {
@@ -89,7 +94,8 @@ protected:
}
void addIndex(const BSONObj& key) {
- Helpers::ensureIndex(&_txn, _collection, key, false, key.firstElementFieldName());
+ Helpers::ensureIndex(
+ &_txn, _collection, key, kIndexVersion, false, key.firstElementFieldName());
}
void insert(const char* s) {
diff --git a/src/mongo/dbtests/rollbacktests.cpp b/src/mongo/dbtests/rollbacktests.cpp
index 99d90fec617..0986db98aa6 100644
--- a/src/mongo/dbtests/rollbacktests.cpp
+++ b/src/mongo/dbtests/rollbacktests.cpp
@@ -36,6 +36,7 @@
#include "mongo/db/catalog/index_create.h"
#include "mongo/db/client.h"
#include "mongo/db/db_raii.h"
+#include "mongo/db/index/index_descriptor.h"
#include "mongo/db/record_id.h"
#include "mongo/dbtests/dbtests.h"
#include "mongo/unittest/unittest.h"
@@ -47,6 +48,8 @@ using std::string;
namespace RollbackTests {
namespace {
+const auto kIndexVersion = IndexDescriptor::IndexVersion::kV2;
+
void dropDatabase(OperationContext* txn, const NamespaceString& nss) {
ScopedTransaction transaction(txn, MODE_X);
Lock::GlobalWrite globalWriteLock(txn->lockState());
@@ -477,7 +480,8 @@ public:
IndexCatalog* catalog = coll->getIndexCatalog();
string idxName = "a";
- BSONObj spec = BSON("ns" << ns << "key" << BSON("a" << 1) << "name" << idxName);
+ BSONObj spec = BSON("ns" << ns << "key" << BSON("a" << 1) << "name" << idxName << "v"
+ << static_cast<int>(kIndexVersion));
// END SETUP / START TEST
@@ -518,7 +522,8 @@ public:
IndexCatalog* catalog = coll->getIndexCatalog();
string idxName = "a";
- BSONObj spec = BSON("ns" << ns << "key" << BSON("a" << 1) << "name" << idxName);
+ BSONObj spec = BSON("ns" << ns << "key" << BSON("a" << 1) << "name" << idxName << "v"
+ << static_cast<int>(kIndexVersion));
{
WriteUnitOfWork uow(&txn);
@@ -571,7 +576,8 @@ public:
IndexCatalog* catalog = coll->getIndexCatalog();
string idxName = "a";
- BSONObj spec = BSON("ns" << ns << "key" << BSON("a" << 1) << "name" << idxName);
+ BSONObj spec = BSON("ns" << ns << "key" << BSON("a" << 1) << "name" << idxName << "v"
+ << static_cast<int>(kIndexVersion));
// END SETUP / START TEST
@@ -615,7 +621,8 @@ public:
IndexCatalog* catalog = coll->getIndexCatalog();
string idxName = "a";
- BSONObj spec = BSON("ns" << ns << "key" << BSON("a" << 1) << "name" << idxName);
+ BSONObj spec = BSON("ns" << ns << "key" << BSON("a" << 1) << "name" << idxName << "v"
+ << static_cast<int>(kIndexVersion));
{
WriteUnitOfWork uow(&txn);
@@ -677,9 +684,12 @@ public:
string idxNameA = "indexA";
string idxNameB = "indexB";
string idxNameC = "indexC";
- BSONObj specA = BSON("ns" << ns << "key" << BSON("a" << 1) << "name" << idxNameA);
- BSONObj specB = BSON("ns" << ns << "key" << BSON("b" << 1) << "name" << idxNameB);
- BSONObj specC = BSON("ns" << ns << "key" << BSON("c" << 1) << "name" << idxNameC);
+ BSONObj specA = BSON("ns" << ns << "key" << BSON("a" << 1) << "name" << idxNameA << "v"
+ << static_cast<int>(kIndexVersion));
+ BSONObj specB = BSON("ns" << ns << "key" << BSON("b" << 1) << "name" << idxNameB << "v"
+ << static_cast<int>(kIndexVersion));
+ BSONObj specC = BSON("ns" << ns << "key" << BSON("c" << 1) << "name" << idxNameC << "v"
+ << static_cast<int>(kIndexVersion));
// END SETUP / START TEST
diff --git a/src/mongo/dbtests/validate_tests.cpp b/src/mongo/dbtests/validate_tests.cpp
index 14da85c8844..3eb1706fbce 100644
--- a/src/mongo/dbtests/validate_tests.cpp
+++ b/src/mongo/dbtests/validate_tests.cpp
@@ -46,6 +46,10 @@ namespace ValidateTests {
using std::unique_ptr;
+namespace {
+const auto kIndexVersion = IndexDescriptor::IndexVersion::kV2;
+} // namespace
+
static const char* const _ns = "unittests.validate_tests";
/**
@@ -175,6 +179,8 @@ public:
<< coll->ns().ns()
<< "key"
<< BSON("a" << 1)
+ << "v"
+ << static_cast<int>(kIndexVersion)
<< "background"
<< false));
@@ -236,6 +242,8 @@ public:
<< coll->ns().ns()
<< "key"
<< BSON("a" << 1)
+ << "v"
+ << static_cast<int>(kIndexVersion)
<< "background"
<< false));
@@ -369,6 +377,8 @@ public:
<< coll->ns().ns()
<< "key"
<< BSON("a.b" << 1)
+ << "v"
+ << static_cast<int>(kIndexVersion)
<< "background"
<< false));
@@ -433,6 +443,8 @@ public:
<< coll->ns().ns()
<< "key"
<< BSON("a" << 1)
+ << "v"
+ << static_cast<int>(kIndexVersion)
<< "background"
<< false
<< "sparse"
@@ -491,6 +503,8 @@ public:
<< coll->ns().ns()
<< "key"
<< BSON("a" << 1)
+ << "v"
+ << static_cast<int>(kIndexVersion)
<< "background"
<< false
<< "partialFilterExpression"
@@ -545,6 +559,8 @@ public:
<< "key"
<< BSON("x"
<< "2dsphere")
+ << "v"
+ << static_cast<int>(kIndexVersion)
<< "background"
<< false
<< "partialFilterExpression"
@@ -561,6 +577,8 @@ public:
<< "key"
<< BSON("x"
<< "2dsphere")
+ << "v"
+ << static_cast<int>(kIndexVersion)
<< "background"
<< false
<< "partialFilterExpression"
@@ -606,6 +624,8 @@ public:
<< coll->ns().ns()
<< "key"
<< BSON("a" << 1 << "b" << -1)
+ << "v"
+ << static_cast<int>(kIndexVersion)
<< "background"
<< false));
ASSERT_OK(status);
@@ -618,6 +638,8 @@ public:
<< coll->ns().ns()
<< "key"
<< BSON("a" << -1 << "b" << 1)
+ << "v"
+ << static_cast<int>(kIndexVersion)
<< "background"
<< false));
@@ -666,7 +688,8 @@ public:
auto status = dbtests::createIndexFromSpec(
&_txn,
coll->ns().ns(),
- BSON("name" << indexName << "ns" << coll->ns().ns() << "key" << BSON("a" << 1)
+ BSON("name" << indexName << "ns" << coll->ns().ns() << "key" << BSON("a" << 1) << "v"
+ << static_cast<int>(kIndexVersion)
<< "background"
<< false));
@@ -727,7 +750,8 @@ public:
auto status = dbtests::createIndexFromSpec(
&_txn,
coll->ns().ns(),
- BSON("name" << indexName << "ns" << coll->ns().ns() << "key" << BSON("a" << 1)
+ BSON("name" << indexName << "ns" << coll->ns().ns() << "key" << BSON("a" << 1) << "v"
+ << static_cast<int>(kIndexVersion)
<< "background"
<< false));