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

Changing TTL expiration time with collMod does not correctly update index definition

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.6.6, 2.8.0-rc2
    • Affects Version/s: None
    • Component/s: Storage
    • Labels:
      None
    • ALL

      Using collmod to adjust the TTL window prints an incorrect expireAfterSeconds_old value.

      I've had this happen several times on 2.6.0 and 2.6.1 but have not been able to reproduce it.

      The command was run around 2014-05-27T15:14:28.086+0000.

      index specs shows TTL to be 518400s.

      oplog1:PRIMARY> db.oplog_i2.getIndexSpecs()
      [
      	{
      		"v" : 1,
      		"key" : {
      			"_id" : 1
      		},
      		"ns" : "4fb2a07b87d1d86fa8ba6f07.oplog_i2",
      		"name" : "_id_"
      	},
      	{
      		"v" : 1,
      		"key" : {
      			"groupId" : 1,
      			"rsId" : 1,
      			"valid" : 1,
      			"end" : 1,
      			"_id" : 1
      		},
      		"ns" : "4fb2a07b87d1d86fa8ba6f07.oplog_i2",
      		"name" : "groupId_1_rsId_1_valid_1_end_1__id_1"
      	},
      	{
      		"v" : 1,
      		"key" : {
      			"end_date" : 1
      		},
      		"ns" : "4fb2a07b87d1d86fa8ba6f07.oplog_i2",
      		"name" : "end_date_1",
      		"expireAfterSeconds" : 518400,
      		"background" : true
      	}
      ]
      

      Running collmod reports the old window to be 176400:

      oplog1:PRIMARY> db.runCommand({collMod: "oplog_i2",
      ...               index: {keyPattern: {end_date : 1},
      ...               expireAfterSeconds: 900000}})
      {
      	"expireAfterSeconds_old" : 176400,
      	"expireAfterSeconds_new" : 900000,
      	"ok" : 1
      }
      

      Oldest record in the collection:

      oplog1:PRIMARY> db.oplog_i2.find({}, {end_date:1}).sort({end_date : 1}).limit(1)
      { "_id" : ObjectId("537cc26ee4b04494b5ce2d26"), "end_date" : ISODate("2014-05-21T15:12:46.758Z") }
      

            Assignee:
            rassi J Rassi
            Reporter:
            steve.briskin Steve Briskin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: