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

serverStatus metrics incorrect: "operation.idhack", "queryExecutor.scanned", "queryExecutor.scannedObjects"

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.6.4, 2.7.6
    • Component/s: Querying
    • None
    • Query
    • ALL

      Regression since 2.4; affects current v2.6 and master.

      The following metrics from serverStatus().metrics no longer get updated properly:

      • operation.idhack
      • queryExecutor.scanned
      • queryExecutor.scannedObjects

      Reproduce with:

      // Test "operation.idhack" when query uses idhack.
      db.foo.drop();
      db.foo.insert({_id: 0});
      oldMetrics = db.serverStatus().metrics;
      db.foo.find({_id: 0}).itcount();
      newMetrics = db.serverStatus().metrics;
      assert.eq(newMetrics.operation.idhack, oldMetrics.operation.idhack + 1);
      
      // Test "queryExecutor.scanned" when query scans index entries.
      db.foo.drop();
      db.foo.ensureIndex({a: 1});
      db.foo.insert({a: 1});
      db.foo.insert({a: 2, b: 0});
      db.foo.insert({a: 2, b: 1});
      db.foo.insert({a: 2, b: 1});
      oldMetrics = db.serverStatus().metrics;
      db.foo.find({a: 2, b: 1}).hint({a: 1}).itcount();
      newMetrics = db.serverStatus().metrics;
      assert.eq(newMetrics.queryExecutor.scanned, oldMetrics.queryExecutor.scanned + 3);
      
      // Test "queryExecutor.scannedObjects" when query fetches documents.
      db.foo.drop();
      db.foo.ensureIndex({a: 1, b: 1});
      db.foo.insert({a: 1, b: 1, c: 1});
      db.foo.insert({a: 1, b: 1, c: 1});
      db.foo.insert({a: 1, b: 2, c: 1});
      oldMetrics = db.serverStatus().metrics;
      db.foo.find({b: 1, c: 1}).hint({a: 1, b: 1}).itcount();
      newMetrics = db.serverStatus().metrics;
      assert.eq(newMetrics.queryExecutor.scannedObjects, oldMetrics.queryExecutor.scannedObjects + 3);
      

            Assignee:
            backlog-server-query Backlog - Query Team (Inactive)
            Reporter:
            rassi J Rassi
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: