Add support for non unique add string in hashtable

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Generate local kernel and UST indexes

When the consumer creates a new trace file, it now creates as well an
index file that the viewers can use to navigate in the trace.  For now
these indexes are only local and not sent to the relayd.

This patch requires additionnal ioctl and ustctl calls implemented in
lttng-modules and lttng-ust in 2.4.

For now, no indexes are sent over the network and no indexes are
generated on snaphots.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Bump version to 2.4.0-pre1

We need to bump the version early in the development cycle since we
extend the relayd protocol.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Live timer set up

Add a new option to create to enable the live_timer being --live at
session creation. A new API call is added also to create as session in
live mode like the snapshot feature.

This timer is responsible to check all streams of a live session and
make sure the viewer receives periodic updates even for low-throughput
channels.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
HT support for keys with two uint64_t

Add the support in the hashtable abstraction layer to handle a key
composed of a two uint64_t.

The hash function is a simple XOR between the two hashes and the compare
function resolves the eventual collisions by comparing the two values.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Send indexes in streaming mode

To write an index on disk, we need to know all the fields sent by the
RELAY_SEND_INDEX command as well as the offset of the data in the
tracefile.

Since the control and data connection are not synchronized, this process
happens in two separate steps synchronized by an HT indexed by the
index_handle and the net_seq_num.

When we receive data and when we receive an index, we lookup in the HT
if an entry already exists. If it does, it means that we only need to
fill the fields we just received and write the index on disk, otherwise,
we allocate a new index, set the fields we know and store it in the HT.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: return -errno value on error in run_as mkdir

Signed-off-by: David Goulet <dgoulet@ev0ke.net>
Implement the relayd live features

The live-reading feature allows a user to read the trace while it is
being recorded. In order to work, this feature requires the trace to be
streamed to lttng-relayd. Then, a viewer can connect to the relayd, list
the sessions, attach to one, and start reading the data. The
live-reading protocol, enforces the viewer to read all the metadata
before trying to read the trace, and checks all the streams for new
activity at a user-defined rate (configured by the new --live parameter
during the session creation).

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Test for new metadata at each packet

After sending each data packet in live, we need to check if new metadata
is available before sending the index informing the viewer it can read
the trace.

Since the data and the metadata are handled by two different threads,
this patch introduces a rendez-vous point: if new metadata is available,
the data thread flushes the metadata stream and waits on a conditionnal
variable. When the metadata thread finishes to send its data, it wakes
up the data thread which can send its index.

That way, the viewer is informed new metadata is available before
attempting to read a packet that might require an update of the
metadata.

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: compile without UST support

Signed-off-by: David Goulet <dgoulet@efficios.com>
Make viewer streams HT global

This hash table is meant to be global by design thus making it globally
accessible in the relayd so we don't pass it around in every function
call.

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: assign values to relayd connection type enum

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: rename close_stream and use it in delete session

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: make indexes HT global for real

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: add index destruction in destroy stream call

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: don't create index on snapshot

Signed-off-by: David Goulet <dgoulet@efficios.com>
Fix: add missing break in switch for relayd create session

Signed-off-by: David Goulet <dgoulet@efficios.com>
Relicense lttng-index and lttng-viewer to BSD

Signed-off-by: David Goulet <dgoulet@efficios.com>
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Documentation of live usage and protocol

Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Fix: remove debug error message

Signed-off-by: David Goulet <dgoulet@efficios.com>