[SERVER-56501] Add op counters for legacy op codes (OP_QUERY, OP_INSERT, etc.) Created: 29/Apr/21  Updated: 29/Oct/23  Resolved: 19/May/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 4.2.15, 4.4.7, 5.0.0-rc0, 4.0.26, 5.1.0-rc0

Type: Task Priority: Major - P3
Reporter: David Storch Assignee: Irina Yatsenko (Inactive)
Resolution: Fixed Votes: 0
Labels: post-rc0
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Documented
Problem/Incident
causes SERVER-57768 Deprecated counters aren't reset to z... Closed
Related
related to DOCS-14571 [BACKPORT] [v4.4] Add op counters for... Closed
related to DOCS-14575 [BACKPORT] [v4.0] Add op counters for... Closed
related to DOCS-14570 [BACKPORT] [v4.2] Add op counters for... Closed
related to SERVER-57384 Remove serverStatus counters and logg... Closed
is related to MONGOSH-1363 db.serverStatus() --> opcounters ret... Closed
Backwards Compatibility: Fully Compatible
Backport Requested:
v4.4, v4.2, v4.0
Sprint: Query Execution 2021-05-17, Query Execution 2021-05-31
Participants:

 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),
         }
}



 Comments   
Comment by Vivian Ge (Inactive) [ 06/Oct/21 ]

Updating the fixversion since branching activities occurred yesterday. This ticket will be in rc0 when it’s been triggered. For more active release information, please keep an eye on #server-release. Thank you!

Comment by Githook User [ 17/Jun/21 ]

Author:

{'name': 'Irina Yatsenko', 'email': 'irina.yatsenko@mongodb.com', 'username': 'IrinaYatsenko'}

Message: SERVER-56501 Add into serverStatus().opcounters a subsection for deprecated opcodes

(cherry picked from commit 7465d0acdc0096ed7d966c6ed623a11e8d6199d6)
(cherry picked from commit e779656ef9c8509ec8838d4019b95c5fc4a9e81a)
Branch: v4.0
https://github.com/mongodb/mongo/commit/5b58572d3112935f0b2bf38f1dc1dfb90ea3a25c

Comment by Githook User [ 16/Jun/21 ]

Author:

{'name': 'Irina Yatsenko', 'email': 'irina.yatsenko@mongodb.com', 'username': 'IrinaYatsenko'}

Message: SERVER-56501 Add into serverStatus().opcounters a subsection for deprecated opcodes
Branch: v4.4
https://github.com/mongodb/mongo/commit/a3e5fc87c0da7da48acaac80ebbd7b46482cbdae

Comment by David Storch [ 04/Jun/21 ]

bruce.lucas, that's correct. We added the new deprecated section for the legacy op codes, but did not change the behavior of the pre-existing counters.

Comment by Bruce Lucas (Inactive) [ 03/Jun/21 ]

david.storch, can you clarify - does the meaning of the current opcounters.insert etc. remain unchanged after this change? I.e. it still includes the command equivalents?

Comment by Eric Milkie [ 01/Jun/21 ]

I changed it to "5.1.0" (not sure why it's missing for Irina)

Comment by Irina Yatsenko (Inactive) [ 01/Jun/21 ]

Yes, I added 5.1 required (as it's the only 5.1* label available to me in the dropdown)

Comment by David Storch [ 01/Jun/21 ]

irina.yatsenko, this should have a 5.1.0 fixVersion now (as well as 5.0.0-rc0), correct?

Comment by Githook User [ 28/May/21 ]

Author:

{'name': 'Irina Yatsenko', 'email': 'irina.yatsenko@mongodb.com', 'username': 'IrinaYatsenko'}

Message: SERVER-56501 Add into serverStatus().opcounters a subsection for deprecated opcodes

(cherry picked from commit 7465d0acdc0096ed7d966c6ed623a11e8d6199d6)
Branch: master
https://github.com/mongodb/mongo/commit/e779656ef9c8509ec8838d4019b95c5fc4a9e81a

Comment by Ethan Zhang (Inactive) [ 21/May/21 ]

Note that this patch did not land on master as we are going to remove the deprecated opcodes all at once in 5.1

Comment by Githook User [ 19/May/21 ]

Author:

{'name': 'Irina Yatsenko', 'email': 'irina.yatsenko@mongodb.com', 'username': 'IrinaYatsenko'}

Message: SERVER-56501 Add into serverStatus().opcounters a subsection for deprecated opcodes
Branch: v5.0
https://github.com/mongodb/mongo/commit/7465d0acdc0096ed7d966c6ed623a11e8d6199d6

Comment by Eric Milkie [ 11/May/21 ]

Right, I was thinking "a version that no longer supports the legacy opcodes" would not be 5.0 but some later version. Same question still stands though.

Comment by Ethan Zhang (Inactive) [ 11/May/21 ]

milkie In 5.0 they will still be supported, only with warnings and those counters.

Comment by Eric Milkie [ 11/May/21 ]

Is the plan to add an upgrade step to observe these counters, when upgrading to a version that no longer supports the legacy opcodes?

Comment by Ethan Zhang (Inactive) [ 10/May/21 ]

I kinda like the second proposal, to group legacy op counters together.

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