summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/shard_server_op_observer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/s/shard_server_op_observer.cpp')
-rw-r--r--src/mongo/db/s/shard_server_op_observer.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/mongo/db/s/shard_server_op_observer.cpp b/src/mongo/db/s/shard_server_op_observer.cpp
index 744c79a1eca..ae059d19512 100644
--- a/src/mongo/db/s/shard_server_op_observer.cpp
+++ b/src/mongo/db/s/shard_server_op_observer.cpp
@@ -509,20 +509,24 @@ void ShardServerOpObserver::onModifyShardedCollectionGlobalIndexCatalogEntry(
IDLParserContext("onModifyShardedCollectionGlobalIndexCatalogEntry"),
indexDoc["entry"].Obj());
auto indexVersion = indexDoc["entry"][IndexCatalogType::kLastmodFieldName].timestamp();
- opCtx->recoveryUnit()->onCommit([opCtx, nss, indexVersion, indexEntry](auto _) {
+ auto uuid = uassertStatusOK(
+ UUID::parse(indexDoc["entry"][IndexCatalogType::kCollectionUUIDFieldName]));
+ opCtx->recoveryUnit()->onCommit([opCtx, nss, indexVersion, indexEntry, uuid](auto _) {
AutoGetCollection autoColl(opCtx, nss, MODE_IX);
CollectionShardingRuntime::assertCollectionLockedAndAcquire(
opCtx, nss, CSRAcquisitionMode::kExclusive)
- ->addIndex(opCtx, indexEntry, indexVersion);
+ ->addIndex(opCtx, indexEntry, {uuid, indexVersion});
});
} else {
auto indexName = indexDoc["entry"][IndexCatalogType::kNameFieldName].str();
auto indexVersion = indexDoc["entry"][IndexCatalogType::kLastmodFieldName].timestamp();
- opCtx->recoveryUnit()->onCommit([opCtx, nss, indexName, indexVersion](auto _) {
+ auto uuid = uassertStatusOK(
+ UUID::parse(indexDoc["entry"][IndexCatalogType::kCollectionUUIDFieldName]));
+ opCtx->recoveryUnit()->onCommit([opCtx, nss, indexName, indexVersion, uuid](auto _) {
AutoGetCollection autoColl(opCtx, nss, MODE_IX);
CollectionShardingRuntime::assertCollectionLockedAndAcquire(
opCtx, nss, CSRAcquisitionMode::kExclusive)
- ->removeIndex(opCtx, indexName, indexVersion);
+ ->removeIndex(opCtx, indexName, {uuid, indexVersion});
});
}
}