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

ChunkManager::getShardIdsForRange should not hardcode isMaxInclusive to true

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

      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@mongodb.com Daniel Gottlieb (Inactive)
            Reporter:
            cheahuychou.mao@mongodb.com Cheahuychou Mao
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: