Resharding can leave behind local collection on former primary shard that doesn't own any chunks

XMLWordPrintableJSON

    • Fully Compatible
    • ALL
    • v5.1, v5.0
    • Hide

      Shuffle the allShardIds vector here in selectShardForNewDatabase() before to cycle on it.
      Simply remove the const specifier of the vector and add:

      std::random_shuffle(allShardIds.begin(), allShardIds.end());

      Show
      Shuffle the allShardIds vector here in selectShardForNewDatabase() before to cycle on it. Simply remove the const specifier of the vector and add: std::random_shuffle(allShardIds.begin(), allShardIds.end());
    • Sharding EMEA 2021-09-20, Sharding EMEA 2021-10-04, Sharding EMEA 2021-10-18
    • 2
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      Original summary

      resharding_allowMigrations.js fails if primary shard of 'reshardingDb' is not the first shard

      Original description

      I've discovered this while working on SERVER-54230, the problem is that if we randomly choose the primary shard of newly created database the resharding_allowMigrations.js starts failing.

      More specifically I've discovered that this happen only if the primary shard is chosen among one of the donor shards that is not shard-0.

       This is an example of a failing run on evg.

            Assignee:
            Pierlauro Sciarelli
            Reporter:
            Tommaso Tocci
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: