Messages _list is not using the right index

Bug #1206128 reported by Flavio Percoco
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
zaqar
Fix Released
High
Flavio Percoco

Bug Description

mongodb's message controller is not using the right index. This can be fix by using hint and passing all indexed fields to the query:

db.messages.find({ "q" : ObjectId("51f280de5e9e4e84eb7eb63d") , "e" : { "$gt" : ISODate("2013-07-29T13:02:29.536Z")}, "c.e" : { "$lte" : ISODate("2013-07-29T13:02:29.536Z")}}).sort({"_id": -1}).explain()

{
        "cursor" : "BtreeCursor claimed",
..................................

The above query should be using the "active" index instead and the marker should always be passed. We can use {"$gt": 0} (or {"$ne": null} ) when it is not needed.

As for the index, we should use hint and tell the query what index to use.

https://github.com/stackforge/marconi/blob/master/marconi/storage/mongodb/messages.py#L76 (Index to hit)

https://github.com/stackforge/marconi/blob/master/marconi/storage/mongodb/messages.py#L267 (marker)

description: updated
Changed in marconi:
importance: Undecided → High
assignee: nobody → Flavio Percoco (flaper87)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to marconi (master)

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

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

Reviewed: https://review.openstack.org/39456
Committed: http://github.com/stackforge/marconi/commit/3d6224a58a82769a14dfb85d0290e170da8a4094
Submitter: Jenkins
Branch: master

commit 3d6224a58a82769a14dfb85d0290e170da8a4094
Author: Flaper Fesp <email address hidden>
Date: Wed Jul 31 13:04:24 2013 +0200

    Tell _list queries what index to use

    This patch adds hint to all _list queries telling them to use the
    'active' index. This can be overriden by the caller of _list but that,
    most likely, won't be necessary. All callers of _list care about getting
    active messages and provide the parameters necessary for that.

    Fixes bug: #1206128

    Change-Id: Ifbe48711825cadd81ebbd5dd07bc9da8a88975fa

Changed in marconi:
status: In Progress → Fix Committed
Changed in marconi:
milestone: none → havana-3
status: Fix Committed → Fix Released
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.