relayd: keep track of prev_index_seq in relayd_stream
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 12 Oct 2018 22:05:10 +0000 (18:05 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 12 Oct 2018 23:55:33 +0000 (19:55 -0400)
The rotation and data pending checks are only performed on the
sequence number of the received data. However, it is expected
that the index of the stream (when applicable) has been written
to disk when those checks say that their respective operations
have completed.

This patch only introduces a new 'prev_index_seq' position that
is updated when an index is flushed to disk.

A follow-up fix addresses the issue mentioned above.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-relayd/main.c
src/bin/lttng-relayd/stream.c
src/bin/lttng-relayd/stream.h

index 5f56ba9b318ea14ec94f66e9c00f7408b8f21f4e..92f9a5600ac28b7280dcea9f1041b7725b13b748 100644 (file)
@@ -2314,6 +2314,7 @@ static int relay_recv_index(const struct lttcomm_relayd_hdr *recv_hdr,
                tracefile_array_commit_seq(stream->tfa);
                stream->index_received_seqcount++;
                stream->pos_after_last_complete_data_index += index->total_size;
+               stream->prev_index_seq = index_info.net_seq_num;
        } else if (ret > 0) {
                /* no flush. */
                ret = 0;
@@ -3482,6 +3483,7 @@ static enum relay_connection_status relay_process_data_receive_payload(
        if (index_flushed) {
                stream->pos_after_last_complete_data_index =
                                stream->tracefile_size_current;
+               stream->prev_index_seq = state->header.net_seq_num;
        }
 
        stream->prev_seq = state->header.net_seq_num;
index 326ec4bf2ff2b970d6d46465c1abe9b949c65456..0ababf28d8d112c55b304d5a1baafb252077fe0e 100644 (file)
@@ -83,6 +83,7 @@ struct relay_stream *stream_create(struct ctf_trace *trace,
 
        stream->stream_handle = stream_handle;
        stream->prev_seq = -1ULL;
+       stream->prev_index_seq = -1ULL;
        stream->last_net_seq_num = -1ULL;
        stream->ctf_stream_id = -1ULL;
        stream->tracefile_size = tracefile_size;
index fb3e1ed68b936e1fd7411273c4b7a9b338f76e0b..151ae25c1ad2be5f3243bc22094c186556a61b29 100644 (file)
@@ -53,6 +53,8 @@ struct relay_stream {
         */
        pthread_mutex_t lock;
        uint64_t prev_seq;              /* previous data sequence number encountered. */
+       /* previous index sequence number written to disk. */
+       uint64_t prev_index_seq;
        uint64_t last_net_seq_num;      /* seq num to encounter before closing. */
 
        /* FD on which to write the stream data. */
This page took 0.037147 seconds and 4 git commands to generate.