sql clear_expired_metering_data breaks resource metadata

Bug #1419239 reported by ZhiQiang Fan
22
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Ceilometer
Fix Released
High
ZhiQiang Fan
Juno
Fix Released
Undecided
Unassigned

Bug Description

no matter what ttl is, the code:

https://github.com/openstack/ceilometer/blob/926f781096dcfa77a8f63e403c0959de20e182aa/ceilometer/storage/impl_sqlalchemy.py#L362

            for table in [models.MetaText, models.MetaBigInt,
                          models.MetaFloat, models.MetaBool]:
                (session.query(table)
                 .join(sample_subq, sample_subq.c.id == table.id)
                 .delete())

will clean all the data in the four tables, then metadata query for resource api will no longer works

sample id is primary index generated by sql, metada id is resource internal_id, compare them is non sense

we should clean metadata for those cleaned resource, not samples

ZhiQiang Fan (aji-zqfan)
Changed in ceilometer:
assignee: nobody → ZhiQiang Fan (aji-zqfan)
description: updated
ZhiQiang Fan (aji-zqfan)
description: updated
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ceilometer (master)

Fix proposed to branch: master
Review: https://review.openstack.org/153902

Changed in ceilometer:
status: New → In Progress
tags: added: juno-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ceilometer (master)

Reviewed: https://review.openstack.org/153902
Committed: https://git.openstack.org/cgit/openstack/ceilometer/commit/?id=5a65b4de0fe46967e76832c2acf4924a53b18612
Submitter: Jenkins
Branch: master

commit 5a65b4de0fe46967e76832c2acf4924a53b18612
Author: ZhiQiang Fan <email address hidden>
Date: Sat Feb 7 16:23:20 2015 +0800

    metering data ttl sql backend breaks resource metadata

    The implementation for sql clear_expired_metering_data() uses delete()
    on join() for four metatada tables, which will cause clear whole
    tables no matter what join returns. And it associates metadata id
    with sample id which makes no sense, the metadata id is resource's
    internal id.

    Change-Id: I98219bf27a0a765838d45386b7ae6b6b980b1ae9
    Closes-Bug: #1419239

Changed in ceilometer:
status: In Progress → Fix Committed
Eoghan Glynn (eglynn)
Changed in ceilometer:
milestone: none → kilo-3
importance: Undecided → High
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to ceilometer (stable/juno)

Fix proposed to branch: stable/juno
Review: https://review.openstack.org/154530

Thierry Carrez (ttx)
Changed in ceilometer:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in ceilometer:
milestone: kilo-3 → 2015.1.0
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ceilometer (stable/juno)

Reviewed: https://review.openstack.org/154530
Committed: https://git.openstack.org/cgit/openstack/ceilometer/commit/?id=989fac5c5821739fef4809b0d75840e3bc4685bf
Submitter: Jenkins
Branch: stable/juno

commit 989fac5c5821739fef4809b0d75840e3bc4685bf
Author: ZhiQiang Fan <email address hidden>
Date: Sat Feb 7 16:23:20 2015 +0800

    metering data ttl sql backend breaks resource metadata

    The implementation for sql clear_expired_metering_data() uses delete()
    on join() for four metatada tables, which will cause clear whole
    tables no matter what join returns. And it associates metadata id
    with sample id which makes no sense, the metadata id is resource's
    internal id.

    Change-Id: I98219bf27a0a765838d45386b7ae6b6b980b1ae9
    Closes-Bug: #1419239
    (cherry picked from commit 5a65b4de0fe46967e76832c2acf4924a53b18612)

tags: added: in-stable-juno
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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