[SERVER-14364] OpCounters values should be stored/exported as 64-bit integers Created: 26/Jun/14  Updated: 06/Apr/21  Resolved: 30/Oct/18

Status: Closed
Project: Core Server
Component/s: Diagnostics
Affects Version/s: None
Fix Version/s: 4.1.5

Type: Improvement Priority: Major - P3
Reporter: J Rassi Assignee: Jacob Evans
Resolution: Done Votes: 4
Labels: SWDI, community-team, neweng, storch
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Documented
is documented by DOCS-12180 Docs for SERVER-14364: OpCounters val... Closed
Duplicate
is duplicated by SERVER-21238 Use 64-bit counters for operation cou... Closed
Related
related to SERVER-14341 negative opcounter values in serverSt... Closed
related to SERVER-5026 Fast, thread-safe counters for statis... Closed
Backwards Compatibility: Minor Change
Backport Requested:
v4.0, v3.6
Sprint: Integration F (02/01/16), Integration 10 (02/22/16), Query 2018-10-22, Query 2018-11-05
Participants:
Case:

 Description   

The counter values in the OpCounters class have type AtomicUInt32, and are exported in ServerStatus as 32-bit integers. The max value for this type is too small, and as such the class contains unnecessary overflow detection logic. The counter values should be changed to have type AtomicUInt64.



 Comments   
Comment by Githook User [ 30/Oct/18 ]

Author:

{'name': 'Jacob Evans', 'email': 'jacob.evans@10gen.com'}

Message: SERVER-14364 Make OpCounters 64-bit
Branch: master
https://github.com/mongodb/mongo/commit/27d6f6977113551e0e3444b4f76c646d94e75a49

Comment by Kyle Suarez [ 01/Mar/16 ]

BSON cannot handle unsigned 64-bit integers, so I'm inclined to change the counters to a (signed) AtomicInt64.

Comment by Bruce Lucas (Inactive) [ 08/Dec/15 ]

Note by the way that this also causes tooling (such as timeseries) to compute an incorrect value for averages (e.g. average insert rate) if it crosses a wrap point, producing misleading numbers. (Yes a workaround can be added to detect wrap points and not compute averages that cross them).

Comment by Bruce Lucas (Inactive) [ 02/Nov/15 ]

This means that these counters wrap relatively frequently - in less than an hour at heavy load - making it difficult (if you have a complete timeseries at intervals shorter than the wrap time) or impossible (if you have only a single serverStatus) to get averages over periods longer than that. There are diagnostic situations where it would be useful to answer questions like "has the mongod instance seen a large number of deletes since it was started", and 64-bit counters would allow us to answer those questions.

Comment by Matt Kangas [ 07/Aug/14 ]

If we do this, we should still wrap at 2 53 if we wish to keep counters as exact integral values in the shell.

ECMA 262 Section 8.5 - Numbers

Generated at Thu Feb 08 03:34:37 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.