Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-6201

temporary insertion of a non compliant ttl index causes ttl thread to abort and ttl to stop working

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.2.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      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
      

            Assignee:
            eliot Eliot Horowitz (Inactive)
            Reporter:
            aaron Aaron Staple
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: