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

Query stats not collected on mongos if database does not exist

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

      This test doesn't record any query stats for the "anything" namespace:

      const st = new ShardingTest({
          shards: 2,
          mongos: 1,
          config: 1,
          mongosOptions: {setParameter: {internalQueryStatsRateLimit: -1}}
      });
      
      let db = st.getDB("test");
      let adminDb = db.getSiblingDB("admin");
      
      assert.eq(null, db.anything.findOne());
      jsTestLog(adminDb.aggregate([{$queryStats: {}}]).toArray());
      st.stop();
      

      This corresponding test for a mongod does indeed return a query shape for "anything":

      const mongod = MongoRunner.runMongod({setParameter: {internalQueryStatsRateLimit: -1}});
      
      let db = mongod.getDB("test");
      let adminDb = db.getSiblingDB("admin");
      
      assert.eq(null, db.anything.findOne());
      jsTestLog(adminDb.aggregate([{$queryStats: {}}]).toArray());
      mongod.stop();
      
      Show
      This test doesn't record any query stats for the "anything" namespace: const st = new ShardingTest({ shards: 2, mongos: 1, config: 1, mongosOptions: {setParameter: {internalQueryStatsRateLimit: -1}} }); let db = st.getDB( "test" ); let adminDb = db.getSiblingDB( "admin" ); assert.eq( null , db.anything.findOne()); jsTestLog(adminDb.aggregate([{$queryStats: {}}]).toArray()); st.stop(); This corresponding test for a mongod does indeed return a query shape for "anything": const mongod = MongoRunner.runMongod({setParameter: {internalQueryStatsRateLimit: -1}}); let db = mongod.getDB( "test" ); let adminDb = db.getSiblingDB( "admin" ); assert.eq( null , db.anything.findOne()); jsTestLog(adminDb.aggregate([{$queryStats: {}}]).toArray()); mongod.stop();

      On a mongod these would be collected with a "nonExistent" namespace. Seems like we early-exit too early in this case on mongos.

            Assignee:
            charlie.swanson@mongodb.com Charlie Swanson
            Reporter:
            charlie.swanson@mongodb.com Charlie Swanson
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: