#include "cmd.h"
#include "session.h"
#include "sessiond-timer.h"
+#include "notification-thread-commands.h"
#include <urcu.h>
#include <urcu/list.h>
static
void fini_thread_state(struct rotation_thread_state *state)
{
+ int ret;
+
lttng_poll_clean(&state->events);
- cds_lfht_destroy(channel_pending_rotate_ht, NULL);
+ ret = cds_lfht_destroy(channel_pending_rotate_ht, NULL);
+ assert(!ret);
if (rotate_notification_channel) {
lttng_notification_channel_destroy(rotate_notification_channel);
}
goto end_unlock_session;
}
} else {
+ struct lttng_trace_archive_location *location;
+
session->rotation_state = LTTNG_ROTATION_STATE_COMPLETED;
+ /* Ownership of location is transferred. */
+ location = session_get_trace_archive_location(session);
+ ret = notification_thread_command_session_rotation_completed(
+ notification_thread_handle,
+ session->name,
+ session->uid,
+ session->gid,
+ session->current_archive_id,
+ location);
+ if (ret != LTTNG_OK) {
+ ERR("Failed to notify notification thread that rotation is complete for session %s",
+ session->name);
+ }
+
}
DBG("Rotation completed for session %s", session->name);
}
goto end;
}
if (ret == 0) {
+ struct lttng_trace_archive_location *location;
+
DBG("[rotation-thread] Rotation completed on the relay for "
"session %" PRIu64, session->id);
/*
*/
session->rotate_pending_relay = false;
session->rotation_state = LTTNG_ROTATION_STATE_COMPLETED;
+
+ session->rotation_state = LTTNG_ROTATION_STATE_COMPLETED;
+ /* Ownership of location is transferred. */
+ location = session_get_trace_archive_location(session);
+ ret = notification_thread_command_session_rotation_completed(
+ notification_thread_handle,
+ session->name,
+ session->uid,
+ session->gid,
+ session->current_archive_id,
+ location);
+ if (ret != LTTNG_OK) {
+ ERR("Failed to notify notification thread that rotation is complete for session %s",
+ session->name);
+ }
} else if (ret == 1) {
DBG("[rotation-thread] Rotation still pending on the relay for "
"session %" PRIu64, session->id);