projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix: streaming and snapshot backward compat for relayd < 2.11
[lttng-tools.git]
/
src
/
bin
/
lttng-sessiond
/
cmd.c
diff --git
a/src/bin/lttng-sessiond/cmd.c
b/src/bin/lttng-sessiond/cmd.c
index e8dfbadbf72fbc8a9edee2da53abe0f0f1990c31..4447747de752608f08aa02719af5254ab3f2a26c 100644
(file)
--- a/
src/bin/lttng-sessiond/cmd.c
+++ b/
src/bin/lttng-sessiond/cmd.c
@@
-1038,9
+1038,10
@@
static enum lttng_error_code send_consumer_relayd_socket(
struct consumer_output *consumer,
struct consumer_socket *consumer_sock,
const char *session_name, const char *hostname,
struct consumer_output *consumer,
struct consumer_socket *consumer_sock,
const char *session_name, const char *hostname,
- int session_live_timer,
+
const char *base_path,
int session_live_timer,
const uint64_t *current_chunk_id,
const uint64_t *current_chunk_id,
- time_t session_creation_time)
+ time_t session_creation_time,
+ bool session_name_contains_creation_time)
{
int ret;
struct lttcomm_relayd_sock *rsock = NULL;
{
int ret;
struct lttcomm_relayd_sock *rsock = NULL;
@@
-1068,8
+1069,9
@@
static enum lttng_error_code send_consumer_relayd_socket(
/* Send relayd socket to consumer. */
ret = consumer_send_relayd_socket(consumer_sock, rsock, consumer,
relayd_uri->stype, session_id,
/* Send relayd socket to consumer. */
ret = consumer_send_relayd_socket(consumer_sock, rsock, consumer,
relayd_uri->stype, session_id,
- session_name, hostname, session_live_timer,
- current_chunk_id, session_creation_time);
+ session_name, hostname, base_path,
+ session_live_timer, current_chunk_id,
+ session_creation_time, session_name_contains_creation_time);
if (ret < 0) {
status = LTTNG_ERR_ENABLE_CONSUMER_FAIL;
goto close_sock;
if (ret < 0) {
status = LTTNG_ERR_ENABLE_CONSUMER_FAIL;
goto close_sock;
@@
-1116,8
+1118,9
@@
static enum lttng_error_code send_consumer_relayd_sockets(
enum lttng_domain_type domain,
unsigned int session_id, struct consumer_output *consumer,
struct consumer_socket *sock, const char *session_name,
enum lttng_domain_type domain,
unsigned int session_id, struct consumer_output *consumer,
struct consumer_socket *sock, const char *session_name,
- const char *hostname, int session_live_timer,
- const uint64_t *current_chunk_id, time_t session_creation_time)
+ const char *hostname, const char *base_path, int session_live_timer,
+ const uint64_t *current_chunk_id, time_t session_creation_time,
+ bool session_name_contains_creation_time)
{
enum lttng_error_code status = LTTNG_OK;
{
enum lttng_error_code status = LTTNG_OK;
@@
-1128,8
+1131,9
@@
static enum lttng_error_code send_consumer_relayd_sockets(
if (!sock->control_sock_sent) {
status = send_consumer_relayd_socket(session_id,
&consumer->dst.net.control, consumer, sock,
if (!sock->control_sock_sent) {
status = send_consumer_relayd_socket(session_id,
&consumer->dst.net.control, consumer, sock,
- session_name, hostname, session_live_timer,
- current_chunk_id, session_creation_time);
+ session_name, hostname, base_path, session_live_timer,
+ current_chunk_id, session_creation_time,
+ session_name_contains_creation_time);
if (status != LTTNG_OK) {
goto error;
}
if (status != LTTNG_OK) {
goto error;
}
@@
-1139,8
+1143,9
@@
static enum lttng_error_code send_consumer_relayd_sockets(
if (!sock->data_sock_sent) {
status = send_consumer_relayd_socket(session_id,
&consumer->dst.net.data, consumer, sock,
if (!sock->data_sock_sent) {
status = send_consumer_relayd_socket(session_id,
&consumer->dst.net.data, consumer, sock,
- session_name, hostname, session_live_timer,
- current_chunk_id, session_creation_time);
+ session_name, hostname, base_path, session_live_timer,
+ current_chunk_id, session_creation_time,
+ session_name_contains_creation_time);
if (status != LTTNG_OK) {
goto error;
}
if (status != LTTNG_OK) {
goto error;
}
@@
-1195,9
+1200,11
@@
int cmd_setup_relayd(struct ltt_session *session)
ret = send_consumer_relayd_sockets(LTTNG_DOMAIN_UST, session->id,
usess->consumer, socket,
session->name, session->hostname,
ret = send_consumer_relayd_sockets(LTTNG_DOMAIN_UST, session->id,
usess->consumer, socket,
session->name, session->hostname,
+ session->base_path,
session->live_timer,
current_chunk_id.is_set ? ¤t_chunk_id.value : NULL,
session->live_timer,
current_chunk_id.is_set ? ¤t_chunk_id.value : NULL,
- session->creation_time);
+ session->creation_time,
+ session->name_contains_creation_time);
pthread_mutex_unlock(socket->lock);
if (ret != LTTNG_OK) {
goto error;
pthread_mutex_unlock(socket->lock);
if (ret != LTTNG_OK) {
goto error;
@@
-1219,9
+1226,11
@@
int cmd_setup_relayd(struct ltt_session *session)
ret = send_consumer_relayd_sockets(LTTNG_DOMAIN_KERNEL, session->id,
ksess->consumer, socket,
session->name, session->hostname,
ret = send_consumer_relayd_sockets(LTTNG_DOMAIN_KERNEL, session->id,
ksess->consumer, socket,
session->name, session->hostname,
+ session->base_path,
session->live_timer,
current_chunk_id.is_set ? ¤t_chunk_id.value : NULL,
session->live_timer,
current_chunk_id.is_set ? ¤t_chunk_id.value : NULL,
- session->creation_time);
+ session->creation_time,
+ session->name_contains_creation_time);
pthread_mutex_unlock(socket->lock);
if (ret != LTTNG_OK) {
goto error;
pthread_mutex_unlock(socket->lock);
if (ret != LTTNG_OK) {
goto error;
@@
-2579,8
+2588,7
@@
int cmd_start_trace(struct ltt_session *session)
goto error;
}
goto error;
}
- if (session->output_traces && !session->current_trace_chunk &&
- session_output_supports_trace_chunks(session)) {
+ if (session->output_traces && !session->current_trace_chunk) {
struct lttng_trace_chunk *trace_chunk;
trace_chunk = session_create_new_trace_chunk(
struct lttng_trace_chunk *trace_chunk;
trace_chunk = session_create_new_trace_chunk(
@@
-2872,6
+2880,7
@@
enum lttng_error_code cmd_create_session_from_descriptor(
const char *session_name;
struct ltt_session *new_session = NULL;
enum lttng_session_descriptor_status descriptor_status;
const char *session_name;
struct ltt_session *new_session = NULL;
enum lttng_session_descriptor_status descriptor_status;
+ const char *base_path;
session_lock_list();
if (home_path) {
session_lock_list();
if (home_path) {
@@
-2894,8
+2903,13
@@
enum lttng_error_code cmd_create_session_from_descriptor(
ret_code = LTTNG_ERR_INVALID;
goto end;
}
ret_code = LTTNG_ERR_INVALID;
goto end;
}
+ ret = lttng_session_descriptor_get_base_path(descriptor, &base_path);
+ if (ret) {
+ ret_code = LTTNG_ERR_INVALID;
+ goto end;
+ }
ret_code = session_create(session_name, creds->uid, creds->gid,
ret_code = session_create(session_name, creds->uid, creds->gid,
- &new_session);
+
base_path,
&new_session);
if (ret_code != LTTNG_OK) {
goto end;
}
if (ret_code != LTTNG_OK) {
goto end;
}
@@
-3184,8
+3198,7
@@
int cmd_destroy_session(struct ltt_session *session,
if (reply_context) {
reply_context->implicit_rotation_on_destroy = true;
}
if (reply_context) {
reply_context->implicit_rotation_on_destroy = true;
}
- } else if (session->has_been_started && session->current_trace_chunk &&
- session_output_supports_trace_chunks(session)) {
+ } else if (session->has_been_started && session->current_trace_chunk) {
/*
* The user has not triggered a session rotation. However, to
* ensure all data has been consumed, the session is rotated
/*
* The user has not triggered a session rotation. However, to
* ensure all data has been consumed, the session is rotated
@@
-4229,6
+4242,7
@@
static enum lttng_error_code set_relayd_for_snapshot(
struct lttng_ht_iter iter;
struct consumer_socket *socket;
LTTNG_OPTIONAL(uint64_t) current_chunk_id = {};
struct lttng_ht_iter iter;
struct consumer_socket *socket;
LTTNG_OPTIONAL(uint64_t) current_chunk_id = {};
+ const char *base_path;
assert(output);
assert(session);
assert(output);
assert(session);
@@
-4255,6
+4269,16
@@
static enum lttng_error_code set_relayd_for_snapshot(
goto error;
}
goto error;
}
+ /*
+ * The snapshot record URI base path overrides the session
+ * base path.
+ */
+ if (output->dst.net.control.subdir[0] != '\0') {
+ base_path = output->dst.net.control.subdir;
+ } else {
+ base_path = session->base_path;
+ }
+
/*
* For each consumer socket, create and send the relayd object of the
* snapshot output.
/*
* For each consumer socket, create and send the relayd object of the
* snapshot output.
@@
-4266,9
+4290,11
@@
static enum lttng_error_code set_relayd_for_snapshot(
status = send_consumer_relayd_sockets(0, session->id,
output, socket,
session->name, session->hostname,
status = send_consumer_relayd_sockets(0, session->id,
output, socket,
session->name, session->hostname,
+ base_path,
session->live_timer,
current_chunk_id.is_set ? ¤t_chunk_id.value : NULL,
session->live_timer,
current_chunk_id.is_set ? ¤t_chunk_id.value : NULL,
- session->creation_time);
+ session->creation_time,
+ session->name_contains_creation_time);
pthread_mutex_unlock(socket->lock);
if (status != LTTNG_OK) {
rcu_read_unlock();
pthread_mutex_unlock(socket->lock);
if (status != LTTNG_OK) {
rcu_read_unlock();
@@
-4759,7
+4785,7
@@
int cmd_rotate_session(struct ltt_session *session,
}
/* Unsupported feature in lttng-relayd before 2.11. */
}
/* Unsupported feature in lttng-relayd before 2.11. */
- if (session->consumer->type == CONSUMER_DST_NET &&
+ if (
!quiet_rotation &&
session->consumer->type == CONSUMER_DST_NET &&
(session->consumer->relay_major_version == 2 &&
session->consumer->relay_minor_version < 11)) {
cmd_ret = LTTNG_ERR_ROTATION_NOT_AVAILABLE_RELAY;
(session->consumer->relay_major_version == 2 &&
session->consumer->relay_minor_version < 11)) {
cmd_ret = LTTNG_ERR_ROTATION_NOT_AVAILABLE_RELAY;
This page took
0.025862 seconds
and
4
git commands to generate.