summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2021-05-18 19:29:10 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-08-10 17:41:58 +0000
commit8a9094b569292ec593f977eb623bf1ff7a48094a (patch)
tree0cf8c30b979c5829258f206de4c70d77fa5b77c4 /src
parente0bf79a726450ef5594c704d79ce73ca32f4049a (diff)
downloadmongo-8a9094b569292ec593f977eb623bf1ff7a48094a.tar.gz
SERVER-56877 rename IndexCatalogEntryImpl::_indexMultikeyPaths to _indexMultikeyPathsForRead
(cherry picked from commit 262036ae4b0219c229ff38c644a1e10487e7a586)
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/catalog/index_catalog_entry_impl.cpp16
-rw-r--r--src/mongo/db/catalog/index_catalog_entry_impl.h11
2 files changed, 14 insertions, 13 deletions
diff --git a/src/mongo/db/catalog/index_catalog_entry_impl.cpp b/src/mongo/db/catalog/index_catalog_entry_impl.cpp
index f1dc1c1c8ef..d2d570c456b 100644
--- a/src/mongo/db/catalog/index_catalog_entry_impl.cpp
+++ b/src/mongo/db/catalog/index_catalog_entry_impl.cpp
@@ -81,10 +81,10 @@ IndexCatalogEntryImpl::IndexCatalogEntryImpl(OperationContext* const opCtx,
{
stdx::lock_guard<Latch> lk(_indexMultikeyPathsMutex);
- const bool isMultikey = _catalogIsMultikey(opCtx, &_indexMultikeyPaths);
+ const bool isMultikey = _catalogIsMultikey(opCtx, &_indexMultikeyPathsForRead);
_isMultikeyForRead.store(isMultikey);
_isMultikeyForWrite.store(isMultikey);
- _indexTracksMultikeyPathsInCatalog = !_indexMultikeyPaths.empty();
+ _indexTracksMultikeyPathsInCatalog = !_indexMultikeyPathsForRead.empty();
}
const BSONObj& collation = _descriptor->collation();
@@ -166,7 +166,7 @@ bool IndexCatalogEntryImpl::isMultikey() const {
MultikeyPaths IndexCatalogEntryImpl::getMultikeyPaths(OperationContext* opCtx) const {
stdx::lock_guard<Latch> lk(_indexMultikeyPathsMutex);
- return _indexMultikeyPaths;
+ return _indexMultikeyPathsForRead;
}
// ---
@@ -196,12 +196,12 @@ void IndexCatalogEntryImpl::setMultikey(OperationContext* opCtx,
if (_indexTracksMultikeyPathsInCatalog) {
stdx::lock_guard<Latch> lk(_indexMultikeyPathsMutex);
- invariant(multikeyPaths.size() == _indexMultikeyPaths.size());
+ invariant(multikeyPaths.size() == _indexMultikeyPathsForRead.size());
bool newPathIsMultikey = false;
for (size_t i = 0; i < multikeyPaths.size(); ++i) {
- if (!std::includes(_indexMultikeyPaths[i].begin(),
- _indexMultikeyPaths[i].end(),
+ if (!std::includes(_indexMultikeyPathsForRead[i].begin(),
+ _indexMultikeyPathsForRead[i].end(),
multikeyPaths[i].begin(),
multikeyPaths[i].end())) {
// If 'multikeyPaths' contains a new path component that causes this index to be
@@ -361,7 +361,7 @@ void IndexCatalogEntryImpl::_catalogSetMultikey(OperationContext* opCtx,
_descriptor->indexName(),
multikeyPaths);
- // In the absense of using the storage engine to read from the catalog, we must set multikey
+ // In the absence of using the storage engine to read from the catalog, we must set multikey
// prior to the storage engine transaction committing.
//
// Moreover, there must not be an `onRollback` handler to reset this back to false. Given a long
@@ -372,7 +372,7 @@ void IndexCatalogEntryImpl::_catalogSetMultikey(OperationContext* opCtx,
if (_indexTracksMultikeyPathsInCatalog) {
stdx::lock_guard<Latch> lk(_indexMultikeyPathsMutex);
for (size_t i = 0; i < multikeyPaths.size(); ++i) {
- _indexMultikeyPaths[i].insert(multikeyPaths[i].begin(), multikeyPaths[i].end());
+ _indexMultikeyPathsForRead[i].insert(multikeyPaths[i].begin(), multikeyPaths[i].end());
}
}
if (indexMetadataHasChanged && _queryInfo) {
diff --git a/src/mongo/db/catalog/index_catalog_entry_impl.h b/src/mongo/db/catalog/index_catalog_entry_impl.h
index 8d6077423e5..48acd848b45 100644
--- a/src/mongo/db/catalog/index_catalog_entry_impl.h
+++ b/src/mongo/db/catalog/index_catalog_entry_impl.h
@@ -248,19 +248,20 @@ private:
// this point, future writers do not need to update the catalog.
AtomicWord<bool> _isMultikeyForWrite;
- // Controls concurrent access to '_indexMultikeyPaths'. We acquire this mutex rather than the
- // RESOURCE_METADATA lock as a performance optimization so that it is cheaper to detect whether
- // there is actually any path-level multikey information to update or not.
+ // Controls concurrent access to '_indexMultikeyPathsForRead'.
+ // We acquire this mutex rather than the RESOURCE_METADATA lock as a performance optimization
+ // so that it is cheaper to detect whether there is actually any path-level multikey
+ // information to update or not.
mutable Mutex _indexMultikeyPathsMutex =
MONGO_MAKE_LATCH("IndexCatalogEntryImpl::_indexMultikeyPathsMutex");
// Non-empty only if '_indexTracksPathLevelMultikeyInfo' is true.
//
- // If non-empty, '_indexMultikeyPaths' is a vector with size equal to the number of elements
+ // If non-empty, '_indexMultikeyPaths*' 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 (starting
// at 0) into the corresponding indexed field that represent what prefixes of the indexed field
// causes the index to be multikey.
- MultikeyPaths _indexMultikeyPaths;
+ MultikeyPaths _indexMultikeyPathsForRead; // May include paths not committed to catalog.
// KVPrefix used to differentiate between index entries in different logical indexes sharing the
// same underlying sorted data interface.