diff options
Diffstat (limited to 'src/mongo/db/catalog/coll_mod_index.cpp')
-rw-r--r-- | src/mongo/db/catalog/coll_mod_index.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mongo/db/catalog/coll_mod_index.cpp b/src/mongo/db/catalog/coll_mod_index.cpp index 9fbf29bab63..31207f38d3e 100644 --- a/src/mongo/db/catalog/coll_mod_index.cpp +++ b/src/mongo/db/catalog/coll_mod_index.cpp @@ -150,6 +150,7 @@ void _processCollModIndexRequestUnique(OperationContext* opCtx, return; } *newUnique = indexUnique; + autoColl->getWritableCollection()->updateUniqueSetting(opCtx, idx->indexName()); } } // namespace @@ -206,6 +207,11 @@ void processCollModIndexRequest(OperationContext* opCtx, // This matches the default for IndexCatalog::refreshEntry(). auto flags = CreateIndexEntryFlags::kIsReady; + // Update data format version in storage engine metadata for index. + if (indexUnique) { + flags = CreateIndexEntryFlags::kIsReady | CreateIndexEntryFlags::kUpdateMetadata; + } + // Notify the index catalog that the definition of this index changed. This will invalidate the // local idx pointer. On rollback of this WUOW, the local var idx pointer will be valid again. autoColl->getWritableCollection()->getIndexCatalog()->refreshEntry( |