cmd_ret = LTTNG_ERR_ROTATION_MULTIPLE_AFTER_STOP;
goto end;
}
-
- session->rotation_state = LTTNG_ROTATION_STATE_ONGOING;
-
if (session->active) {
new_trace_chunk = session_create_new_trace_chunk(session, NULL,
NULL, NULL);
goto error;
}
- assert(chunk_being_archived);
- chunk_status = lttng_trace_chunk_get_id(chunk_being_archived,
- &ongoing_rotation_chunk_id);
- assert(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
-
if (session->kernel_session) {
cmd_ret = kernel_rotate_session(session);
if (cmd_ret != LTTNG_OK) {
}
}
+ if (!session->active) {
+ session->rotated_after_last_stop = true;
+ }
+
+ if (!chunk_being_archived) {
+ DBG("Rotating session \"%s\" from a \"NULL\" trace chunk to a new trace chunk, skipping completion check",
+ session->name);
+ if (failed_to_rotate) {
+ cmd_ret = rotation_fail_code;
+ goto error;
+ }
+ cmd_ret = LTTNG_OK;
+ goto end;
+ }
+
+ session->rotation_state = LTTNG_ROTATION_STATE_ONGOING;
+ chunk_status = lttng_trace_chunk_get_id(chunk_being_archived,
+ &ongoing_rotation_chunk_id);
+ assert(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
+
ret = session_close_trace_chunk(session, chunk_being_archived,
quiet_rotation ?
NULL :
goto error;
}
- if (!session->active) {
- session->rotated_after_last_stop = true;
- }
-
if (rotate_return) {
rotate_return->rotation_id = ongoing_rotation_chunk_id;
}