mongodb driver does not create indices on project_id as intended
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Ceilometer |
Fix Released
|
High
|
Eoghan Glynn |
Bug Description
The mongodb driver clearly intends to create indices for both user_id and project_id on the meter and resource collections:
https:/
However since it uses the same per-collection index name on each iteration of the index-creating for loop, the project_id indices are never created:
> db.meter.
[
{
"v" : 1,
"key" : {
"_id" : 1
},
"ns" : "ceilometer.meter",
"name" : "_id_"
},
{
"v" : 1,
"key" : {
"resource_id" : 1,
"user_id" : 1,
"counter_name" : 1,
"timestamp" : 1,
"source" : 1
},
"ns" : "ceilometer.meter",
"name" : "meter_idx"
},
{
"v" : 1,
"key" : {
"timestamp" : -1
},
"ns" : "ceilometer.meter",
"name" : "timestamp_idx"
}
]
> db.resource.
[
{
"v" : 1,
"key" : {
"_id" : 1
},
"ns" : "ceilometer.
"name" : "_id_"
},
{
"v" : 1,
"key" : {
"user_id" : 1,
"source" : 1
},
"ns" : "ceilometer.
"name" : "resource_idx"
},
{
"v" : 1,
"key" : {
"last_
},
"ns" : "ceilometer.
"sparse" : true,
"name" : "last_sample_
}
]
Instead, a distinguished index name should be used for the project_id index in each case (e.g. meter_project_
Also this new index should be created with background=True to avoid slow start-up on upgrade with large existing collections.
Changed in ceilometer: | |
importance: | Undecided → High |
assignee: | nobody → Eoghan Glynn (eglynn) |
milestone: | none → icehouse-rc1 |
status: | New → In Progress |
description: | updated |
Changed in ceilometer: | |
status: | Fix Committed → Fix Released |
Changed in ceilometer: | |
milestone: | icehouse-rc1 → 2014.1 |
Fix proposed to branch: master /review. openstack. org/80118
Review: https:/