diff options
author | Allison Easton <allison.easton@mongodb.com> | 2022-11-15 11:14:44 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-11-15 11:44:46 +0000 |
commit | 0ace76efec4f88f47cae2e35f0a21bd69984f58e (patch) | |
tree | 28a8e1208da317faf31cab9c2db0a984c4e538f2 | |
parent | 00953629dc95376384f912e692fdf42ce248ba56 (diff) | |
download | mongo-0ace76efec4f88f47cae2e35f0a21bd69984f58e.tar.gz |
SERVER-71168 Indexes on config server global indexes collections should be created during first FCV stage
-rw-r--r-- | src/mongo/db/commands/set_feature_compatibility_version_command.cpp | 8 | ||||
-rw-r--r-- | src/mongo/s/catalog_cache.cpp | 6 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/mongo/db/commands/set_feature_compatibility_version_command.cpp b/src/mongo/db/commands/set_feature_compatibility_version_command.cpp index b7908899c83..d5695157810 100644 --- a/src/mongo/db/commands/set_feature_compatibility_version_command.cpp +++ b/src/mongo/db/commands/set_feature_compatibility_version_command.cpp @@ -461,6 +461,10 @@ private: ->waitForCoordinatorsOfGivenTypeToComplete( opCtx, DDLCoordinatorTypeEnum::kCompactStructuredEncryptionData); } + + if (requestedVersion > actualVersion) { + _createGlobalIndexesIndexes(opCtx, requestedVersion); + } } // This helper function is for any actions that should be done before taking the FCV full @@ -493,11 +497,9 @@ private: void _completeUpgrade(OperationContext* opCtx, const multiversion::FeatureCompatibilityVersion requestedVersion) { if (serverGlobalParams.clusterRole == ClusterRole::ConfigServer) { - _createGlobalIndexesIndexes(opCtx, requestedVersion); _cleanupConfigVersionOnUpgrade(opCtx, requestedVersion); _createSchemaOnConfigSettings(opCtx, requestedVersion); } else if (serverGlobalParams.clusterRole == ClusterRole::ShardServer) { - _createGlobalIndexesIndexes(opCtx, requestedVersion); } else { return; } @@ -650,6 +652,8 @@ private: // TODO SERVER-68551: Remove once 7.0 becomes last-lts dropDistLockCollections(opCtx); + _createGlobalIndexesIndexes(opCtx, requestedVersion); + // Tell the shards to enter phase-2 of setFCV (fully upgraded) _sendSetFCVRequestToShards(opCtx, request, changeTimestamp, SetFCVPhaseEnum::kComplete); } diff --git a/src/mongo/s/catalog_cache.cpp b/src/mongo/s/catalog_cache.cpp index 8f0bbade1e7..a110a0429dc 100644 --- a/src/mongo/s/catalog_cache.cpp +++ b/src/mongo/s/catalog_cache.cpp @@ -470,10 +470,16 @@ boost::optional<GlobalIndexesCache> CatalogCache::_getCollectionIndexInfoAt( "Index refresh failed", "namespace"_attr = nss, "exception"_attr = redact(ex)); + acquireTries++; if (acquireTries == kMaxInconsistentCollectionRefreshAttempts) { throw; } + + // TODO (SERVER-71278) Remove this handling of SnapshotUnavailable + if (ex.code() == ErrorCodes::SnapshotUnavailable) { + sleepmillis(100); + } } indexEntryFuture = _indexCache.acquireAsync(nss, CacheCausalConsistency::kLatestKnown); |