When updating time_to_live, index is not recreated when using mongodb

Bug #1413812 reported by David Hill
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ceilometer
Invalid
Undecided
Unassigned

Bug Description

When updating time_to_live, index is not dropped/recreated when using mongodb ...

output of getIndexes():
        {
                "v" : 1,
                "key" : {
                        "timestamp" : 1
                },
                "ns" : "ceilometer.meter",
                "expireAfterSeconds" : 31536000,
                "name" : "meter_ttl"
        },

#:/etc/ceilometer# grep time_to_live ceilometer.conf
time_to_live=15768000

According to this chunk of code, it should have been dropped/recreated (unless I'm wrong here):
        indexes = self.db.meter.index_information()

        ttl = cfg.CONF.database.time_to_live

        if ttl <= 0:
            if 'meter_ttl' in indexes:
                self.db.meter.drop_index('meter_ttl')
            return

        if 'meter_ttl' in indexes:
            # NOTE(sileht): manually check expireAfterSeconds because
            # ensure_index doesn't update index options if the index already
            # exists
            if ttl == indexes['meter_ttl'].get('expireAfterSeconds', -1):
                return

            self.db.meter.drop_index('meter_ttl')

        self.db.meter.create_index(
            [('timestamp', pymongo.ASCENDING)],
            expireAfterSeconds=ttl,
            name='meter_ttl'
        )

Revision history for this message
ZhiQiang Fan (aji-zqfan) wrote :

1. have you restarted any database related service? such as ceilometer-api, ceilometer-collector?
2. are you using different config file for different service? in such case, are the config file's ttl value same?
3. which mongodb version are you using?

Changed in ceilometer:
status: New → Incomplete
Revision history for this message
gordon chung (chungg) wrote :

closing since we can not verify based on info

Changed in ceilometer:
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.