- session->rotate_pending_relay = false;
- session->rotation_state = LTTNG_ROTATION_STATE_COMPLETED;
- } else if (ret == 1) {
- DBG("[rotation-thread] Rotation still pending on the relay for "
- "session %" PRIu64, session->id);
- ret = sessiond_timer_rotate_pending_start(session,
- DEFAULT_ROTATE_PENDING_RELAY_TIMER);
+ ret = notification_thread_command_session_rotation_ongoing(
+ notification_thread_handle,
+ session->name,
+ session->uid,
+ session->gid,
+ session->current_archive_id);
+ if (ret != LTTNG_OK) {
+ ERR("[rotation-thread] Failed to notify notification thread of completed rotation for session %s",
+ session->name);
+ }
+
+ ret = rename_active_chunk(session);
+ if (ret < 0) {
+ ERR("[rotation-thread] Failed to rename active rotation chunk");
+ goto end;
+ }
+
+ /* 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("[rotation-thread] Failed to notify notification thread of completed rotation for session %s",
+ session->name);
+ }
+ }
+
+ ret = 0;
+end:
+ if (session->rotation_state == LTTNG_ROTATION_STATE_ONGOING) {
+ DBG("[rotation-thread] Rotation of trace archive %" PRIu64 " is still pending for session %s",
+ session->current_archive_id - 1, session->name);
+ ret = timer_session_rotation_pending_check_start(session,
+ DEFAULT_ROTATE_PENDING_TIMER);