[lttng-dev] [PATCH lttng-tools 3/5] Fix: consumerd: consumer_stream_write_index error handling
Jérémie Galarneau
jeremie.galarneau at efficios.com
Mon Sep 14 18:04:14 EDT 2015
Not merged, as discussed, since closing the stream will set
net_seq_idx to -1ULL and that the relayd will remain available in the
ht even if we encounter a relayd connection error.
Jérémie
On Wed, Sep 9, 2015 at 11:56 AM, Mathieu Desnoyers
<mathieu.desnoyers at efficios.com> wrote:
> When consumer_stream_write_index cannot find the relay daemon, it
> currently assumes that the reason for this situation is that it should
> write to a file. Add a check to see if indeed we should write to a file,
> of if this is caused by a removed relayd. Return an error and print an
> error to the console in this situation.
>
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers at efficios.com>
> ---
> src/common/consumer-stream.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/src/common/consumer-stream.c b/src/common/consumer-stream.c
> index 604e2f4..23cc882 100644
> --- a/src/common/consumer-stream.c
> +++ b/src/common/consumer-stream.c
> @@ -374,10 +374,18 @@ int consumer_stream_write_index(struct lttng_consumer_stream *stream,
> pthread_mutex_lock(&relayd->ctrl_sock_mutex);
> ret = relayd_send_index(&relayd->control_sock, index,
> stream->relayd_stream_id, stream->next_net_seq_num - 1);
> +
> pthread_mutex_unlock(&relayd->ctrl_sock_mutex);
> } else {
> ssize_t size_ret;
>
> + if (stream->net_seq_idx != -1ULL) {
> + ERR("Cannot find relayd for write index, net_seq_idx %" PRIu64,
> + stream->net_seq_idx);
> + ret = -1;
> + goto error;
> + }
> +
> size_ret = index_write(stream->index_fd, index,
> sizeof(struct ctf_packet_index));
> if (size_ret < sizeof(struct ctf_packet_index)) {
> --
> 2.1.4
>
--
Jérémie Galarneau
EfficiOS Inc.
http://www.efficios.com
More information about the lttng-dev
mailing list