tmf: Fix wrong interval returns in the history backend
authorAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Sat, 28 Apr 2012 09:11:57 +0000 (05:11 -0400)
committerAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Sat, 28 Apr 2012 09:20:35 +0000 (05:20 -0400)
commit1d3d1293b5f7130e81fddfcbb292b157d53870bc
tree6352d157d17e2c665cf239f07afc979beb9f7ffb
parent3c10e4712ecbd67371eed54b939f8ac9b7c4b680
tmf: Fix wrong interval returns in the history backend

Since intervals are sorted (by end time) in their nodes,
the algorithm to pick the correct interval during a query
would first find the "starting point", where the intervals
can begin intersecting the target time.

Then, it would iterate over the remainder of the list, but only
comparing the *start* times, since we know that at this point,
the end times should all fit in.

Turns out this is not the case! It's possible for a node's end
time to be greater than its last intervals' end times. So if a
query was done in this "empty space", the node could wrongly
return an interval whose start time fits, but not its end time!

If every other condition is respected, now we additionally check
the end time too. This avoids a potential infinite loop during
range queries.

Also updated the tests accordingly.

Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
org.eclipse.linuxtools.lttng2.kernel.core.tests/src/org/eclipse/linuxtools/lttng2/kernel/core/tests/stateprovider/StateSystemFullHistoryTest.java
org.eclipse.linuxtools.tmf.core/src/org/eclipse/linuxtools/tmf/core/statesystem/backend/historytree/HTNode.java
This page took 0.026422 seconds and 5 git commands to generate.