Fix active index's order
Message Controller's active index is not ordere correctly. Since we're using K for sorting operation, it should be in the second position right after the equality filters' indexes ('q'). This is necessary because MongoDB sorts everything before applying range filters ('e', 'c.e') and compound indexes are traversed in order. Without this patch, mongodb would filter records and then sort them in memory w/o using the index. Fixes bug: #1206517 Change-Id: I54ac464ce849f2dcde92a96090c27c489ea80e97
This commit is contained in:
parent
70a3ab6ba1
commit
cef36a25fb
@ -70,14 +70,14 @@ class MessageController(storage.MessageBase):
|
||||
# other places.
|
||||
# * q: Mostly everywhere. It must stay at the
|
||||
# beginning of the index.
|
||||
# * k: Marker and FIFO key (Used mainly for sorting)
|
||||
# * e: Together with q is used for getting a
|
||||
# specific message. (see `get`)
|
||||
self.active_fields = [
|
||||
('q', 1),
|
||||
('k', 1),
|
||||
('e', 1),
|
||||
('c.e', 1),
|
||||
('k', 1),
|
||||
('_id', -1),
|
||||
]
|
||||
|
||||
self._col.ensure_index(self.active_fields,
|
||||
|
Loading…
x
Reference in New Issue
Block a user