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

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

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Gone away
    • Affects Version/s: 2.6.4, 2.7.6
    • Fix Version/s: None
    • Component/s: Querying
    • Labels:
      None
    • Operating System:
      ALL

      Description

      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);
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: