ctf: de-duplicate index entries
authorSimon Marchi <simon.marchi@efficios.com>
Thu, 31 Oct 2019 22:28:54 +0000 (18:28 -0400)
committerSimon Marchi <simon.marchi@efficios.com>
Fri, 15 Nov 2019 18:08:11 +0000 (13:08 -0500)
commit1505f33a1a42c691890dff61aea9762b43d1bca2
treefd811dedfe5ba265951c6218d9a035ec2ff55c36
parent6834784db7638d11ca5b1f7f6e6a26c19e2ad75a
ctf: de-duplicate index entries

When trace snapshots were taken quickly enough, it's possible for them
to overlap.  Some identical packets will be present in multiple
snapshots.

For example, the first snapshot could contain packets A, B and C while
the second snapshot could contain packets B, C, and D.

When reading those snapshots together with babeltrace, we will want to
present a coherent view of the logical trace that is spread across
multiple snapshots.  That is, we will want to avoid reading the packet
twice.

Currently, we're not considering that case when building the building
the in-memory index.  Processing the two streams above will lead to
those entries in the merged index:

 - Packet A (snapshot 1)
 - Packet B (snapshot 1)
 - Packet B (snapshot 2)
 - Packet C (snapshot 1)
 - Packet C (snapshot 2)
 - Packet D (snapshot 2)

This patch makes it so we only keep a single reference to each packet.
If a packet is duplicated, it doesn't matter to which snapshot the
reference points, since all copies of the packet are identical.  So a
possible outcome of the situation above, with this patch applied, could
be:

 - Packet A (snapshot 1)
 - Packet B (snapshot 1)
 - Packet C (snapshot 1)
 - Packet D (snapshot 2)

So far the index is not used for much, so I don't think that this patch
will have any visible behavior change.  However, an upcoming patch will
build on this to make it so we only read each packet once.

Change-Id: I00962d593b5078253043029902f853e5c3fa0dc5
Signed-off-by: Simon Marchi <simon.marchi@efficios.com>
src/plugins/ctf/fs-src/fs.c
This page took 0.02457 seconds and 4 git commands to generate.