diff options
author | Allison Easton <allison.easton@mongodb.com> | 2022-11-14 08:05:09 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-11-14 08:35:28 +0000 |
commit | 2bfdf69af4ab1b08b07e757a61668cf9fe620fb4 (patch) | |
tree | 5a60b2ea2181e81e6fb8cbb51068df98b14182cf | |
parent | f58626ef1cbc753fef6ea3991b01773b63b448a8 (diff) | |
download | mongo-2bfdf69af4ab1b08b07e757a61668cf9fe620fb4.tar.gz |
SERVER-70985 Fix uuid naming issue in onModifyShardedCollectionGlobalIndexCatalogEntry
-rw-r--r-- | src/mongo/db/s/shard_server_op_observer.cpp | 36 |
1 files changed, 19 insertions, 17 deletions
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; } |