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

mongos incorrectly increments command counter when receiving write command

    XMLWordPrintableJSON

Details

    • Sharding
    • ALL

    Description

      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.

      Attachments

        Activity

          People

            backlog-server-sharding [DO NOT USE] Backlog - Sharding Team
            rassi J Rassi
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: