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

Check if we're already fetching before adding a fetch in analyzeDistinct()

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Query Optimization
    • Fully Compatible
    • ALL
    • Hide

      Run this script in the noPassthrough suite

      /**
       * @tags: [
       *   featureFlagShardFilteringDistinctScan,
       * ]
       */
      import {ShardingTest} from "jstests/libs/shardingtest.js";
      
      const st = new ShardingTest({shards: 2});
      
      const db = st.getDB("test");
      const primaryShard = st.shard0.shardName;
      assert.commandWorked(st.s.adminCommand({enableSharding: db.getName(), primaryShard}));
      
      const coll = db[jsTestName()];
      assert.commandWorked(st.s.adminCommand({shardCollection: coll.getFullName(), key: {a: 1}}));
      
      const pipeline = [
          {$match: {nss: {$ne: ""}}},
          {$group: {_id: "$nss", placement: {$top: {output: "$$CURRENT", sortBy: {"timestamp": -1}}}}},
          {$match: {_id: {$not: {$regex: /^[^.]+\.system\.resharding\..+$/}}}}
      ];
      
      print("running explain...");
      const explain = st.s.getDB('config').placementHistory.explain().aggregate(pipeline);
      print("explain:", tojson(explain));
      st.stop();
      
      Show
      Run this script in the noPassthrough suite /** * @tags: [ * featureFlagShardFilteringDistinctScan, * ] */ import {ShardingTest} from "jstests/libs/shardingtest.js" ; const st = new ShardingTest({shards: 2}); const db = st.getDB( "test" ); const primaryShard = st.shard0.shardName; assert .commandWorked(st.s.adminCommand({enableSharding: db.getName(), primaryShard})); const coll = db[jsTestName()]; assert .commandWorked(st.s.adminCommand({shardCollection: coll.getFullName(), key: {a: 1}})); const pipeline = [ {$match: {nss: {$ne: ""}}}, {$group: {_id: "$nss" , placement: {$top: {output: "$$CURRENT" , sortBy: { "timestamp" : -1}}}}}, {$match: {_id: {$not: {$regex: /^[^.]+\.system\.resharding\..+$/}}}} ]; print( "running explain..." ); const explain = st.s.getDB( 'config' ).placementHistory.explain().aggregate(pipeline); print( "explain:" , tojson(explain)); st.stop();
    • 200

      See BF-35249

            Assignee:
            henri.nikku@mongodb.com Henri Nikku
            Reporter:
            henri.nikku@mongodb.com Henri Nikku
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: