From: Jérémie Galarneau Date: Thu, 1 Aug 2019 18:42:32 +0000 (-0400) Subject: relayd: implement file and session rotation on top of trace chunks X-Git-Url: http://git.efficios.com/?a=commitdiff_plain;h=c35f9726a22f1d93e14589688d830efccda196f3;hp=c35f9726a22f1d93e14589688d830efccda196f3;p=lttng-tools.git 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 ---