Details
-
Bug
-
Resolution: Fixed
-
Major - P3
-
None
-
None
-
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():
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);
|