Consumer rotate a channel
[lttng-tools.git] / src / common / ust-consumer / ust-consumer.c
index 6030ca182fd19e5c3078473611ffe1e1ab1c6f8d..6873273a3aa939ac166c97e939745238cce71ee5 100644 (file)
@@ -1960,6 +1960,45 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                }
                break;
        }
+       case LTTNG_CONSUMER_ROTATE_CHANNEL:
+       {
+               /*
+                * Sample the rotate position of all the streams in this channel.
+                */
+               ret = lttng_consumer_rotate_channel(msg.u.rotate_channel.key,
+                               msg.u.rotate_channel.pathname,
+                               msg.u.rotate_channel.relayd_id,
+                               msg.u.rotate_channel.metadata,
+                               msg.u.rotate_channel.new_chunk_id,
+                               ctx);
+               if (ret < 0) {
+                       ERR("Rotate channel failed");
+                       ret_code = LTTCOMM_CONSUMERD_CHAN_NOT_FOUND;
+               }
+
+               health_code_update();
+
+               ret = consumer_send_status_msg(sock, ret_code);
+               if (ret < 0) {
+                       /* Somehow, the session daemon is not responding anymore. */
+                       goto end_nosignal;
+               }
+
+               /*
+                * Rotate the streams that are ready right now.
+                * FIXME: this is a second consecutive iteration over the
+                * streams in a channel, there is probably a better way to
+                * handle this, but it needs to be after the
+                * consumer_send_status_msg() call.
+                */
+               ret = lttng_consumer_rotate_ready_streams(
+                               msg.u.rotate_channel.key, ctx);
+               if (ret < 0) {
+                       ERR("Rotate channel failed");
+                       ret_code = LTTCOMM_CONSUMERD_CHAN_NOT_FOUND;
+               }
+               break;
+       }
        case LTTNG_CONSUMER_ROTATE_RENAME:
        {
                DBG("Consumer rename session %" PRIu64 " after rotation",
This page took 0.024236 seconds and 4 git commands to generate.