[SERVER-13940] Documents deleted by TTL are not reflected in deleted docs in serverStatus nor db.currentOp() Created: 14/May/14  Updated: 19/Jun/23

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

Type: Improvement Priority: Minor - P4
Reporter: Alon Horev Assignee: Backlog - Query Execution
Resolution: Unresolved Votes: 3
Labels: community-team
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Assigned Teams:
Query Execution
Participants:
Case:

 Description   

While debugging a cluster with degraded performance I noticed very high lock usage and disk utilisation. Only when I looked at db.currentOp(true) to see ALL queries running (including background threads and such) I found the TTL query.

It would be nice if this query would be revealed at db.currentOp() (without the flag) and more importantly, the deleted documents will be revealed in serverStatus and therefore mongostat.

I understand this might not be a bug and it works as designed, and serverStatus contains the number of deleted documents through TTL under metrics.ttl.deleted but it's still confusing.



 Comments   
Comment by srujan akumarthi [ 03/Apr/18 ]

I know this is old thread, should we add TTL operations in mongostat?

Comment by David Hatch [ 02/Aug/16 ]

In db.serverStatus, documents deleted due to an expiration in the TTL index are not reflected in serverStatus.opcounters.delete or in serverStatus.metrics.document.deleted. mongostat reads from serverStatus.opcounters, and so does not report TTL deletes as well. Documents deleted by TTL indexes are only reported in serverStatus.metrics.ttl.deletedDocuments, which is potentially confusing.

The behavior of db.currentOp(true) in our documentation is specified as including "operations on idle connections and system operations."

We should:

1. consider clarifying our currentOp documentation to provide TTL indexes as an example of a system operation
2. determine whether we would like to include TTL deletes in the deletion opcounters or not. If not, we should likely clarify that opcounters.delete only includes operations issued by the user.

Comment by Matt Kangas [ 23/Jun/14 ]

alonho - you said:

> It would be nice if this query would be revealed at db.currentOp() (without the flag) and more importantly, the deleted documents will be revealed in serverStatus and therefore mongostat.

Focusing on serverStatus and considering Asya's notes above, what changes to serverStatus would you recommend?

Currently available:

  • serverStatus.metrics.document.deleted
    • deleted reports the total number of documents deleted
  • serverStatus.metrics.ttl.deletedDocuments
    • deletedDocuments reports the total number of documents deleted from collections with a ttl index.

Is there another metric we should provide?

Comment by Asya Kamsky [ 23/Jun/14 ]

alonho note that you can see the TTL (and migration) deletes on secondaries - on primaries the counts de facto represent the write operations initiated by the client (right or wrong, that's how it is at the moment).

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