Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-47438

Cloner::copyIndexes() should generate createIndexes oplog entry (single phase index build) for building indexes on empty collection.

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.4.0-rc2, 4.7.0
    • Affects Version/s: None
    • Component/s: Storage
    • Labels:
      None
    • Fully Compatible
    • v4.4
    • Execution Team 2020-04-20

      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.

            Assignee:
            benety.goh@mongodb.com Benety Goh
            Reporter:
            suganthi.mani@mongodb.com Suganthi Mani
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: