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

serverStatus failed command counter not incremented when command fails by throwing

    XMLWordPrintableJSON

Details

    • Fully Compatible
    • ALL
    • Platforms 2018-02-26, Platforms 2018-03-12, Platforms 2018-03-26, Platforms 2018-04-09, Platforms 2018-04-23, Platforms 2018-05-07

    Description

      When a command fails by propagating a Status return value, the mongod service entry point calls incrementCommandsFailed():

      https://github.com/mongodb/mongo/blob/da5520555faef9a2ba9b6c9ec80539ae95ad88a5/src/mongo/db/service_entry_point_mongod.cpp#L720-L722

      No analogous call exists in the service entry point's DBException handler. You can observe this by comparing a failed aggregate command, which fails by throwing, to a failed find command, which fails by Status:

      // Expects to be run against a freshly-started mongod.
      db.c.drop();
      assert.writeOK(db.c.insert({}));
       
      // This succeeds, since failed find commands are counted correctly.
      db.c.find().hint({bad: 1});
      assert.eq(1, db.serverStatus().metrics.commands.find.failed);
       
      // This fails: failed aggregate commands are not counted correctly.
      db.c.aggregate([{$project: {a: {$div: ["$a", 0]}}}]);
      assert.eq(1, db.serverStatus().metrics.commands.aggregate.failed);
      

      Attachments

        Activity

          People

            billy.donahue@mongodb.com Billy Donahue
            david.storch@mongodb.com David Storch
            Votes:
            0 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: