summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
dcea4ae)
Use the sessiond_trace_chunk_registry_session_created() and
sessiond_trace_chunk_registry_session_destroyed() to allow the
sessiond trace chunk registry the ability to manage trace chunk
registries associated with the various session daemons from which
the consumer daemon connections originate.
These notifiers effectively manipulate the reference count (and
create/destroy, as needed) of the lttng_trace_chunk_registry
associated with each session daemon (using their UUID).
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
int cmd_create_session_2_11(const struct lttng_buffer_view *payload,
char *session_name, char *hostname,
int cmd_create_session_2_11(const struct lttng_buffer_view *payload,
char *session_name, char *hostname,
- uint32_t *live_timer, bool *snapshot)
+ uint32_t *live_timer, bool *snapshot,
+ lttng_uuid sessiond_uuid)
{
int ret;
struct lttcomm_relayd_create_session_2_11 header;
{
int ret;
struct lttcomm_relayd_create_session_2_11 header;
header.hostname_len = be32toh(header.hostname_len);
header.live_timer = be32toh(header.live_timer);
header.hostname_len = be32toh(header.hostname_len);
header.live_timer = be32toh(header.live_timer);
+ lttng_uuid_copy(sessiond_uuid, header.sessiond_uuid);
+
received_names_size = header.session_name_len + header.hostname_len;
if (payload->size < header_len + received_names_size) {
ERR("Unexpected payload size in \"cmd_create_session_2_11\": expected >= %zu bytes, got %zu bytes",
received_names_size = header.session_name_len + header.hostname_len;
if (payload->size < header_len + received_names_size) {
ERR("Unexpected payload size in \"cmd_create_session_2_11\": expected >= %zu bytes, got %zu bytes",
#include "lttng-relayd.h"
#include <common/buffer-view.h>
#include "lttng-relayd.h"
#include <common/buffer-view.h>
+#include <common/compat/uuid.h>
int cmd_create_session_2_11(const struct lttng_buffer_view *payload,
char *session_name, char *hostname,
int cmd_create_session_2_11(const struct lttng_buffer_view *payload,
char *session_name, char *hostname,
- uint32_t *live_timer, bool *snapshot);
+ uint32_t *live_timer, bool *snapshot,
+ lttng_uuid sessiond_uuid);
int cmd_recv_stream_2_11(const struct lttng_buffer_view *payload,
char **ret_path_name, char **ret_channel_name,
int cmd_recv_stream_2_11(const struct lttng_buffer_view *payload,
char **ret_path_name, char **ret_channel_name,
#include <common/hashtable/hashtable.h>
#include <common/hashtable/hashtable.h>
+struct sessiond_trace_chunk_registry;
+
/*
* Queue used to enqueue relay requests
*/
/*
* Queue used to enqueue relay requests
*/
extern struct lttng_ht *sessions_ht;
extern struct lttng_ht *relay_streams_ht;
extern struct lttng_ht *viewer_streams_ht;
extern struct lttng_ht *sessions_ht;
extern struct lttng_ht *relay_streams_ht;
extern struct lttng_ht *viewer_streams_ht;
+extern struct sessiond_trace_chunk_registry *sessiond_trace_chunk_registry;
extern char *opt_output_path;
extern const char *tracing_group_name;
extern char *opt_output_path;
extern const char *tracing_group_name;
#include "connection.h"
#include "tracefile-array.h"
#include "tcp_keep_alive.h"
#include "connection.h"
#include "tracefile-array.h"
#include "tcp_keep_alive.h"
+#include "sessiond-trace-chunks.h"
static const char *help_msg =
#ifdef LTTNG_EMBED_HELP
static const char *help_msg =
#ifdef LTTNG_EMBED_HELP
/* Relayd health monitoring */
struct health_app *health_relayd;
/* Relayd health monitoring */
struct health_app *health_relayd;
+struct sessiond_trace_chunk_registry *sessiond_trace_chunk_registry;
+
static struct option long_options[] = {
{ "control-port", 1, 0, 'C', },
{ "data-port", 1, 0, 'D', },
static struct option long_options[] = {
{ "control-port", 1, 0, 'C', },
{ "data-port", 1, 0, 'D', },
char hostname[LTTNG_HOST_NAME_MAX];
uint32_t live_timer = 0;
bool snapshot = false;
char hostname[LTTNG_HOST_NAME_MAX];
uint32_t live_timer = 0;
bool snapshot = false;
+ /* Left nil for peers < 2.11. */
+ lttng_uuid sessiond_uuid = {};
memset(session_name, 0, LTTNG_NAME_MAX);
memset(hostname, 0, LTTNG_HOST_NAME_MAX);
memset(session_name, 0, LTTNG_NAME_MAX);
memset(hostname, 0, LTTNG_HOST_NAME_MAX);
} else {
/* From 2.11 to ... */
ret = cmd_create_session_2_11(payload, session_name,
} else {
/* From 2.11 to ... */
ret = cmd_create_session_2_11(payload, session_name,
- hostname, &live_timer, &snapshot);
+ hostname, &live_timer, &snapshot,
+ sessiond_uuid);
+ if (lttng_uuid_is_nil(sessiond_uuid)) {
+ /* The nil UUID is reserved for pre-2.11 clients. */
+ ERR("Illegal nil UUID announced by peer in create session command");
+ ret = -1;
+ goto send_reply;
+ }
}
session = session_create(session_name, hostname, live_timer,
}
session = session_create(session_name, hostname, live_timer,
- snapshot, conn->major, conn->minor);
+ snapshot, sessiond_uuid, conn->major, conn->minor);
if (!session) {
ret = -1;
goto send_reply;
if (!session) {
ret = -1;
goto send_reply;
+ sessiond_trace_chunk_registry = sessiond_trace_chunk_registry_create();
+ if (!sessiond_trace_chunk_registry) {
+ ERR("Failed to initialize session daemon trace chunk registry");
+ retval = -1;
+ goto exit_sessiond_trace_chunk_registry;
+ }
+
/* Initialize thread health monitoring */
health_relayd = health_app_create(NR_HEALTH_RELAYD_TYPES);
if (!health_relayd) {
/* Initialize thread health monitoring */
health_relayd = health_app_create(NR_HEALTH_RELAYD_TYPES);
if (!health_relayd) {
exit_init_data:
health_app_destroy(health_relayd);
exit_init_data:
health_app_destroy(health_relayd);
+ sessiond_trace_chunk_registry_destroy(sessiond_trace_chunk_registry);
+exit_sessiond_trace_chunk_registry:
exit_options:
/*
* Wait for all pending call_rcu work to complete before tearing
exit_options:
/*
* Wait for all pending call_rcu work to complete before tearing
#include "ctf-trace.h"
#include "session.h"
#include "stream.h"
#include "ctf-trace.h"
#include "session.h"
#include "stream.h"
+#include "sessiond-trace-chunks.h"
/* Global session id used in the session creation. */
static uint64_t last_relay_session_id;
/* Global session id used in the session creation. */
static uint64_t last_relay_session_id;
*/
struct relay_session *session_create(const char *session_name,
const char *hostname, uint32_t live_timer,
*/
struct relay_session *session_create(const char *session_name,
const char *hostname, uint32_t live_timer,
- bool snapshot, uint32_t major, uint32_t minor)
+ bool snapshot, const lttng_uuid sessiond_uuid,
+ uint32_t major, uint32_t minor)
struct relay_session *session;
session = zmalloc(sizeof(*session));
struct relay_session *session;
session = zmalloc(sizeof(*session));
session->live_timer = live_timer;
session->snapshot = snapshot;
session->live_timer = live_timer;
session->snapshot = snapshot;
+ lttng_uuid_copy(session->sessiond_uuid, sessiond_uuid);
+
+ ret = sessiond_trace_chunk_registry_session_created(
+ sessiond_trace_chunk_registry, sessiond_uuid);
+ if (ret) {
+ goto error;
+ }
lttng_ht_add_unique_u64(sessions_ht, &session->session_n);
return session;
lttng_ht_add_unique_u64(sessions_ht, &session->session_n);
return session;
ret = session_delete(session);
assert(!ret);
ret = session_delete(session);
assert(!ret);
+ ret = sessiond_trace_chunk_registry_session_destroyed(
+ sessiond_trace_chunk_registry, session->sessiond_uuid);
+ assert(!ret);
call_rcu(&session->rcu_node, rcu_destroy_session);
}
call_rcu(&session->rcu_node, rcu_destroy_session);
}
#include <lttng/constant.h>
#include <common/hashtable/hashtable.h>
#include <lttng/constant.h>
#include <common/hashtable/hashtable.h>
+#include <common/compat/uuid.h>
/*
* Represents a session for the relay point of view
/*
* Represents a session for the relay point of view
* It is used to match a set of streams to their session.
*/
uint64_t id;
* It is used to match a set of streams to their session.
*/
uint64_t id;
+ lttng_uuid sessiond_uuid;
char session_name[LTTNG_NAME_MAX];
char hostname[LTTNG_HOST_NAME_MAX];
uint32_t live_timer;
char session_name[LTTNG_NAME_MAX];
char hostname[LTTNG_HOST_NAME_MAX];
uint32_t live_timer;
struct relay_session *session_create(const char *session_name,
const char *hostname, uint32_t live_timer,
struct relay_session *session_create(const char *session_name,
const char *hostname, uint32_t live_timer,
- bool snapshot, uint32_t major, uint32_t minor);
+ bool snapshot, const lttng_uuid sessiond_uuid,
+ uint32_t major, uint32_t minor);
struct relay_session *session_get_by_id(uint64_t id);
bool session_get(struct relay_session *session);
void session_put(struct relay_session *session);
struct relay_session *session_get_by_id(uint64_t id);
bool session_get(struct relay_session *session);
void session_put(struct relay_session *session);