ChunkManager::getShardIdsForRange should not hardcode isMaxInclusive to true

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Duplicate
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Sharding
    • ALL
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      getShardIdsForRange currently hardcodes isMaxInclusive to true and that causes mongos to target both of the shards in the following case.

      const st = ShardingTest({shards: 2});
      
      assert.commandWorked(st.s.adminCommand({enableSharding: "foo"}));
      st.ensurePrimaryShard("foo", st.shard0.shardName);
      
      assert.commandWorked(st.s.adminCommand({shardCollection: "foo.bar", key: {_id: 1}}));
      assert.commandWorked(st.s.adminCommand({split: "foo.bar", middle: {_id: 10}}));
      assert.commandWorked(st.s.adminCommand({moveChunk: "foo.bar", find: {_id: 10}, to: st.shard1.shardName, _waitForDelete: true}));
      
      assert.commandWorked(st.s.getDB("foo").runCommand({find: "bar", filter: {_id: {$lt: 10}}}));
      st.stop();
      

            Assignee:
            Daniel Gottlieb (Inactive)
            Reporter:
            Cheahuychou Mao
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: