This Cloner::copyIndexes() is called either during rollback via refetch or by sharding specific commands "_shardsvrCloneCatalogData" & "_cloneCatalogData".
If this Cloner::copyIndexes() is called on primary for creating indexes on a non-empty collection, this can cause secondaries to block replication. But, it seems, if the node is primary, then we build indexes only on empty collections. To make this reasoning more obvious to the readers, we should make sure that if writes are replicated
1) Node should be in primary
2) Indexes that being built should be only on empty collection (can use IndexBuildsCoordinator::createIndexesOnEmptyCollection()) and they generate createIndexes oplog entry, making it more like a single phase.
If writes are not replicated, the collection may not be empty. This can happen only during rollback via refetch and we don't generate any oplog entries.
- is related to
-
SERVER-26772 Remove old initial sync code
- Closed