relayd: tracefile array: Allow head position to skip ahead
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 9 Dec 2019 15:09:05 +0000 (10:09 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 19 Dec 2019 22:24:44 +0000 (17:24 -0500)
The clear feature needs to move the head position ahead (jump)
over sequence numbers.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: I08482bd13dd748621968c43de7647f9d19670880
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-relayd/stream.c
src/bin/lttng-relayd/tracefile-array.c
src/bin/lttng-relayd/tracefile-array.h

index 427d30a00602c7448223e2c58b27f4eab9b9bf58..d34158bd22dd0f1895f31419869979c356aee935 100644 (file)
@@ -1160,7 +1160,7 @@ int stream_update_index(struct relay_stream *stream, uint64_t net_seq_num,
        ret = relay_index_try_flush(index);
        if (ret == 0) {
                tracefile_array_file_rotate(stream->tfa, TRACEFILE_ROTATE_READ);
-               tracefile_array_commit_seq(stream->tfa);
+               tracefile_array_commit_seq(stream->tfa, stream->index_received_seqcount);
                stream->index_received_seqcount++;
                LTTNG_OPTIONAL_SET(&stream->received_packet_seq_num,
                        be64toh(index->index_data.packet_seq_num));
@@ -1256,7 +1256,7 @@ int stream_add_index(struct relay_stream *stream,
        ret = relay_index_try_flush(index);
        if (ret == 0) {
                tracefile_array_file_rotate(stream->tfa, TRACEFILE_ROTATE_READ);
-               tracefile_array_commit_seq(stream->tfa);
+               tracefile_array_commit_seq(stream->tfa, stream->index_received_seqcount);
                stream->index_received_seqcount++;
                stream->pos_after_last_complete_data_index += index->total_size;
                stream->prev_index_seq = index_info->net_seq_num;
index a52ccd550823fdeeeaf9f892cbd7e09a74d0959e..c7a86966fc5d6bff46b41b00a8513b8f82b0e290 100644 (file)
@@ -120,15 +120,16 @@ void tracefile_array_file_rotate(struct tracefile_array *tfa,
        }
 }
 
-void tracefile_array_commit_seq(struct tracefile_array *tfa)
+void tracefile_array_commit_seq(struct tracefile_array *tfa,
+               uint64_t new_seq_head)
 {
        uint64_t *headp, *tailp;
 
        /* Increment overall head. */
-       tfa->seq_head++;
-       /* If we are committing our first index overall, set tail to 0. */
+       tfa->seq_head = new_seq_head;
+       /* If we are committing our first index overall, set tail to head. */
        if (tfa->seq_tail == -1ULL) {
-               tfa->seq_tail = 0;
+               tfa->seq_tail = new_seq_head;
        }
        if (!tfa->count) {
                /* Not in tracefile rotation mode. */
index 53b32d9f5167bddbef5e5ef0e244069c08b23a8e..dc556733b4c1fe556362341b7fe244b96d4f6106 100644 (file)
@@ -64,7 +64,8 @@ struct tracefile_array *tracefile_array_create(size_t count);
 void tracefile_array_destroy(struct tracefile_array *tfa);
 
 void tracefile_array_file_rotate(struct tracefile_array *tfa, enum tracefile_rotate_type type);
-void tracefile_array_commit_seq(struct tracefile_array *tfa);
+void tracefile_array_commit_seq(struct tracefile_array *tfa,
+               uint64_t new_seq_head);
 void tracefile_array_reset(struct tracefile_array *tfa);
 
 uint64_t tracefile_array_get_read_file_index_head(struct tracefile_array *tfa);
This page took 0.027341 seconds and 4 git commands to generate.