[SERVER-33037] serverStatus failed command counter not incremented when command fails by throwing Created: 31/Jan/18  Updated: 29/Oct/23  Resolved: 24/Apr/18

Status: Closed
Project: Core Server
Component/s: Diagnostics, Internal Code
Affects Version/s: None
Fix Version/s: 4.0.0-rc0

Type: Bug Priority: Major - P3
Reporter: David Storch Assignee: Billy Donahue
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Platforms 2018-02-26, Platforms 2018-03-12, Platforms 2018-03-26, Platforms 2018-04-09, Platforms 2018-04-23, Platforms 2018-05-07
Participants:

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



 Comments   
Comment by Githook User [ 24/Apr/18 ]

Author:

{'email': 'billy.donahue@mongodb.com', 'username': 'BillyDonahue', 'name': 'Billy Donahue'}

Message: SERVER-33037 increment command failure counter on throw
Branch: master
https://github.com/mongodb/mongo/commit/8883a5bfeeb6f67d78946d054f37eccda47adbe4

Generated at Thu Feb 08 04:32:05 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.