Store the instance id and packet_seq_num in indexes
authorJulien Desfossez <jdesfossez@efficios.com>
Mon, 6 Jul 2015 17:22:51 +0000 (13:22 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 11 Mar 2016 04:27:58 +0000 (23:27 -0500)
Signed-off-by: Julien Desfossez <jdesfossez@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-relayd/main.c
src/common/index/ctf-index.h
src/common/kernel-consumer/kernel-consumer.c
src/common/relayd/relayd.c
src/common/sessiond-comm/relayd.h
src/common/ust-consumer/ust-consumer.c

index 7fc2fb50374afd3840376726d067c15f2cacffb2..e4ded2b8655d17c5f270bd67cfffca65697766f8 100644 (file)
@@ -1036,7 +1036,8 @@ error_testpoint:
  * Set index data from the control port to a given index object.
  */
 static int set_index_control_data(struct relay_index *index,
-               struct lttcomm_relayd_index *data)
+               struct lttcomm_relayd_index *data,
+               struct relay_connection *conn)
 {
        struct ctf_packet_index index_data;
 
@@ -1052,6 +1053,12 @@ static int set_index_control_data(struct relay_index *index,
        index_data.timestamp_end = data->timestamp_end;
        index_data.events_discarded = data->events_discarded;
        index_data.stream_id = data->stream_id;
+
+       if (conn->minor >= 8) {
+               index->index_data.stream_instance_id = data->stream_instance_id;
+               index->index_data.packet_seq_num = data->packet_seq_num;
+       }
+
        return relay_index_set_data(index, &index_data);
 }
 
@@ -1925,7 +1932,7 @@ static int relay_recv_index(struct lttcomm_relayd_hdr *recv_hdr,
                ERR("relay_index_get_by_id_or_create index NULL");
                goto end_stream_put;
        }
-       if (set_index_control_data(index, &index_info)) {
+       if (set_index_control_data(index, &index_info, conn)) {
                ERR("set_index_control_data error");
                relay_index_put(index);
                ret = -1;
index 1f38d9ab031fc9e08579179d94c573731489d614..8755f1218ad3d114ac8f464051de42d7f92d23af 100644 (file)
@@ -29,7 +29,7 @@
 
 #define CTF_INDEX_MAGIC 0xC1F1DCC1
 #define CTF_INDEX_MAJOR 1
-#define CTF_INDEX_MINOR 0
+#define CTF_INDEX_MINOR 1
 
 /*
  * Header at the beginning of each index file.
@@ -54,7 +54,10 @@ struct ctf_packet_index {
        uint64_t timestamp_begin;
        uint64_t timestamp_end;
        uint64_t events_discarded;
-       uint64_t stream_id;
+       uint64_t stream_id;             /* ID of the channel */
+       /* CTF_INDEX 1.0 limit */
+       uint64_t stream_instance_id;    /* ID of the channel instance */
+       uint64_t packet_seq_num;        /* packet sequence number */
 } __attribute__((__packed__));
 
 #endif /* LTTNG_INDEX_H */
index 42d471d1a9a040b10e6ee48b56d66f34544f8091..e5c0c2e83a3930e1079ef96d056767b64893a7c7 100644 (file)
@@ -1093,6 +1093,20 @@ static int get_index_values(struct ctf_packet_index *index, int infd)
        }
        index->stream_id = htobe64(index->stream_id);
 
+       ret = kernctl_get_instance_id(infd, &index->stream_instance_id);
+       if (ret < 0) {
+               PERROR("kernctl_get_instance_id");
+               goto error;
+       }
+       index->stream_instance_id = htobe64(index->stream_instance_id);
+
+       ret = kernctl_get_sequence_number(infd, &index->packet_seq_num);
+       if (ret < 0) {
+               PERROR("kernctl_get_sequence_number");
+               goto error;
+       }
+       index->packet_seq_num = htobe64(index->packet_seq_num);
+
 error:
        return ret;
 }
index fade4b11ed56bc77750bfaed592008c9655e8b33..60b7ee84970d89dfa1125c5b46a62387dff0b1d6 100644 (file)
@@ -851,6 +851,11 @@ int relayd_send_index(struct lttcomm_relayd_sock *rsock,
        msg.events_discarded = index->events_discarded;
        msg.stream_id = index->stream_id;
 
+       if (rsock->minor >= 8) {
+               msg.stream_instance_id = index->stream_instance_id;
+               msg.packet_seq_num = index->packet_seq_num;
+       }
+
        /* Send command */
        ret = send_command(rsock, RELAYD_SEND_INDEX, &msg, sizeof(msg), 0);
        if (ret < 0) {
index 4d751b86d91d22dee618f2231342cebddc8d5e08..358123273fb20a757f3da8dbca6ba999921eb532 100644 (file)
@@ -159,6 +159,8 @@ struct lttcomm_relayd_index {
        uint64_t timestamp_end;
        uint64_t events_discarded;
        uint64_t stream_id;
+       uint64_t stream_instance_id;
+       uint64_t packet_seq_num;
 } LTTNG_PACKED;
 
 /*
index 5b4b1496556ad298349e407a7e077413d758a121..5686fbd09fe58966cebf3f3be70bf8ec9acd339e 100644 (file)
@@ -2079,6 +2079,20 @@ static int get_index_values(struct ctf_packet_index *index,
        }
        index->stream_id = htobe64(index->stream_id);
 
+       ret = ustctl_get_instance_id(ustream, &index->stream_instance_id);
+       if (ret < 0) {
+               PERROR("ustctl_get_instance_id");
+               goto error;
+       }
+       index->stream_instance_id = htobe64(index->stream_instance_id);
+
+       ret = ustctl_get_sequence_number(ustream, &index->packet_seq_num);
+       if (ret < 0) {
+               PERROR("ustctl_get_sequence_number");
+               goto error;
+       }
+       index->packet_seq_num = htobe64(index->packet_seq_num);
+
 error:
        return ret;
 }
This page took 0.039814 seconds and 4 git commands to generate.