[SERVER-6201] temporary insertion of a non compliant ttl index causes ttl thread to abort and ttl to stop working Created: 25/Jun/12  Updated: 11/Jul/16  Resolved: 26/Jun/12

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 2.2.0-rc0

Type: Improvement Priority: Major - P3
Reporter: Aaron Staple Assignee: Eliot Horowitz (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

Observed behavior: Insertion of a non compliant ttl index (or other assertion) causes ttl to stop working until mongod is restarted.
Expected behavior: ttl continues to work after an assertion.

Test:

 
t = db.ttl;
t.drop();
 
// Create a non compliant, compound ttl index.
db.foo.ensureIndex( { a:1, b:1 }, { expireAfterSeconds : 10 } );
 
// Wait for the ttl thread to pick up the non compliant index.
sleep( 60 * 1.5 * 1000 );
 
// Drop the collection with the non compliant index.
db.foo.drop();
 
// Standard ttl test
 
now = (new Date()).getTime();
 
for ( i=0; i<24; i++ )
    t.insert( { x : new Date( now - ( 3600 * 1000 * i ) ) } );
db.getLastError();
 
assert.eq( 24 , t.count() );
 
t.ensureIndex( { x : 1 } , { expireAfterSeconds : 20000 } );
 
assert.soon( 
    function() {
        return t.count() < 24;
    }, "never deleted" , 120 * 1000
);
 
assert.eq( 0 , t.find( { x : { $lt : new Date( now - 20000000 ) } } ).count() );
assert.eq( 6 , t.count() );
 

Log:

Sun Jun 24 22:49:46 [TTLMonitor] ERROR: backgroundjob TTLMonitorerror: key for ttl index can only have 1 field
Sun Jun 24 22:49:46 [TTLMonitor] ERROR: Client::shutdown not called: TTLMonitor



 Comments   
Comment by auto [ 26/Jun/12 ]

Author:

{u'date': u'2012-06-26T05:37:43-07:00', u'email': u'eliot@10gen.com', u'name': u'Eliot Horowitz'}

Message: SERVER-6201 - catch DBException in background tll process
Branch: master
https://github.com/mongodb/mongo/commit/1dbc9ce2586d9877072eb2769d14bb495b5e7ef6

Comment by auto [ 26/Jun/12 ]

Author:

{u'date': u'2012-06-26T05:36:13-07:00', u'name': u'Eliot Horowitz', u'email': u'eliot@10gen.com'}

Message: SERVER-6201 - don't uassert for invalid ttl setup in thread
Branch: master
https://github.com/mongodb/mongo/commit/e2e10a6567730f7e361a5c747daa4897b3cbfc07

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