relayd: implement file and session rotation on top of trace chunks
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 1 Aug 2019 18:42:32 +0000 (14:42 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 5 Sep 2019 20:39:14 +0000 (16:39 -0400)
commit84a93c0895b299b5bbca122a0cf399b12b8a8e63
tree14bb2be3786eef7cbebc624e62122f523396e203
parent2238ee81be8df1c02a55c731ad9a52a4c0b219a6
relayd: implement file and session rotation on top of trace chunks

Implement the file and session rotation functionality on top of the
trace chunk API. This ensures that a relay_stream and lttng_index_file
are always explicitly associated to a trace chunk and hold a reference
to it as long as their underlying files are contained within a given
trace chunk.

A number of relay_stream specific functions are moved to stream.c as
"methods" of the relay_stream interface in order to make use of
internal relay_stream helpers.

As part of this clean-up/move of the relay_stream code, raw payload
buffer handling has been replaced to use the lttng_buffer_view
interface which provides implicit bounds checking of the payload
buffers.

The stream rotation has been modified to reference a "new chunk id"
which is the ID of the trace chunk to which streams should rotate
"into". The command has also been modified to apply on a set of
streams. This is done in order to limit the number of commands on the
control socket. Conversely, all path names have been removed from the
command's payload.

The index file implementation now acquires a reference to the trace
chunk from which it is created. This affects the consumer daemon as
this code is shared with the relay daemon. This ensures that a chunk
is not released (and its close command executed, if any) before all
file descriptors related to it have been closed. Respecting this
guarantee is very important as the upcoming fd-cache will remove
the guarantee that an "fd" to a given file is always held open.
Moreover, close commands can rename a trace chunk's folders which
would cause files to be created in the wrong folder if they are
not properly created through the trace chunk.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
23 files changed:
include/lttng/lttng-error.h
src/bin/lttng-relayd/ctf-trace.h
src/bin/lttng-relayd/index.c
src/bin/lttng-relayd/index.h
src/bin/lttng-relayd/main.c
src/bin/lttng-relayd/session.c
src/bin/lttng-relayd/sessiond-trace-chunks.c
src/bin/lttng-relayd/stream.c
src/bin/lttng-relayd/stream.h
src/common/compat/directory-handle.c
src/common/consumer/consumer-stream.h
src/common/consumer/consumer.c
src/common/consumer/consumer.h
src/common/error.c
src/common/index/index.c
src/common/index/index.h
src/common/relayd/relayd.c
src/common/relayd/relayd.h
src/common/sessiond-comm/relayd.h
src/common/sessiond-comm/sessiond-comm.h
src/common/trace-chunk.c
src/common/utils.c
src/common/utils.h
This page took 0.027423 seconds and 4 git commands to generate.