+ pthread_mutex_lock(socket->lock);
+ DBG("[rotation-thread] Checking for pending relay rotation on session \"%s\", trace archive %" PRIu64 " through the %s consumer",
+ session->name, session->current_archive_id - 1,
+ lttng_consumer_type_str(socket->type));
+ ret = consumer_check_rotation_pending_relay(socket,
+ output,
+ session->id,
+ session->current_archive_id - 1);
+ pthread_mutex_unlock(socket->lock);
+
+ if (ret == 0) {
+ /* Rotation was completed on the relay. */
+ DBG("[rotation-thread] Relay rotation of trace archive %" PRIu64 " of session \"%s\" was completed",
+ session->current_archive_id - 1,
+ session->name);
+ } else if (ret == 1) {
+ /* Rotation pending on relay. */
+ DBG("[rotation-thread] Relay rotation of trace archive %" PRIu64 " of session \"%s\" is pending",
+ session->current_archive_id - 1,
+ session->name);
+ rotation_completed = false;
+ } else {
+ /* Not a fatal error. */
+ ERR("[rotation-thread] Encountered an error when checking if rotation of trace archive %" PRIu64 " of session \"%s\" is pending on the relay",
+ session->current_archive_id - 1,
+ session->name);
+ ret = session_reset_rotation_state(session,
+ LTTNG_ROTATION_STATE_ERROR);
+ if (ret) {
+ ERR("Failed to reset rotation state of session \"%s\"",
+ session->name);