- rcu_read_lock();
- if (session->ust_session) {
- cds_lfht_first(session->ust_session->consumer->socks->ht,
- &iter);
- output = session->ust_session->consumer;
- } else {
- cds_lfht_first(session->kernel_session->consumer->socks->ht,
- &iter);
- output = session->kernel_session->consumer;
- }
- assert(cds_lfht_iter_get_node(&iter));
-
- socket = caa_container_of(cds_lfht_iter_get_node(&iter),
- typeof(*socket), node.node);
-
- 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,
+ chunk_status = lttng_trace_chunk_get_id(
+ session->chunk_being_archived,
+ &chunk_being_archived_id);
+ assert(chunk_status == LTTNG_TRACE_CHUNK_STATUS_OK);
+ DBG("[rotation-thread] Rotation of trace archive %" PRIu64 " of session \"%s\" is complete on all consumers",
+ chunk_being_archived_id,