X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Frotation-thread.cpp;h=aa6ba07800d6dac81340405c6023e9d9d4dc3fa1;hb=88277a52069ed0135254ce29da617ebb6ecddbb8;hp=c1c6c50debb4953c0f6c757cf9daa2cee51a9419;hpb=c08136a3fab16fd3f620c8bcd93f25ea68382d00;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/rotation-thread.cpp b/src/bin/lttng-sessiond/rotation-thread.cpp index c1c6c50de..aa6ba0780 100644 --- a/src/bin/lttng-sessiond/rotation-thread.cpp +++ b/src/bin/lttng-sessiond/rotation-thread.cpp @@ -257,8 +257,7 @@ int init_poll_set(struct lttng_poll_event *poll_set, } ret = lttng_poll_add(poll_set, - lttng_pipe_get_readfd(handle->quit_pipe), - LPOLLIN | LPOLLERR); + lttng_pipe_get_readfd(handle->quit_pipe), LPOLLIN); if (ret < 0) { ERR("Failed to add quit pipe read fd to poll set"); goto error; @@ -266,7 +265,7 @@ int init_poll_set(struct lttng_poll_event *poll_set, ret = lttng_poll_add(poll_set, lttng_pipe_get_readfd(handle->rotation_timer_queue->event_pipe), - LPOLLIN | LPOLLERR); + LPOLLIN); if (ret < 0) { ERR("Failed to add rotate_pending fd to poll set"); goto error; @@ -310,7 +309,7 @@ int init_thread_state(struct rotation_thread_handle *handle, goto end; } ret = lttng_poll_add(&state->events, rotate_notification_channel->socket, - LPOLLIN | LPOLLERR); + LPOLLIN); if (ret < 0) { ERR("Failed to add notification fd to pollset"); goto end; @@ -487,9 +486,7 @@ int check_session_rotation_pending(struct ltt_session *session, location = session_get_trace_archive_location(session); ret = notification_thread_command_session_rotation_completed( notification_thread_handle, - session->name, - session->uid, - session->gid, + session->id, session->last_archived_chunk_id.value, location); lttng_trace_archive_location_put(location); @@ -695,19 +692,28 @@ int handle_condition(const struct lttng_notification *notification, goto end_unlock; } - ret = cmd_rotate_session(session, NULL, false, - LTTNG_TRACE_CHUNK_COMMAND_TYPE_MOVE_TO_COMPLETED); - if (ret == -LTTNG_ERR_ROTATION_PENDING) { + ret = cmd_rotate_session( + session, NULL, false, LTTNG_TRACE_CHUNK_COMMAND_TYPE_MOVE_TO_COMPLETED); + switch (ret) { + case LTTNG_OK: + break; + case -LTTNG_ERR_ROTATION_PENDING: DBG("Rotate already pending, subscribe to the next threshold value"); - } else if (ret != LTTNG_OK) { - ERR("Failed to rotate on size notification with error: %s", - lttng_strerror(ret)); + break; + case -LTTNG_ERR_ROTATION_MULTIPLE_AFTER_STOP: + DBG("Rotation already happened since last stop, subscribe to the next threshold value"); + break; + case -LTTNG_ERR_ROTATION_AFTER_STOP_CLEAR: + DBG("Rotation already happened since last stop and clear, subscribe to the next threshold value"); + break; + default: + ERR("Failed to rotate on size notification with error: %s", lttng_strerror(ret)); ret = -1; goto end_unlock; } - ret = subscribe_session_consumed_size_rotation(session, - consumed + session->rotate_size, - notification_thread_handle); + + ret = subscribe_session_consumed_size_rotation( + session, consumed + session->rotate_size, notification_thread_handle); if (ret) { ERR("Failed to subscribe to session consumed size condition"); goto end_unlock;