movePrimary must clean the CSR if the new primary does not own chunks

XMLWordPrintableJSON

    • Catalog and Routing
    • Fully Compatible
    • ALL
    • CAR Team 2026-07-20
    • 200
    • 🟦 Shard Catalog
    • None
    • None
    • None
    • None
    • None
    • None

      As part of movePrimary, the new primary shard must clear metadata for tracked collections that do not own any chunks on that shard. This is needed because some DDL operations, such as refineShardKey and shardCollection, only send the shard catalog commit to the primary shard and to shards that own chunks. As a result, shards without chunks can keep stale metadata.

      Today, movePrimary only clears metadata for collections marked as kUnowned. However, a collection without chunks can also be marked as kTracked and still have a routing table. This change updates the condition so movePrimary also clears metadata in that case.

      This exposed another issue: chunk migrations could fail with ConflictingOperationInProgress because the metadata was being reset in the middle of the migration. To fix this, we added a shard role loop so that, if the recipient finds the filtering metadata unknown, it refreshes it and continues.

            Assignee:
            Silvia Surroca
            Reporter:
            Silvia Surroca
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: