summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuhong Zhang <yuhong.zhang@mongodb.com>2022-03-28 17:47:18 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-03-28 18:43:51 +0000
commitd5a2caec52c8abefb2fc06e21755fa63f00aa44c (patch)
tree871977062b9ecefbcb4611c50a8ee1a177f9f058
parentd38f89d0438e7135e1e0ab09d032e97de0a41b36 (diff)
downloadmongo-d5a2caec52c8abefb2fc06e21755fa63f00aa44c.tar.gz
Revert "SERVER-61158 IndexCatalog::refreshEntry() can update metadata"
This reverts commit 0e09eec7acc2dae2fab4d131b6b5c6ef1efd44e9.
-rw-r--r--src/mongo/db/catalog/coll_mod.cpp3
-rw-r--r--src/mongo/db/catalog/index_catalog.h3
-rw-r--r--src/mongo/db/catalog/index_catalog_impl.cpp13
-rw-r--r--src/mongo/db/catalog/index_catalog_impl.h6
-rw-r--r--src/mongo/db/catalog/index_catalog_noop.h3
5 files changed, 8 insertions, 20 deletions
diff --git a/src/mongo/db/catalog/coll_mod.cpp b/src/mongo/db/catalog/coll_mod.cpp
index cc153539e6d..040cc631a97 100644
--- a/src/mongo/db/catalog/coll_mod.cpp
+++ b/src/mongo/db/catalog/coll_mod.cpp
@@ -401,9 +401,6 @@ Status _collModInternal(OperationContext* opCtx,
: Seconds(oldExpireSecs.safeNumberLong()),
!cmr.indexUnique ? boost::optional<bool>() : newUnique.booleanSafe(),
cmr.idx->indexName()};
-
- // Notify the index catalog that the definition of this index changed.
- cmr.idx = coll->getIndexCatalog()->refreshEntry(opCtx, cmr.idx, !cmr.indexUnique.eoo());
}
if (cmr.collValidator) {
diff --git a/src/mongo/db/catalog/index_catalog.h b/src/mongo/db/catalog/index_catalog.h
index 5e6141b7469..eb2dfc2dc41 100644
--- a/src/mongo/db/catalog/index_catalog.h
+++ b/src/mongo/db/catalog/index_catalog.h
@@ -308,8 +308,7 @@ public:
* on the collection.
*/
virtual const IndexDescriptor* refreshEntry(OperationContext* const opCtx,
- const IndexDescriptor* const oldDesc,
- bool updateMetadata = false) = 0;
+ const IndexDescriptor* const oldDesc) = 0;
/**
* Returns a pointer to the index catalog entry associated with 'desc'. Throws if there is no
diff --git a/src/mongo/db/catalog/index_catalog_impl.cpp b/src/mongo/db/catalog/index_catalog_impl.cpp
index a5d0b1e99dc..96eb1ddd835 100644
--- a/src/mongo/db/catalog/index_catalog_impl.cpp
+++ b/src/mongo/db/catalog/index_catalog_impl.cpp
@@ -139,8 +139,7 @@ IndexCatalogEntry* IndexCatalogImpl::_setupInMemoryStructures(
OperationContext* opCtx,
std::unique_ptr<IndexDescriptor> descriptor,
bool initFromDisk,
- bool isReadyIndex,
- bool updateMetadata) {
+ bool isReadyIndex) {
Status status = _isSpecOk(opCtx, descriptor->infoObj());
if (!status.isOK()) {
severe() << "Found an invalid index " << descriptor->infoObj() << " on the "
@@ -158,9 +157,6 @@ IndexCatalogEntry* IndexCatalogImpl::_setupInMemoryStructures(
DurableCatalog::get(opCtx)->getIndexIdent(opCtx, _collection->ns(), desc->indexName());
auto engine = opCtx->getServiceContext()->getStorageEngine();
- if (updateMetadata) {
- engine->getEngine()->alterIdentMetadata(opCtx, ident, desc);
- }
SortedDataInterface* sdi =
engine->getEngine()->getGroupedSortedDataInterface(opCtx, ident, desc, entry->getPrefix());
@@ -1246,8 +1242,7 @@ std::vector<std::shared_ptr<const IndexCatalogEntry>> IndexCatalogImpl::getAllRe
}
const IndexDescriptor* IndexCatalogImpl::refreshEntry(OperationContext* opCtx,
- const IndexDescriptor* oldDesc,
- bool updateMetadata) {
+ const IndexDescriptor* oldDesc) {
invariant(opCtx->lockState()->isCollectionLockedForMode(_collection->ns(), MODE_X));
invariant(_buildingIndexes.size() == 0);
@@ -1274,8 +1269,8 @@ const IndexDescriptor* IndexCatalogImpl::refreshEntry(OperationContext* opCtx,
stdx::make_unique<IndexDescriptor>(_collection, _getAccessMethodName(keyPattern), spec);
const bool initFromDisk = false;
const bool isReadyIndex = true;
- const IndexCatalogEntry* newEntry = _setupInMemoryStructures(
- opCtx, std::move(newDesc), initFromDisk, isReadyIndex, updateMetadata);
+ const IndexCatalogEntry* newEntry =
+ _setupInMemoryStructures(opCtx, std::move(newDesc), initFromDisk, isReadyIndex);
invariant(newEntry->isReady(opCtx));
_collection->infoCache()->addedIndex(opCtx, newEntry->descriptor());
diff --git a/src/mongo/db/catalog/index_catalog_impl.h b/src/mongo/db/catalog/index_catalog_impl.h
index 69501e2917a..be525335b16 100644
--- a/src/mongo/db/catalog/index_catalog_impl.h
+++ b/src/mongo/db/catalog/index_catalog_impl.h
@@ -160,8 +160,7 @@ public:
* on the collection.
*/
const IndexDescriptor* refreshEntry(OperationContext* opCtx,
- const IndexDescriptor* oldDesc,
- bool updateMetadata = false) override;
+ const IndexDescriptor* oldDesc) override;
const IndexCatalogEntry* getEntry(const IndexDescriptor* desc) const override;
@@ -450,8 +449,7 @@ private:
IndexCatalogEntry* _setupInMemoryStructures(OperationContext* opCtx,
std::unique_ptr<IndexDescriptor> descriptor,
bool initFromDisk,
- bool isReadyIndex,
- bool updateMetadata = false);
+ bool isReadyIndex);
/**
* Applies a set of transformations to the user-provided index object 'spec' to make it
diff --git a/src/mongo/db/catalog/index_catalog_noop.h b/src/mongo/db/catalog/index_catalog_noop.h
index 39d7f1744a2..95414148792 100644
--- a/src/mongo/db/catalog/index_catalog_noop.h
+++ b/src/mongo/db/catalog/index_catalog_noop.h
@@ -111,8 +111,7 @@ public:
const bool includeUnfinishedIndexes = false) const override {}
const IndexDescriptor* refreshEntry(OperationContext* const opCtx,
- const IndexDescriptor* const oldDesc,
- bool updateMetadata = false) override {
+ const IndexDescriptor* const oldDesc) override {
return nullptr;
}