Fix: lttng-consumerd: cpu hotplug: send "streams_sent" command
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 11 May 2017 20:00:56 +0000 (16:00 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 22 May 2017 10:44:34 +0000 (06:44 -0400)
When creating a new channel, the streams being sent to the relayd are
kept invisible to the live client until the "streams_sent" command is
received. This ensures the client does not see a partial stream set.

This "streams_sent" command needs to be sent on CPU hotplug too,
otherwise the live client handling within relayd is not aware of those
streams (they are never published).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/common/consumer/consumer.h
src/common/kernel-consumer/kernel-consumer.c

index 37adecbfe689e28a79303c601cefbe2ea6311677..66092d3c5bc5888b0c2aa603a9c2255532c50af8 100644 (file)
@@ -218,6 +218,8 @@ struct lttng_consumer_channel {
        uint64_t discarded_events;
        /* Total number of missed packets due to overwriting (overwrite). */
        uint64_t lost_packets;
+
+       bool streams_sent_to_relayd;
 };
 
 /*
index cc06847c9d8f57ecd8f1467d49e9cd3b0f2c1f2f..5a8157eb5e0256f055edeed168a6a4dad34d3090 100644 (file)
@@ -182,6 +182,7 @@ int lttng_kconsumer_snapshot_channel(uint64_t key, char *path,
                                ERR("sending streams sent to relayd");
                                goto end_unlock;
                        }
+                       channel->streams_sent_to_relayd = true;
                }
 
                ret = kernctl_buffer_flush(stream->wait_fd);
@@ -716,6 +717,19 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                                consumer_stream_free(new_stream);
                                goto end_nosignal;
                        }
+
+                       /*
+                        * If adding an extra stream to an already
+                        * existing channel (e.g. cpu hotplug), we need
+                        * to send the "streams_sent" command to relayd.
+                        */
+                       if (channel->streams_sent_to_relayd) {
+                               ret = consumer_send_relayd_streams_sent(
+                                               new_stream->net_seq_idx);
+                               if (ret < 0) {
+                                       goto end_nosignal;
+                               }
+                       }
                }
 
                /* Get the right pipe where the stream will be sent. */
@@ -809,6 +823,7 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                        if (ret < 0) {
                                goto end_nosignal;
                        }
+                       channel->streams_sent_to_relayd = true;
                }
                break;
        }
This page took 0.028927 seconds and 4 git commands to generate.