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), } }
- causes
-
SERVER-57768 Deprecated counters aren't reset to zero on wrap
- Closed
- is related to
-
MONGOSH-1363 db.serverStatus() --> opcounters returning deprecated values
- Closed
- related to
-
SERVER-57384 Remove serverStatus counters and logging for deleted opcodes
- Closed