/* New domain path: <session>/<start-date>-<end-date>-<rotate-count>/kernel */
snprintf(tmppath2, PATH_MAX, "%s/%s",
new_path, consumer->subdir);
- fprintf(stderr, "A: %s, B: %s, C: %s\n",
- consumer->dst.net.base_dir, consumer->subdir, new_path);
/*
* Move the per-domain folder inside the first rotation
* folder.
}
stream->index_file = index_file;
stream->out_fd_offset = 0;
- } else {
- switch (consumer_data.type) {
- case LTTNG_CONSUMER_KERNEL:
- /*
- * Reset the position of what has been read from the metadata
- * cache to 0 so we can dump it again.
- */
- ret = kernctl_metadata_cache_dump(stream->wait_fd);
- if (ret < 0) {
- ERR("Failed to dump the kernel metadata cache after rotation");
- goto error;
- }
- break;
- case LTTNG_CONSUMER32_UST:
- case LTTNG_CONSUMER64_UST:
- /*
- * Reset the position pushed from the metadata cache so it
- * will write from the beginning on the next push.
- */
- stream->ust_metadata_pushed = 0;
- break;
- default:
- ERR("Unknown consumer_data type");
- abort();
- }
}
ret = 0;
} else {
ret = rotate_local_stream(ctx, stream);
}
+ if (ret < 0) {
+ goto error;
+ }
+
+ if (stream->metadata_flag) {
+ switch (consumer_data.type) {
+ case LTTNG_CONSUMER_KERNEL:
+ /*
+ * Reset the position of what has been read from the metadata
+ * cache to 0 so we can dump it again.
+ */
+ ret = kernctl_metadata_cache_dump(stream->wait_fd);
+ if (ret < 0) {
+ ERR("Failed to dump the kernel metadata cache after rotation");
+ goto error;
+ }
+ break;
+ case LTTNG_CONSUMER32_UST:
+ case LTTNG_CONSUMER64_UST:
+ /*
+ * Reset the position pushed from the metadata cache so it
+ * will write from the beginning on the next push.
+ */
+ stream->ust_metadata_pushed = 0;
+ break;
+ default:
+ ERR("Unknown consumer_data type");
+ abort();
+ }
+ }
lttng_consumer_reset_stream_rotate_state(stream);
+ ret = 0;
+
+error:
return ret;
}