X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Frotate.c;h=17d3c51fdbf0823adb32d4bd3aab8606058df2f7;hp=dac0f2a1fda8145cfa8f7fdbca724a2890257f87;hb=92816cc33a1add3c8276839bd6335e17423577dd;hpb=d9f0c7c7ce520c309f8e7148ecaff9aacbe52b55 diff --git a/src/bin/lttng-sessiond/rotate.c b/src/bin/lttng-sessiond/rotate.c index dac0f2a1f..17d3c51fd 100644 --- a/src/bin/lttng-sessiond/rotate.c +++ b/src/bin/lttng-sessiond/rotate.c @@ -1,5 +1,6 @@ /* * Copyright (C) 2017 - Julien Desfossez + * Copyright (C) 2018 - Jérémie Galarneau * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License, version 2 only, as @@ -48,44 +49,6 @@ #include #include -unsigned long hash_channel_key(struct rotation_channel_key *key) -{ - return hash_key_u64(&key->key, lttng_ht_seed) ^ hash_key_ulong( - (void *) (unsigned long) key->domain, lttng_ht_seed); -} - -int rotate_add_channel_pending(uint64_t key, enum lttng_domain_type domain, - struct ltt_session *session) -{ - int ret; - struct rotation_channel_info *new_info; - struct rotation_channel_key channel_key = { .key = key, - .domain = domain }; - - new_info = zmalloc(sizeof(struct rotation_channel_info)); - if (!new_info) { - goto error; - } - - new_info->channel_key.key = key; - new_info->channel_key.domain = domain; - new_info->session_id = session->id; - cds_lfht_node_init(&new_info->rotate_channels_ht_node); - - session->nr_chan_rotate_pending++; - cds_lfht_add(channel_pending_rotate_ht, - hash_channel_key(&channel_key), - &new_info->rotate_channels_ht_node); - - ret = 0; - goto end; - -error: - ret = -1; -end: - return ret; -} - /* The session's lock must be held by the caller. */ static int session_rename_chunk(struct ltt_session *session, char *current_path, @@ -208,7 +171,7 @@ error: * * Returns 0 on success, a negative value on error. */ -int rename_complete_chunk(struct ltt_session *session, time_t ts) +int rename_completed_chunk(struct ltt_session *session, time_t ts) { struct tm *timeinfo; char new_path[LTTNG_PATH_MAX]; @@ -357,53 +320,6 @@ end: return ret; } -int relay_rotate_pending(struct ltt_session *session, uint64_t chunk_id) -{ - int ret; - struct consumer_socket *socket; - struct consumer_output *output; - struct lttng_ht_iter iter; - - /* - * Either one of the sessions is enough to find the consumer_output - * and uid/gid. - */ - if (session->kernel_session) { - output = session->kernel_session->consumer; - } else if (session->ust_session) { - output = session->ust_session->consumer; - } else { - assert(0); - } - - if (!output || !output->socks) { - ERR("No consumer output found"); - ret = -1; - goto end; - } - - ret = -1; - - rcu_read_lock(); - /* - * We have to iterate to find a socket, but we only need to send the - * rotate pending command to one consumer, so we break after the first - * one. - */ - cds_lfht_for_each_entry(output->socks->ht, &iter.iter, socket, - node.node) { - pthread_mutex_lock(socket->lock); - ret = consumer_rotate_pending_relay(socket, output, session->id, - chunk_id); - pthread_mutex_unlock(socket->lock); - break; - } - rcu_read_unlock(); - -end: - return ret; -} - int subscribe_session_consumed_size_rotation(struct ltt_session *session, uint64_t size, struct notification_thread_handle *notification_thread_handle) {