[DB2 nosql] Ceilometer sample-list alway return nothing with two timestamp condition queries

Bug #1411492 reported by Lan Qi song
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ceilometer
Fix Released
Medium
Lan Qi song
Juno
Fix Released
Medium
Lan Qi song

Bug Description

1. I tried the following sample-list command:

[root@Controller ~]# ceilometer sample-list -m cpu_util
+--------------------------------------+----------+-------+---------------+------+---------------------+
| Resource ID | Name | Type | Volume | Unit | Timestamp |
+--------------------------------------+----------+-------+---------------+------+---------------------+
| a5074a11-d85e-4170-a042-466dd5d76d9c | cpu_util | gauge | 8.97666666667 | % | 2015-01-16T03:00:16 |
+--------------------------------------+----------+-------+---------------+------+---------------------+

Please notice that the timestamp value is "2015-01-16T03:00:16"

2. Next, I tried the second command :

[root@Controller ~]# ceilometer sample-list -m cpu_util -q 'timestamp>2015-01-16T03:00:15;timestamp<2015-01-16T03:00:17'
+-------------+------+------+--------+------+-----------+
| Resource ID | Name | Type | Volume | Unit | Timestamp |
+-------------+------+------+--------+------+-----------+
+-------------+------+------+--------+------+-----------+

It returned nothing, but the timestamp is between two timestamp conditions.

The reason for this problem is that

1. There is a concept named "datatype" of index in DB2 nosql, the default value is "varchar".
2. It will create an index for "timestamp" filed when using 'ceilometer-dbsync' command, but the 'datatype' is set to "varchar".
3. We should create an index for "timestamp" filed with a "datatype" set to "TIMESTAMP"

nosql>db.meter.getIndexes()
[{"v":0,"_id":121,"key":{"_id_":1},"ns":"CEILODB2.meter","name":"_id_","unique":true,"datatype":"CHAR(12) FOR BIT DATA","datalength":13000,"idxtype":"typemarker"}, {"v":0,"_id":131,"key":{"timestamp":-1},"ns":"CEILODB2.meter","name":"timestamp_idx","unique":false,"datatype":"TIMESTAMP","datalength":0,"idxtype":"function_na"}]

Also, I noticed that DB2 nosql can automatically create the suitable index type when you create an index on the collection which already has documents. We can make full use of this function to resolve this problem I think.

Lan Qi song (lqslan)
Changed in ceilometer:
assignee: nobody → Lan Qi song (lqslan)
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/147766

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

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

commit b2fd1dee45c19477223286f8be2118e584d9b3eb
Author: lqslan <email address hidden>
Date: Fri Jan 16 11:31:55 2015 +0800

    [DB2 nosql] Create TIMESTAMP type index for 'timestamp' field

    Currently, when doing ceilometer-dbsync, ceilometer will create an
    index for 'timestamp' field of meter collection. But the datatype
    of the field is set to 'VARCHAR' which is not correct.

    The patch insert a document with 'timestamp' before creating the
    index of 'timestamp', then DB2 nosql will create the correct index
    type for 'timestamp' field.

    Change-Id: I69dd2fc8d552f5dbb2485c2a5eab55b3bee71e29
    Closes-Bug: #1411492

Changed in ceilometer:
status: In Progress → Fix Committed
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/150223

Eoghan Glynn (eglynn)
Changed in ceilometer:
milestone: none → kilo-2
importance: Undecided → Medium
Eoghan Glynn (eglynn)
no longer affects: ceilometer/kilo
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to ceilometer (stable/juno)

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

commit d5262707a9956c58db203c6b792ae94140588191
Author: lqslan <email address hidden>
Date: Fri Jan 16 11:31:55 2015 +0800

    [DB2 nosql] Create TIMESTAMP type index for 'timestamp' field

    Currently, when doing ceilometer-dbsync, ceilometer will create an
    index for 'timestamp' field of meter collection. But the datatype
    of the field is set to 'VARCHAR' which is not correct.

    The patch insert a document with 'timestamp' before creating the
    index of 'timestamp', then DB2 nosql will create the correct index
    type for 'timestamp' field.

    Change-Id: I69dd2fc8d552f5dbb2485c2a5eab55b3bee71e29
    Closes-Bug: #1411492
    (cherry picked from commit b2fd1dee45c19477223286f8be2118e584d9b3eb)

Thierry Carrez (ttx)
Changed in ceilometer:
status: Fix Committed → Fix Released
Thierry Carrez (ttx)
Changed in ceilometer:
milestone: kilo-2 → 2015.1.0
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.