different behavior of alarm creation on different DB backend

Bug #1260176 reported by Lianhao Lu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ceilometer
Fix Released
High
Lianhao Lu

Bug Description

Currently, we see different user experience on different DB backend when creating alarms.

On sqlalchemy, due to the foreign key constraints, an alarm can only be created if the corresponding user_id and project_id are existed in the DB, which means the alarm can NOT be created until a metering sample with the same user_id and project_id has been recorded in the DB.

However, on mongoDB, there is no such restriction. The alarm can be created whenever the user wants.

We should make different DB backends behave the same way.

method 1: drop sql foreign key constraints
method 2: in sqlalchemy implementation of alarm creation, create new user_id/project_id, just like what we does now in record_metering_data.

Lianhao Lu (lianhao-lu)
description: updated
Revision history for this message
gordon chung (chungg) wrote :

a heads up, if you drop foreign key constraints, you may need to update clear_expired_metering_data since i check for that there too.

Lianhao Lu (lianhao-lu)
Changed in ceilometer:
assignee: nobody → Lianhao Lu (lianhao-lu)
milestone: none → icehouse-2
Revision history for this message
Mehdi Abaakouk (sileht) wrote :

The real sql error on alarm is described and fixed here: https://bugs.launchpad.net/ceilometer/+bug/1260776

But this is only one part of this issue:

My resume for second part:

The storage API layer have method get_user/get_project used only by ceilometer API v1 (the deprecated one)
What user and project is for API V1 ?
a list of all user/project in ceilometer (1) or a list of user/project of samples (2) ?
Or we don't care this is V1 API only (3) ? and for the 'foreign key constraints' of sql backend is implementation detail of this storage driver.

So the API V1 documentation says : "Return a list of all known user names.", that means mongo driver go wrong, sql go right.

BUT for me, we have a 3° solutions: Remove the API V1 and put the 'foreign key' question into a sql detail implementation.
WDYT ?

Changed in ceilometer:
status: New → In Progress
Revision history for this message
Lianhao Lu (lianhao-lu) wrote :

see patch https://review.openstack.org/65018 for the fixing

Julien Danjou (jdanjou)
Changed in ceilometer:
importance: Undecided → High
Thierry Carrez (ttx)
Changed in ceilometer:
milestone: icehouse-2 → icehouse-3
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ceilometer (master)

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

commit ecbe240e6b6ef962ea0ca263c197243643e6964b
Author: Lianhao Lu <email address hidden>
Date: Mon Jan 6 10:53:00 2014 +0800

    Drop foreign key contraints of alarm in sqlalchemy

    This patch drops the foreign key constraints of alarms to user_id and
    project_id in sqlalchemy.

    Closes-Bug: 1260176
    Change-Id: I7336ee1e3f885421db5aae3a30af0e918b79450b

Changed in ceilometer:
status: In Progress → Fix Committed
Thierry Carrez (ttx)
Changed in ceilometer:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in ceilometer:
milestone: icehouse-3 → 2014.1
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.