summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLouis Williams <louis.williams@mongodb.com>2019-12-03 18:51:41 +0000
committerevergreen <evergreen@mongodb.com>2019-12-03 18:51:41 +0000
commitbc4cc10370b73f9d68a5c42150d902429e9fdb2d (patch)
tree2eb492038e71b5ba8987a922c472963c6ad69882
parentb6ac293367958a23b5fae41f0a8265c985856a42 (diff)
downloadmongo-bc4cc10370b73f9d68a5c42150d902429e9fdb2d.tar.gz
SERVER-44428 Remove unused durable catalog fields for simultaneous indexes
-rw-r--r--src/mongo/db/storage/bson_collection_catalog_entry.cpp24
-rw-r--r--src/mongo/db/storage/bson_collection_catalog_entry.h9
-rw-r--r--src/mongo/db/storage/durable_catalog.h56
-rw-r--r--src/mongo/db/storage/durable_catalog_impl.cpp95
-rw-r--r--src/mongo/db/storage/durable_catalog_impl.h33
-rw-r--r--src/mongo/db/storage/kv/durable_catalog_test.cpp86
-rw-r--r--src/mongo/db/storage/storage_engine_impl.cpp26
7 files changed, 6 insertions, 323 deletions
diff --git a/src/mongo/db/storage/bson_collection_catalog_entry.cpp b/src/mongo/db/storage/bson_collection_catalog_entry.cpp
index f68b4962e53..1e016ff8f40 100644
--- a/src/mongo/db/storage/bson_collection_catalog_entry.cpp
+++ b/src/mongo/db/storage/bson_collection_catalog_entry.cpp
@@ -199,20 +199,9 @@ BSONObj BSONCollectionCatalogEntry::MetaData::toBSON() const {
sub.append("prefix", indexes[i].prefix.toBSONValue());
sub.append("backgroundSecondary", indexes[i].isBackgroundSecondaryBuild);
- sub.append("runTwoPhaseBuild", indexes[i].runTwoPhaseBuild);
- sub.append("versionOfBuild", static_cast<long long>(indexes[i].versionOfBuild));
- if (indexes[i].buildPhase) {
- sub.append("buildPhase", *indexes[i].buildPhase);
- }
if (indexes[i].buildUUID) {
indexes[i].buildUUID->appendToBuilder(&sub, "buildUUID");
}
- if (indexes[i].constraintViolationsIdent) {
- sub.append("constraintViolationsIdent", *indexes[i].constraintViolationsIdent);
- }
- if (indexes[i].sideWritesIdent) {
- sub.append("sideWritesIdent", *indexes[i].sideWritesIdent);
- }
sub.doneFast();
}
arr.doneFast();
@@ -248,22 +237,9 @@ void BSONCollectionCatalogEntry::MetaData::parse(const BSONObj& obj) {
// Opt-in to rebuilding behavior for old-format index catalog objects.
imd.isBackgroundSecondaryBuild = bgSecondary.eoo() || bgSecondary.trueValue();
- imd.runTwoPhaseBuild = idx["runTwoPhaseBuild"].trueValue();
- if (idx.hasField("versionOfBuild")) {
- imd.versionOfBuild = idx["versionOfBuild"].numberLong();
- }
- if (idx["buildPhase"]) {
- imd.buildPhase = idx["buildPhase"].str();
- }
if (idx["buildUUID"]) {
imd.buildUUID = fassert(31353, UUID::parse(idx["buildUUID"]));
}
- if (idx["constraintViolationsIdent"]) {
- imd.constraintViolationsIdent = idx["constraintViolationsIdent"].str();
- }
- if (idx["sideWritesIdent"]) {
- imd.sideWritesIdent = idx["sideWritesIdent"].str();
- }
indexes.push_back(imd);
}
}
diff --git a/src/mongo/db/storage/bson_collection_catalog_entry.h b/src/mongo/db/storage/bson_collection_catalog_entry.h
index a33e472d8ef..9bb34165636 100644
--- a/src/mongo/db/storage/bson_collection_catalog_entry.h
+++ b/src/mongo/db/storage/bson_collection_catalog_entry.h
@@ -73,14 +73,9 @@ public:
bool multikey = false;
KVPrefix prefix = KVPrefix::kNotPrefixed;
bool isBackgroundSecondaryBuild = false;
- boost::optional<UUID> buildUUID;
- long versionOfBuild = kIndexBuildVersion;
- // If true, a two-phase index build is in progress, false otherwise.
- bool runTwoPhaseBuild = false;
- boost::optional<std::string> buildPhase;
- boost::optional<std::string> constraintViolationsIdent;
- boost::optional<std::string> sideWritesIdent;
+ // If initialized, a two-phase index build is in progress.
+ boost::optional<UUID> buildUUID;
// If non-empty, 'multikeyPaths' is a vector with size equal to the number of elements in
// the index key pattern. Each element in the vector is an ordered set of positions
diff --git a/src/mongo/db/storage/durable_catalog.h b/src/mongo/db/storage/durable_catalog.h
index 48d792f13f6..815e0e3a262 100644
--- a/src/mongo/db/storage/durable_catalog.h
+++ b/src/mongo/db/storage/durable_catalog.h
@@ -163,10 +163,6 @@ public:
*/
virtual void setIsTemp(OperationContext* opCtx, RecordId catalogId, bool isTemp) = 0;
- virtual boost::optional<std::string> getSideWritesIdent(OperationContext* opCtx,
- RecordId catalogId,
- StringData indexName) const = 0;
-
/**
* Updates the validator for this collection.
*
@@ -195,53 +191,13 @@ public:
bool isBackgroundSecondaryBuild) = 0;
/**
- * Returns whether or not the index is being built with the two-phase index build procedure.
- */
- virtual bool isTwoPhaseIndexBuild(OperationContext* opCtx,
- RecordId catalogId,
- StringData indexName) const = 0;
-
- /**
- * Indicate that a build index is now in the "scanning" phase of a hybrid index build. The
- * 'constraintViolationsIdent' is only used for unique indexes.
- *
- * It is only valid to call this when the index is using the kTwoPhase IndexBuildProtocol.
+ * Returns a UUID if the index is being built with the two-phase index build procedure.
*/
- virtual void setIndexBuildScanning(OperationContext* opCtx,
- RecordId catalogId,
- StringData indexName,
- std::string sideWritesIdent,
- boost::optional<std::string> constraintViolationsIdent) = 0;
-
-
virtual boost::optional<UUID> getIndexBuildUUID(OperationContext* opCtx,
RecordId catalogId,
StringData indexName) const = 0;
/**
- * Returns whether or not this index is building in the "scanning" phase.
- */
- virtual bool isIndexBuildScanning(OperationContext* opCtx,
- RecordId catalogId,
- StringData indexName) const = 0;
-
- /**
- * Indicate that a build index is now in the "draining" phase of a hybrid index build.
- *
- * It is only valid to call this when the index is using the kTwoPhase IndexBuildProtocol.
- */
- virtual void setIndexBuildDraining(OperationContext* opCtx,
- RecordId catalogId,
- StringData indexName) = 0;
-
- /**
- * Returns whether or not this index is building in the "draining" phase.
- */
- virtual bool isIndexBuildDraining(OperationContext* opCtx,
- RecordId catalogId,
- StringData indexName) const = 0;
-
- /**
* Indicate that an index build is completed and the index is ready to use.
*/
virtual void indexBuildSuccess(OperationContext* opCtx,
@@ -278,16 +234,6 @@ public:
StringData indexName,
const MultikeyPaths& multikeyPaths) = 0;
- virtual boost::optional<std::string> getConstraintViolationsIdent(
- OperationContext* opCtx, RecordId catalogId, StringData indexName) const = 0;
-
- /**
- * Returns the server-compatibility version of the index build procedure.
- */
- virtual long getIndexBuildVersion(OperationContext* opCtx,
- RecordId catalogId,
- StringData indexName) const = 0;
-
virtual CollectionOptions getCollectionOptions(OperationContext* opCtx,
RecordId catalogId) const = 0;
diff --git a/src/mongo/db/storage/durable_catalog_impl.cpp b/src/mongo/db/storage/durable_catalog_impl.cpp
index 49e4c3fa52b..dcbc40a8886 100644
--- a/src/mongo/db/storage/durable_catalog_impl.cpp
+++ b/src/mongo/db/storage/durable_catalog_impl.cpp
@@ -906,15 +906,6 @@ void DurableCatalogImpl::setIsTemp(OperationContext* opCtx, RecordId catalogId,
putMetaData(opCtx, catalogId, md);
}
-boost::optional<std::string> DurableCatalogImpl::getSideWritesIdent(OperationContext* opCtx,
- RecordId catalogId,
- StringData indexName) const {
- BSONCollectionCatalogEntry::MetaData md = getMetaData(opCtx, catalogId);
- int offset = md.findIndexOffset(indexName);
- invariant(offset >= 0);
- return md.indexes[offset].sideWritesIdent;
-}
-
void DurableCatalogImpl::updateValidator(OperationContext* opCtx,
RecordId catalogId,
const BSONObj& validator,
@@ -960,7 +951,6 @@ Status DurableCatalogImpl::prepareForIndexBuild(OperationContext* opCtx,
imd.multikey = false;
imd.prefix = prefix;
imd.isBackgroundSecondaryBuild = isBackgroundSecondaryBuild;
- imd.runTwoPhaseBuild = buildUUID.is_initialized();
imd.buildUUID = buildUUID;
if (indexTypeSupportsPathLevelMultikeyTracking(spec->getAccessMethodName())) {
@@ -995,15 +985,6 @@ Status DurableCatalogImpl::prepareForIndexBuild(OperationContext* opCtx,
return status;
}
-bool DurableCatalogImpl::isTwoPhaseIndexBuild(OperationContext* opCtx,
- RecordId catalogId,
- StringData indexName) const {
- BSONCollectionCatalogEntry::MetaData md = getMetaData(opCtx, catalogId);
- int offset = md.findIndexOffset(indexName);
- invariant(offset >= 0);
- return md.indexes[offset].runTwoPhaseBuild;
-}
-
boost::optional<UUID> DurableCatalogImpl::getIndexBuildUUID(OperationContext* opCtx,
RecordId catalogId,
StringData indexName) const {
@@ -1013,60 +994,6 @@ boost::optional<UUID> DurableCatalogImpl::getIndexBuildUUID(OperationContext* op
return md.indexes[offset].buildUUID;
}
-void DurableCatalogImpl::setIndexBuildScanning(
- OperationContext* opCtx,
- RecordId catalogId,
- StringData indexName,
- std::string sideWritesIdent,
- boost::optional<std::string> constraintViolationsIdent) {
- BSONCollectionCatalogEntry::MetaData md = getMetaData(opCtx, catalogId);
- int offset = md.findIndexOffset(indexName);
- invariant(offset >= 0);
- invariant(!md.indexes[offset].ready);
- invariant(!md.indexes[offset].buildPhase);
- invariant(md.indexes[offset].runTwoPhaseBuild);
-
- md.indexes[offset].buildPhase = BSONCollectionCatalogEntry::kIndexBuildScanning.toString();
- md.indexes[offset].sideWritesIdent = sideWritesIdent;
- md.indexes[offset].constraintViolationsIdent = constraintViolationsIdent;
- putMetaData(opCtx, catalogId, md);
-}
-
-bool DurableCatalogImpl::isIndexBuildScanning(OperationContext* opCtx,
- RecordId catalogId,
- StringData indexName) const {
- BSONCollectionCatalogEntry::MetaData md = getMetaData(opCtx, catalogId);
- int offset = md.findIndexOffset(indexName);
- invariant(offset >= 0);
- return md.indexes[offset].buildPhase ==
- BSONCollectionCatalogEntry::kIndexBuildScanning.toString();
-}
-
-void DurableCatalogImpl::setIndexBuildDraining(OperationContext* opCtx,
- RecordId catalogId,
- StringData indexName) {
- BSONCollectionCatalogEntry::MetaData md = getMetaData(opCtx, catalogId);
- int offset = md.findIndexOffset(indexName);
- invariant(offset >= 0);
- invariant(!md.indexes[offset].ready);
- invariant(md.indexes[offset].runTwoPhaseBuild);
- invariant(md.indexes[offset].buildPhase ==
- BSONCollectionCatalogEntry::kIndexBuildScanning.toString());
-
- md.indexes[offset].buildPhase = BSONCollectionCatalogEntry::kIndexBuildDraining.toString();
- putMetaData(opCtx, catalogId, md);
-}
-
-bool DurableCatalogImpl::isIndexBuildDraining(OperationContext* opCtx,
- RecordId catalogId,
- StringData indexName) const {
- BSONCollectionCatalogEntry::MetaData md = getMetaData(opCtx, catalogId);
- int offset = md.findIndexOffset(indexName);
- invariant(offset >= 0);
- return md.indexes[offset].buildPhase ==
- BSONCollectionCatalogEntry::kIndexBuildDraining.toString();
-}
-
void DurableCatalogImpl::indexBuildSuccess(OperationContext* opCtx,
RecordId catalogId,
StringData indexName) {
@@ -1074,11 +1001,7 @@ void DurableCatalogImpl::indexBuildSuccess(OperationContext* opCtx,
int offset = md.findIndexOffset(indexName);
invariant(offset >= 0);
md.indexes[offset].ready = true;
- md.indexes[offset].runTwoPhaseBuild = false;
- md.indexes[offset].buildPhase = boost::none;
md.indexes[offset].buildUUID = boost::none;
- md.indexes[offset].sideWritesIdent = boost::none;
- md.indexes[offset].constraintViolationsIdent = boost::none;
putMetaData(opCtx, catalogId, md);
}
@@ -1153,24 +1076,6 @@ bool DurableCatalogImpl::setIndexIsMultikey(OperationContext* opCtx,
return true;
}
-boost::optional<std::string> DurableCatalogImpl::getConstraintViolationsIdent(
- OperationContext* opCtx, RecordId catalogId, StringData indexName) const {
- BSONCollectionCatalogEntry::MetaData md = getMetaData(opCtx, catalogId);
- int offset = md.findIndexOffset(indexName);
- invariant(offset >= 0);
- return md.indexes[offset].constraintViolationsIdent;
-}
-
-
-long DurableCatalogImpl::getIndexBuildVersion(OperationContext* opCtx,
- RecordId catalogId,
- StringData indexName) const {
- BSONCollectionCatalogEntry::MetaData md = getMetaData(opCtx, catalogId);
- int offset = md.findIndexOffset(indexName);
- invariant(offset >= 0);
- return md.indexes[offset].versionOfBuild;
-}
-
CollectionOptions DurableCatalogImpl::getCollectionOptions(OperationContext* opCtx,
RecordId catalogId) const {
BSONCollectionCatalogEntry::MetaData md = getMetaData(opCtx, catalogId);
diff --git a/src/mongo/db/storage/durable_catalog_impl.h b/src/mongo/db/storage/durable_catalog_impl.h
index 07a02b16d27..7e86bb4a308 100644
--- a/src/mongo/db/storage/durable_catalog_impl.h
+++ b/src/mongo/db/storage/durable_catalog_impl.h
@@ -130,10 +130,6 @@ public:
void setIsTemp(OperationContext* opCtx, RecordId catalogId, bool isTemp);
- boost::optional<std::string> getSideWritesIdent(OperationContext* opCtx,
- RecordId catalogId,
- StringData indexName) const;
-
void updateValidator(OperationContext* opCtx,
RecordId catalogId,
const BSONObj& validator,
@@ -148,31 +144,10 @@ public:
boost::optional<UUID> buildUUID,
bool isBackgroundSecondaryBuild);
- bool isTwoPhaseIndexBuild(OperationContext* opCtx,
- RecordId catalogId,
- StringData indexName) const;
-
boost::optional<UUID> getIndexBuildUUID(OperationContext* opCtx,
RecordId catalogId,
StringData indexName) const;
- void setIndexBuildScanning(OperationContext* opCtx,
- RecordId catalogId,
- StringData indexName,
- std::string sideWritesIdent,
- boost::optional<std::string> constraintViolationsIdent);
-
-
- bool isIndexBuildScanning(OperationContext* opCtx,
- RecordId catalogId,
- StringData indexName) const;
-
- void setIndexBuildDraining(OperationContext* opCtx, RecordId catalogId, StringData indexName);
-
- bool isIndexBuildDraining(OperationContext* opCtx,
- RecordId catalogId,
- StringData indexName) const;
-
void indexBuildSuccess(OperationContext* opCtx, RecordId catalogId, StringData indexName);
bool isIndexMultikey(OperationContext* opCtx,
@@ -185,14 +160,6 @@ public:
StringData indexName,
const MultikeyPaths& multikeyPaths);
- boost::optional<std::string> getConstraintViolationsIdent(OperationContext* opCtx,
- RecordId catalogId,
- StringData indexName) const;
-
- long getIndexBuildVersion(OperationContext* opCtx,
- RecordId catalogId,
- StringData indexName) const;
-
CollectionOptions getCollectionOptions(OperationContext* opCtx, RecordId catalogId) const;
int getTotalIndexCount(OperationContext* opCtx, RecordId catalogId) const;
diff --git a/src/mongo/db/storage/kv/durable_catalog_test.cpp b/src/mongo/db/storage/kv/durable_catalog_test.cpp
index c5b5b469f09..5e5b3ceb990 100644
--- a/src/mongo/db/storage/kv/durable_catalog_test.cpp
+++ b/src/mongo/db/storage/kv/durable_catalog_test.cpp
@@ -356,25 +356,13 @@ TEST_F(DurableCatalogTest, SinglePhaseIndexBuild) {
auto opCtx = newOperationContext();
DurableCatalog* catalog = getCatalog();
- ASSERT_EQ(kExpectedVersion,
- catalog->getIndexBuildVersion(opCtx.get(), getCatalogId(), indexName));
ASSERT_FALSE(catalog->isIndexReady(opCtx.get(), getCatalogId(), indexName));
- ASSERT_FALSE(catalog->isTwoPhaseIndexBuild(opCtx.get(), getCatalogId(), indexName));
- ASSERT_FALSE(catalog->isIndexBuildScanning(opCtx.get(), getCatalogId(), indexName));
- ASSERT_FALSE(catalog->isIndexBuildDraining(opCtx.get(), getCatalogId(), indexName));
- ASSERT_FALSE(catalog->getSideWritesIdent(opCtx.get(), getCatalogId(), indexName));
- ASSERT_FALSE(catalog->getConstraintViolationsIdent(opCtx.get(), getCatalogId(), indexName));
+ ASSERT_FALSE(catalog->getIndexBuildUUID(opCtx.get(), getCatalogId(), indexName));
catalog->indexBuildSuccess(opCtx.get(), getCatalogId(), indexName);
- ASSERT_EQ(kExpectedVersion,
- catalog->getIndexBuildVersion(opCtx.get(), getCatalogId(), indexName));
ASSERT_TRUE(catalog->isIndexReady(opCtx.get(), getCatalogId(), indexName));
- ASSERT_FALSE(catalog->isTwoPhaseIndexBuild(opCtx.get(), getCatalogId(), indexName));
- ASSERT_FALSE(catalog->isIndexBuildScanning(opCtx.get(), getCatalogId(), indexName));
- ASSERT_FALSE(catalog->isIndexBuildDraining(opCtx.get(), getCatalogId(), indexName));
- ASSERT_FALSE(catalog->getSideWritesIdent(opCtx.get(), getCatalogId(), indexName));
- ASSERT_FALSE(catalog->getConstraintViolationsIdent(opCtx.get(), getCatalogId(), indexName));
+ ASSERT_FALSE(catalog->getIndexBuildUUID(opCtx.get(), getCatalogId(), indexName));
}
TEST_F(DurableCatalogTest, TwoPhaseIndexBuild) {
@@ -383,80 +371,12 @@ TEST_F(DurableCatalogTest, TwoPhaseIndexBuild) {
auto opCtx = newOperationContext();
DurableCatalog* catalog = getCatalog();
- ASSERT_EQ(kExpectedVersion,
- catalog->getIndexBuildVersion(opCtx.get(), getCatalogId(), indexName));
ASSERT_FALSE(catalog->isIndexReady(opCtx.get(), getCatalogId(), indexName));
- ASSERT_TRUE(catalog->isTwoPhaseIndexBuild(opCtx.get(), getCatalogId(), indexName));
ASSERT_TRUE(catalog->getIndexBuildUUID(opCtx.get(), getCatalogId(), indexName));
- ASSERT_FALSE(catalog->isIndexBuildScanning(opCtx.get(), getCatalogId(), indexName));
- ASSERT_FALSE(catalog->isIndexBuildDraining(opCtx.get(), getCatalogId(), indexName));
- ASSERT_FALSE(catalog->getSideWritesIdent(opCtx.get(), getCatalogId(), indexName));
- ASSERT_FALSE(catalog->getConstraintViolationsIdent(opCtx.get(), getCatalogId(), indexName));
-
- catalog->setIndexBuildScanning(opCtx.get(),
- getCatalogId(),
- indexName,
- kSideWritesTableIdent,
- kConstraintViolationsTableIdent);
-
- ASSERT_EQ(kExpectedVersion,
- catalog->getIndexBuildVersion(opCtx.get(), getCatalogId(), indexName));
- ASSERT_FALSE(catalog->isIndexReady(opCtx.get(), getCatalogId(), indexName));
- ASSERT_TRUE(catalog->isTwoPhaseIndexBuild(opCtx.get(), getCatalogId(), indexName));
- ASSERT_TRUE(catalog->isIndexBuildScanning(opCtx.get(), getCatalogId(), indexName));
- ASSERT_FALSE(catalog->isIndexBuildDraining(opCtx.get(), getCatalogId(), indexName));
- ASSERT_EQ(kSideWritesTableIdent,
- catalog->getSideWritesIdent(opCtx.get(), getCatalogId(), indexName));
- ASSERT_EQ(kConstraintViolationsTableIdent,
- catalog->getConstraintViolationsIdent(opCtx.get(), getCatalogId(), indexName));
-
- catalog->setIndexBuildDraining(opCtx.get(), getCatalogId(), indexName);
-
- ASSERT_EQ(kExpectedVersion,
- catalog->getIndexBuildVersion(opCtx.get(), getCatalogId(), indexName));
- ASSERT_FALSE(catalog->isIndexReady(opCtx.get(), getCatalogId(), indexName));
- ASSERT_TRUE(catalog->isTwoPhaseIndexBuild(opCtx.get(), getCatalogId(), indexName));
- ASSERT_FALSE(catalog->isIndexBuildScanning(opCtx.get(), getCatalogId(), indexName));
- ASSERT_TRUE(catalog->isIndexBuildDraining(opCtx.get(), getCatalogId(), indexName));
- ASSERT_EQ(kSideWritesTableIdent,
- catalog->getSideWritesIdent(opCtx.get(), getCatalogId(), indexName));
- ASSERT_EQ(kConstraintViolationsTableIdent,
- catalog->getConstraintViolationsIdent(opCtx.get(), getCatalogId(), indexName));
-
catalog->indexBuildSuccess(opCtx.get(), getCatalogId(), indexName);
- ASSERT_EQ(kExpectedVersion,
- catalog->getIndexBuildVersion(opCtx.get(), getCatalogId(), indexName));
- ASSERT(catalog->isIndexReady(opCtx.get(), getCatalogId(), indexName));
- ASSERT_FALSE(catalog->isIndexBuildScanning(opCtx.get(), getCatalogId(), indexName));
- ASSERT_FALSE(catalog->isIndexBuildDraining(opCtx.get(), getCatalogId(), indexName));
- ASSERT_FALSE(catalog->isTwoPhaseIndexBuild(opCtx.get(), getCatalogId(), indexName));
+ ASSERT_TRUE(catalog->isIndexReady(opCtx.get(), getCatalogId(), indexName));
ASSERT_FALSE(catalog->getIndexBuildUUID(opCtx.get(), getCatalogId(), indexName));
- ASSERT_FALSE(catalog->getSideWritesIdent(opCtx.get(), getCatalogId(), indexName));
- ASSERT_FALSE(catalog->getConstraintViolationsIdent(opCtx.get(), getCatalogId(), indexName));
-}
-
-DEATH_TEST_F(DurableCatalogTest,
- SinglePhaseIllegalScanPhase,
- "Invariant failure md.indexes[offset].runTwoPhaseBuild") {
- std::string indexName = createIndex(BSON("a" << 1));
- auto opCtx = newOperationContext();
- DurableCatalog* catalog = getCatalog();
-
- catalog->setIndexBuildScanning(opCtx.get(),
- getCatalogId(),
- indexName,
- kSideWritesTableIdent,
- kConstraintViolationsTableIdent);
-}
-
-DEATH_TEST_F(DurableCatalogTest,
- SinglePhaseIllegalDrainPhase,
- "Invariant failure md.indexes[offset].runTwoPhaseBuild") {
- std::string indexName = createIndex(BSON("a" << 1));
- auto opCtx = newOperationContext();
- DurableCatalog* catalog = getCatalog();
- catalog->setIndexBuildDraining(opCtx.get(), getCatalogId(), indexName);
}
DEATH_TEST_F(DurableCatalogTest,
diff --git a/src/mongo/db/storage/storage_engine_impl.cpp b/src/mongo/db/storage/storage_engine_impl.cpp
index 35c838c474a..7f8ea29956a 100644
--- a/src/mongo/db/storage/storage_engine_impl.cpp
+++ b/src/mongo/db/storage/storage_engine_impl.cpp
@@ -451,7 +451,6 @@ StatusWith<StorageEngine::ReconcileResult> StorageEngineImpl::reconcileCatalogAn
// be associated with multiple indexes.
if (indexMetaData.buildUUID) {
invariant(!indexMetaData.ready);
- invariant(indexMetaData.runTwoPhaseBuild);
auto collUUID = metaData.options.uuid;
invariant(collUUID);
@@ -471,31 +470,6 @@ StatusWith<StorageEngine::ReconcileResult> StorageEngineImpl::reconcileCatalogAn
continue;
}
- // If this index was draining, do not delete any internal idents that it may have owned.
- // Instead, the idents can be used later on to resume draining instead of a
- // performing a full rebuild. This is only done for background secondary builds, because
- // the index must be rebuilt, and it is dropped otherwise.
- // TODO: SERVER-37952 Do not drop these idents for background index builds on
- // primaries once index builds are resumable from draining.
- if (!indexMetaData.ready && indexMetaData.isBackgroundSecondaryBuild &&
- indexMetaData.buildPhase ==
- BSONCollectionCatalogEntry::kIndexBuildDraining.toString()) {
-
- if (indexMetaData.constraintViolationsIdent) {
- auto it = internalIdentsToDrop.find(*indexMetaData.constraintViolationsIdent);
- if (it != internalIdentsToDrop.end()) {
- internalIdentsToDrop.erase(it);
- }
- }
-
- if (indexMetaData.sideWritesIdent) {
- auto it = internalIdentsToDrop.find(*indexMetaData.sideWritesIdent);
- if (it != internalIdentsToDrop.end()) {
- internalIdentsToDrop.erase(it);
- }
- }
- }
-
// If the index was kicked off as a background secondary index build, replication
// recovery will not run into the oplog entry to recreate the index. If the index
// table is not found, or the index build did not successfully complete, this code