From 2bfdf69af4ab1b08b07e757a61668cf9fe620fb4 Mon Sep 17 00:00:00 2001 From: Allison Easton Date: Mon, 14 Nov 2022 08:05:09 +0000 Subject: SERVER-70985 Fix uuid naming issue in onModifyShardedCollectionGlobalIndexCatalogEntry --- src/mongo/db/s/shard_server_op_observer.cpp | 36 +++++++++++++++-------------- 1 file changed, 19 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/mongo/db/s/shard_server_op_observer.cpp b/src/mongo/db/s/shard_server_op_observer.cpp index 1efc635e7d2..8076c07a8bf 100644 --- a/src/mongo/db/s/shard_server_op_observer.cpp +++ b/src/mongo/db/s/shard_server_op_observer.cpp @@ -535,27 +535,29 @@ void ShardServerOpObserver::onModifyShardedCollectionGlobalIndexCatalogEntry( IDLParserContext("onModifyShardedCollectionGlobalIndexCatalogEntry"), indexDoc["entry"].Obj()); auto indexVersion = indexDoc["entry"][IndexCatalogType::kLastmodFieldName].timestamp(); - auto uuid = uassertStatusOK( + auto collUuid = uassertStatusOK( UUID::parse(indexDoc["entry"][IndexCatalogType::kCollectionUUIDFieldName])); - opCtx->recoveryUnit()->onCommit([opCtx, nss, uuid, indexVersion, indexEntry](auto _) { - AutoGetCollection autoColl(opCtx, nss, MODE_IX); - auto scsr = CollectionShardingRuntime::assertCollectionLockedAndAcquire( - opCtx, nss, CSRAcquisitionMode::kExclusive); - scsr->addIndex(opCtx, indexEntry, {uuid, indexVersion}); - }); + opCtx->recoveryUnit()->onCommit( + [opCtx, nss, collUuid, indexVersion, indexEntry](auto _) { + AutoGetCollection autoColl(opCtx, nss, MODE_IX); + auto scsr = CollectionShardingRuntime::assertCollectionLockedAndAcquire( + opCtx, nss, CSRAcquisitionMode::kExclusive); + scsr->addIndex(opCtx, indexEntry, {collUuid, indexVersion}); + }); break; } case 'd': { auto indexName = indexDoc["entry"][IndexCatalogType::kNameFieldName].str(); auto indexVersion = indexDoc["entry"][IndexCatalogType::kLastmodFieldName].timestamp(); - auto uuid = uassertStatusOK( + auto collUuid = uassertStatusOK( UUID::parse(indexDoc["entry"][IndexCatalogType::kCollectionUUIDFieldName])); - opCtx->recoveryUnit()->onCommit([opCtx, nss, indexName, indexVersion, uuid](auto _) { - AutoGetCollection autoColl(opCtx, nss, MODE_IX); - auto scsr = CollectionShardingRuntime::assertCollectionLockedAndAcquire( - opCtx, nss, CSRAcquisitionMode::kExclusive); - scsr->removeIndex(opCtx, indexName, {uuid, indexVersion}); - }); + opCtx->recoveryUnit()->onCommit( + [opCtx, nss, indexName, indexVersion, collUuid](auto _) { + AutoGetCollection autoColl(opCtx, nss, MODE_IX); + auto scsr = CollectionShardingRuntime::assertCollectionLockedAndAcquire( + opCtx, nss, CSRAcquisitionMode::kExclusive); + scsr->removeIndex(opCtx, indexName, {collUuid, indexVersion}); + }); break; } case 'r': { @@ -567,13 +569,13 @@ void ShardServerOpObserver::onModifyShardedCollectionGlobalIndexCatalogEntry( } auto indexVersion = indexDoc["entry"][IndexCatalogType::kLastmodFieldName].timestamp(); - auto uuid = uassertStatusOK( + auto collUuid = uassertStatusOK( UUID::parse(indexDoc["entry"][IndexCatalogType::kCollectionUUIDFieldName])); - opCtx->recoveryUnit()->onCommit([opCtx, nss, uuid, indexVersion, indexes](auto _) { + opCtx->recoveryUnit()->onCommit([opCtx, nss, collUuid, indexVersion, indexes](auto _) { AutoGetCollection autoColl(opCtx, nss, MODE_IX); auto scsr = CollectionShardingRuntime::assertCollectionLockedAndAcquire( opCtx, nss, CSRAcquisitionMode::kExclusive); - scsr->replaceIndexes(opCtx, indexes, {uuid, indexVersion}); + scsr->replaceIndexes(opCtx, indexes, {collUuid, indexVersion}); }); break; } -- cgit v1.2.1