What’s up everyone.
I recently encountered an issue where in a MongoDB service, all TTL indexes for collections are not effective。
It is determined through the following method:
db.serverStatus().metrics.ttl
{
"deletedDocuments" : NumberLong(1487129845),
"passes" : NumberLong(505811)
}
The 'deletedDocuments' field and 'passes' field has not changed in the past two days
db.adminCommand({getParameter:1, ttlMonitorSleepSecs: 1});
{
"ttlMonitorSleepSecs" : 60,
"ok" : 1,
"$clusterTime" : {
"clusterTime" : Timestamp(1729051195, 84),
"signature" : {
"hash" : BinData(0,"vizbZrZFo2Y7Gpj2ZDb0oxNbSTw="),
"keyId" : NumberLong("7366182217619341331")
}
},
"operationTime" : Timestamp(1729051195, 84)
}
I did some tests. In two identical versions of MongoDB services, the same database and collections were created, the same data was inserted, and the same indexes were created. The problematic service and expired data were not cleaned up, but the normal service and expired data were cleaned up normally. Refer to the following diagram for testing steps