-
Type:
Improvement
-
Resolution: Done
-
Priority:
Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
-
None
-
3
-
None
-
None
-
None
-
None
-
None
-
None
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