ctf: Fix unreliable handling of invalid location
authorMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Mon, 7 Sep 2015 19:15:58 +0000 (15:15 -0400)
committerMarc-Andre Laperle <marc-andre.laperle@ericsson.com>
Thu, 10 Sep 2015 23:20:05 +0000 (19:20 -0400)
commit21924e03d7770a0f2eb98f162e9a17887209385c
treef466d48d69c6278841b5a2b26b84e406eb65edc6
parent45f63682bf726c7908408af26f0512769ca40951
ctf: Fix unreliable handling of invalid location

This could lead to bad seeks when opening experiments (bug 476816).

In experiments, it is often the case (expected) that a seek to a
location will result to an invalid location for one of the traces in
the experiment.

There are issues with the handling of seeking to an invalid
location (CtfLocation.INVALID_LOCATION)
1. In one spot, == is used instead of .equals which means that a
location read from the index is not considered invalid, but rather,
it seeks to an offset of 0.
2. Even if the location is properly considered invalid (== fixed),
the code relies on the "last packet end time" to seek past the end of
the trace which then make the context location become invalid. This
works correctly when the trace was fully read the first time but the
"last packet end time" is not necessarily the end of the trace when
it is opened a second time.

Instead, we can explicitly check for CtfLocation.INVALID_LOCATION
in CtfTmfContext.setLocation and CtfIterator.seek to make sure no
bad seeks occur.

Bug: 476816
Change-Id: I4c74259ae3b67fb22cae302f2d5f09f1adda51f0
Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Reviewed-on: https://git.eclipse.org/r/55429
Reviewed-by: Hudson CI
ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/src/org/eclipse/tracecompass/tmf/ctf/core/tests/AllTests.java
ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/src/org/eclipse/tracecompass/tmf/ctf/core/tests/trace/CtfTmfTraceTest.java
ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/src/org/eclipse/tracecompass/tmf/ctf/core/tests/trace/indexer/AllTests.java [new file with mode: 0644]
ctf/org.eclipse.tracecompass.tmf.ctf.core.tests/src/org/eclipse/tracecompass/tmf/ctf/core/tests/trace/indexer/CtfExperimentCheckpointIndexTest.java [new file with mode: 0644]
ctf/org.eclipse.tracecompass.tmf.ctf.core/src/org/eclipse/tracecompass/internal/tmf/ctf/core/trace/iterator/CtfIterator.java
ctf/org.eclipse.tracecompass.tmf.ctf.core/src/org/eclipse/tracecompass/tmf/ctf/core/context/CtfTmfContext.java
ctf/org.eclipse.tracecompass.tmf.ctf.core/src/org/eclipse/tracecompass/tmf/ctf/core/trace/CtfTmfTrace.java
tmf/org.eclipse.tracecompass.tmf.core.tests/src/org/eclipse/tracecompass/tmf/core/tests/trace/indexer/checkpoint/TmfExperimentCheckpointIndexTest.java
tmf/org.eclipse.tracecompass.tmf.core/src/org/eclipse/tracecompass/tmf/core/trace/indexer/checkpoint/TmfCheckpointIndexer.java
This page took 0.028137 seconds and 5 git commands to generate.