Bug 26773

Summary: ordering issue for log-manager when tries to sort() messages
Product: Telepathy Reporter: Cosimo Alfarano <cosimo.alfarano>
Component: loggerAssignee: Telepathy bugs list <telepathy-bugs>
Status: RESOLVED WORKSFORME QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: normal    
Priority: medium CC: nicolas
Version: 0.9   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Cosimo Alfarano 2010-02-26 05:49:50 UTC
shortly:
messages having the same timestamp in the same logstore should be returned by the log-manager methods in the stored order.

It for sure affects tpl_log_manager_get_filtered_messages(), maybe other methods.

explanation:
log-manager sometimes sort logentries, this because it queries multiple logstores and then merges entries together before returning.

When entries have the same timestamp (granularity is second, so it is possible to happen), they are returned reversed respect the stored order.

Example:

in logstore those messages are stored in this order (format = timestamp + text):
time='20100226T12:39:03' 1
time='20100226T12:39:04' 2
time='20100226T12:39:04' 3
time='20100226T12:39:05' 4
time='20100226T12:39:05' 5
time='20100226T12:39:05' 6

if tpl_log_manager_get_filtered_messages() is used getting the last 5 lines (as empathy does), the result will be:

3
2
6
5
4

which means that the methods sorts '2','3' (TS1=12:39:03) and '4', '5','6' (TS1=12:39:04), returning them in reverse order within the group, but sorted correctly chronologically (TS1<TS2)

I'd expect, because of the storing order:
2
3
4
5
6

"time='20100226T12:39:03' 1" is correctly skipped since I wanted only the last 5 messages.
Comment 1 Cosimo Alfarano 2010-02-26 05:51:52 UTC
This should be reviewd after updating the LogStore interface and the LogManager using GDate and adding the flag to select the returned order (most recent first, or oldest first).
Comment 2 Nicolas Dufresne 2011-01-13 14:18:40 UTC
And this is perfect case for unit test !
Comment 3 Nicolas Dufresne 2011-10-31 10:59:58 UTC
I suspect this issue no longer exist, I have pretty much re-written all the merge algorithm.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.