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

Add op counters for legacy op codes (OP_QUERY, OP_INSERT, etc.)

    XMLWordPrintable

    Details

    • Backwards Compatibility:
      Fully Compatible
    • Backport Requested:
      v4.4, v4.2, v4.0
    • Sprint:
      Query Execution 2021-05-17, Query Execution 2021-05-31

      Description

      We are interested in deprecating the following opcodes:

      • OP_QUERY (except for when running an isMaster command)
      • OP_GET_MORE
      • OP_KILL_CURSORS
      • OP_INSERT
      • OP_UPDATE
      • OP_DELETE

      Therefore, we would like to add a way to determine whether and how often these kinds of operations are being issued against a mongod using output from db.serverStatus(). Today, you can get the following counts from the opcounters section:

      MongoDB Enterprise > db.serverStatus().opcounters
      {
      	"insert" : NumberLong(0),
      	"query" : NumberLong(2),
      	"update" : NumberLong(1),
      	"delete" : NumberLong(0),
      	"getmore" : NumberLong(0),
      	"command" : NumberLong(23)
      }
      

      These counts include both the legacy op codes and their command equivalents. Therefore, you can use this information together with metrics.commands section to infer the number of wire protocol operations. For instance, this could give you the number of legacy OP_QUERY find operations:

      MongoDB Enterprise > let serverStatus = db.serverStatus()
      MongoDB Enterprise > serverStatus.opcounters.query - serverStatus.metrics.commands.find.total
      

      We could make this a whole lot easier by adding new counters for the legacy wire ops. It could look like so, for example:

      MongoDB Enterprise > db.serverStatus().opcounters
      {
      	"insert" : NumberLong(0),
               "legacyInsert": NumberLong(0),
      	"query" : NumberLong(2),
      	"legacyQuery" : NumberLong(2),
      	"update" : NumberLong(1),
      	"legacyUpdate" : NumberLong(2),
      	"delete" : NumberLong(0),
      	"legacyDelete" : NumberLong(0),
      	"getmore" : NumberLong(0),
      	"legacyGetmore" : NumberLong(0),
      	"command" : NumberLong(23)
      }
      

      Alternatively, Rachelle Palmer suggested a special section of counters for deprecated features. That could perhaps look something like this:

      MongoDB Enterprise > db.serverStatus().opcounters
      MongoDB Enterprise > db.serverStatus().opcounters
      {
      	"insert" : NumberLong(0),
      	"query" : NumberLong(2),
      	"update" : NumberLong(1),
      	"delete" : NumberLong(0),
      	"getmore" : NumberLong(0),
      	"command" : NumberLong(23),
               "deprecated": {
                    "opQuery": NumberLong(0),
                    "opGetMore": NumberLong(0),
                    "opKillCursors": NumberLong(0),
                    "opDelete": NumberLong(0),
                    "opUpdate": NumberLong(0),
                    "opInsert": NumberLong(0),
                    "total": NumberLong(0),
               }
      }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              irina.yatsenko Irina Yatsenko
              Reporter:
              david.storch David Storch
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              9 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: