-
Type: Bug
-
Resolution: Won't Do
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Diagnostics, Sharding
-
Sharding
-
ALL
When mongos receives an insert command command, it will increment the command opcounter as well as the insert opcounter. This is incorrect. The correct behavior is to only increment the insert opcounter. mongod exhibits the correct behavior.
Affects master and v2.6.
To reproduce:
var st = new ShardingTest({shards: 1}); var coll = st.getDB("test").getCollection("foo"); var ret = coll.getDB().adminCommand("serverStatus"); assert.commandWorked(ret); var commandCounters = ret.opcounters.command; var insertCounters = ret.opcounters.insert; assert.commandWorked(coll.runCommand("insert", {documents: [{}]})); ret = coll.getDB().adminCommand("serverStatus"); assert.commandWorked(ret); assert.eq(ret.opcounters.insert, insertCounters + 1); // "insert" command counts as 1 insert assert.eq(ret.opcounters.command, commandCounters + 1); // "serverStatus" command counts as 1 command st.stop();
The above script fails on line 11, as the command opcounter is incorrectly incremented twice.