From: Jérémie Galarneau Date: Thu, 4 Jul 2019 13:03:54 +0000 (-0400) Subject: relayd: Transmit current trace chunk id in create_sesssion command X-Git-Tag: v2.12.0-rc1~538 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=f39bd140151b845f44abd6a7079eaaf5cfed1c89;p=lttng-tools.git relayd: Transmit current trace chunk id in create_sesssion command The relay daemon needs the current chunk id to query (when it is set) the sessiond trace chunk registry and retrieve the instance of the trace chunk if it is already available during the session's creation. Signed-off-by: Jérémie Galarneau --- diff --git a/src/common/relayd/relayd.c b/src/common/relayd/relayd.c index ed788b993..90c6649ac 100644 --- a/src/common/relayd/relayd.c +++ b/src/common/relayd/relayd.c @@ -129,7 +129,8 @@ error: static int relayd_create_session_2_11(struct lttcomm_relayd_sock *rsock, const char *session_name, const char *hostname, int session_live_timer, unsigned int snapshot, - uint64_t sessiond_session_id, const lttng_uuid sessiond_uuid) + uint64_t sessiond_session_id, const lttng_uuid sessiond_uuid, + const uint64_t *current_chunk_id) { int ret; struct lttcomm_relayd_create_session_2_11 *msg = NULL; @@ -170,6 +171,11 @@ static int relayd_create_session_2_11(struct lttcomm_relayd_sock *rsock, lttng_uuid_copy(msg->sessiond_uuid, sessiond_uuid); msg->session_id = htobe64(sessiond_session_id); + if (current_chunk_id) { + LTTNG_OPTIONAL_SET(&msg->current_chunk_id, + htobe64(*current_chunk_id)); + } + /* Send command */ ret = send_command(rsock, RELAYD_CREATE_SESSION, msg, msg_length, 0); if (ret < 0) { @@ -241,7 +247,8 @@ int relayd_create_session(struct lttcomm_relayd_sock *rsock, const char *session_name, const char *hostname, int session_live_timer, unsigned int snapshot, uint64_t sessiond_session_id, - const lttng_uuid sessiond_uuid) + const lttng_uuid sessiond_uuid, + const uint64_t *current_chunk_id) { int ret; struct lttcomm_relayd_status_session reply; @@ -262,7 +269,8 @@ int relayd_create_session(struct lttcomm_relayd_sock *rsock, /* From 2.11 to ... */ ret = relayd_create_session_2_11(rsock, session_name, hostname, session_live_timer, snapshot, - sessiond_session_id, sessiond_uuid); + sessiond_session_id, sessiond_uuid, + current_chunk_id); } if (ret < 0) { diff --git a/src/common/sessiond-comm/relayd.h b/src/common/sessiond-comm/relayd.h index b5948cc4a..fd456a3a1 100644 --- a/src/common/sessiond-comm/relayd.h +++ b/src/common/sessiond-comm/relayd.h @@ -27,6 +27,7 @@ #include #include #include +#include #define RELAYD_VERSION_COMM_MAJOR VERSION_MAJOR #define RELAYD_VERSION_COMM_MINOR VERSION_MINOR @@ -211,6 +212,7 @@ struct lttcomm_relayd_create_session_2_11 { lttng_uuid sessiond_uuid; /* Sessiond session id */ uint64_t session_id; + LTTNG_OPTIONAL_COMM(uint64_t) current_chunk_id; /* Contains the session_name and hostname */ char names[]; } LTTNG_PACKED;