Remove error count property of lttng_condition_on_event
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 15 Apr 2021 17:21:14 +0000 (13:21 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 18 Apr 2021 23:28:57 +0000 (19:28 -0400)
Errors related to dropped tracer messages are not reported through
the error query interface.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Change-Id: Ib5f8bf841f37d98b582209abb44ab8a26c8fbbc6

include/lttng/condition/on-event-internal.h
src/bin/lttng-sessiond/notification-thread-events.c
src/bin/lttng-sessiond/ust-app.c
src/bin/lttng-sessiond/ust-app.h
src/common/conditions/on-event.c
tests/unit/test_condition.c

index 1ccabf3f4ef04a057d68fce262f5d044712a819b..29a2b27b587ccc2e083798be4c709af7f35f7d72 100644 (file)
@@ -25,7 +25,6 @@ struct lttng_condition_on_event {
        struct lttng_condition parent;
        struct lttng_event_rule *rule;
 
-       LTTNG_OPTIONAL(uint64_t) error_count;
        /*
         * Internal use only.
         * Error accounting counter index.
@@ -71,14 +70,6 @@ LTTNG_HIDDEN
 uint64_t lttng_condition_on_event_get_error_counter_index(
                const struct lttng_condition *condition);
 
-LTTNG_HIDDEN
-uint64_t lttng_condition_on_event_get_error_count(
-               const struct lttng_condition *condition);
-
-LTTNG_HIDDEN
-void lttng_condition_on_event_set_error_count(struct lttng_condition *condition,
-               uint64_t error_count);
-
 LTTNG_HIDDEN
 struct lttng_evaluation *lttng_evaluation_on_event_create(
                const struct lttng_condition_on_event *condition,
index 5cccc008efbc409fb3797590aaae22bcf6c1c823..23614b0db65d0a776161bf821e0880677e092333 100644 (file)
@@ -2174,40 +2174,6 @@ end:
        return ret;
 }
 
-static
-int condition_on_event_update_error_count(struct lttng_trigger *trigger)
-{
-       int ret = 0;
-       uint64_t error_count = 0;
-       struct lttng_condition *condition;
-       enum event_notifier_error_accounting_status status;
-
-       condition = lttng_trigger_get_condition(trigger);
-       assert(lttng_condition_get_type(condition) ==
-                       LTTNG_CONDITION_TYPE_ON_EVENT);
-
-       status = event_notifier_error_accounting_get_count(trigger, &error_count);
-       if (status != EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK) {
-               uid_t trigger_owner_uid;
-               const char *trigger_name;
-               const enum lttng_trigger_status trigger_status =
-                               lttng_trigger_get_owner_uid(
-                                               trigger, &trigger_owner_uid);
-
-               assert(trigger_status == LTTNG_TRIGGER_STATUS_OK);
-               if (lttng_trigger_get_name(trigger, &trigger_name) != LTTNG_TRIGGER_STATUS_OK) {
-                       trigger_name = "(unnamed)";
-               }
-
-               ERR("Failed to get event notifier error count of trigger for update: trigger owner = %d, trigger name = '%s'",
-                               trigger_owner_uid, trigger_name);
-               ret = -1;
-       }
-
-       lttng_condition_on_event_set_error_count(condition, error_count);
-       return ret;
-}
-
 int handle_notification_thread_remove_tracer_event_source_no_result(
                struct notification_thread_state *state,
                int tracer_event_source_fd)
@@ -2255,12 +2221,6 @@ static int handle_notification_thread_command_list_triggers(
                        continue;
                }
 
-               if (lttng_trigger_needs_tracer_notifier(trigger_ht_element->trigger)) {
-                       ret = condition_on_event_update_error_count(
-                                       trigger_ht_element->trigger);
-                       assert(!ret);
-               }
-
                ret = lttng_triggers_add(local_triggers,
                                trigger_ht_element->trigger);
                if (ret < 0) {
index 3af7e394786c33c8a4eba27223165f148703ad20..54cd14ee3523955d28cd6ea4685a5f305a7170a9 100644 (file)
@@ -5991,20 +5991,6 @@ void ust_app_global_update_all_event_notifier_rules(void)
        rcu_read_unlock();
 }
 
-void ust_app_update_event_notifier_error_count(struct lttng_trigger *trigger)
-{
-       uint64_t error_count = 0;
-       enum event_notifier_error_accounting_status status;
-       struct lttng_condition *condition = lttng_trigger_get_condition(trigger);
-
-       status = event_notifier_error_accounting_get_count(trigger, &error_count);
-       if (status != EVENT_NOTIFIER_ERROR_ACCOUNTING_STATUS_OK) {
-               ERR("Error getting trigger error count.");
-       }
-
-       lttng_condition_on_event_set_error_count(condition, error_count);
-}
-
 /*
  * Add context to a specific channel for global UST domain.
  */
index 3dfb562150fe437f4263000fca9e4cc2fde20eae..6cdb261ae5610147c9fd8068d2aec8df3a9ff8be 100644 (file)
@@ -360,8 +360,6 @@ void ust_app_global_update_all(struct ltt_ust_session *usess);
 void ust_app_global_update_event_notifier_rules(struct ust_app *app);
 void ust_app_global_update_all_event_notifier_rules(void);
 
-void ust_app_update_event_notifier_error_count(struct lttng_trigger *trigger);
-
 void ust_app_clean_list(void);
 int ust_app_ht_alloc(void);
 struct ust_app *ust_app_find_by_pid(pid_t pid);
index 9a9e7620af596837c2c5a839225749847f9122a5..d86563b264441513c278df2f9b76592942fb308c 100644 (file)
@@ -27,8 +27,6 @@
        (lttng_condition_get_type(condition) == \
                        LTTNG_CONDITION_TYPE_ON_EVENT)
 
-typedef LTTNG_OPTIONAL(uint64_t) optional_uint64;
-
 static bool is_on_event_evaluation(const struct lttng_evaluation *evaluation)
 {
        enum lttng_condition_type type = lttng_evaluation_get_type(evaluation);
@@ -286,7 +284,6 @@ static int lttng_condition_on_event_serialize(
        enum lttng_condition_status status;
        /* Used for iteration and communication (size matters). */
        uint32_t i, capture_descr_count;
-       LTTNG_OPTIONAL_COMM(typeof(on_event_condition->error_count.value)) error_count_comm;
 
        if (!condition || !IS_ON_EVENT_CONDITION(condition)) {
                ret = -1;
@@ -303,30 +300,6 @@ static int lttng_condition_on_event_serialize(
                goto end;
        }
 
-       error_count_comm = (typeof(error_count_comm)) {
-               .is_set = on_event_condition->error_count.is_set,
-               .value = on_event_condition->error_count.value,
-       };
-
-       {
-               char error_count_value_str[MAX_INT_DEC_LEN(on_event_condition->error_count.value)];
-               const int fmt_ret = snprintf(error_count_value_str,
-                               sizeof(error_count_value_str), "%" PRIu64,
-                               on_event_condition->error_count.value);
-
-               assert(fmt_ret > 0);
-               DBG("Serializing event rule condition's error count: value = %s",
-                               on_event_condition->error_count.is_set ?
-                                               error_count_value_str :
-                                               "(unset)");
-       }
-
-       ret = lttng_dynamic_buffer_append(&payload->buffer, &error_count_comm,
-                       sizeof(error_count_comm));
-       if (ret) {
-               goto end;
-       }
-
        status = lttng_condition_on_event_get_capture_descriptor_count(
                        condition, &capture_descr_count);
        if (status != LTTNG_CONDITION_STATUS_OK) {
@@ -533,112 +506,6 @@ end:
        return ret;
 }
 
-static
-int optional_uint_from_buffer(
-               const struct lttng_buffer_view *view,
-               size_t inner_value_size,
-               size_t *offset,
-               optional_uint64 *value)
-{
-       int ret;
-
-       /*
-        * Those cases are identical except for the optional's inner type width.
-        */
-       switch (inner_value_size) {
-       case sizeof(uint8_t):
-       {
-               LTTNG_OPTIONAL_COMM(uint8_t) *value_comm;
-               const struct lttng_buffer_view optional_uint_view =
-                               lttng_buffer_view_from_view(view, *offset,
-                                                           sizeof(*value_comm));
-
-               if (!lttng_buffer_view_is_valid(&optional_uint_view)) {
-                       ret = -1;
-                       goto end;
-               }
-
-               value_comm = (typeof(value_comm)) optional_uint_view.data;
-               *value = (typeof(*value)) {
-                       .is_set = value_comm->is_set,
-                       .value = (uint64_t) value_comm->value,
-               };
-
-               *offset += sizeof(*value_comm);
-               break;
-       }
-       case sizeof(uint16_t):
-       {
-               LTTNG_OPTIONAL_COMM(uint16_t) *value_comm;
-               const struct lttng_buffer_view optional_uint_view =
-                               lttng_buffer_view_from_view(view, *offset,
-                                               sizeof(*value_comm));
-
-               if (!lttng_buffer_view_is_valid(&optional_uint_view)) {
-                       ret = -1;
-                       goto end;
-               }
-
-               value_comm = (typeof(value_comm)) optional_uint_view.data;
-               *value = (typeof(*value)) {
-                       .is_set = value_comm->is_set,
-                       .value = (uint64_t) value_comm->value,
-               };
-
-               *offset += sizeof(*value_comm);
-               break;
-       }
-       case sizeof(uint32_t):
-       {
-               LTTNG_OPTIONAL_COMM(uint32_t) *value_comm;
-               const struct lttng_buffer_view optional_uint_view =
-                               lttng_buffer_view_from_view(view, *offset,
-                                               sizeof(*value_comm));
-
-               if (!lttng_buffer_view_is_valid(&optional_uint_view)) {
-                       ret = -1;
-                       goto end;
-               }
-
-               value_comm = (typeof(value_comm)) optional_uint_view.data;
-               *value = (typeof(*value)) {
-                       .is_set = value_comm->is_set,
-                       .value = (uint64_t) value_comm->value,
-               };
-
-               *offset += sizeof(*value_comm);
-               break;
-       }
-       case sizeof(uint64_t):
-       {
-               LTTNG_OPTIONAL_COMM(uint64_t) *value_comm;
-               const struct lttng_buffer_view optional_uint_view =
-                               lttng_buffer_view_from_view(view, *offset,
-                                               sizeof(*value_comm));
-
-               if (!lttng_buffer_view_is_valid(&optional_uint_view)) {
-                       ret = -1;
-                       goto end;
-               }
-
-               value_comm = (typeof(value_comm)) optional_uint_view.data;
-               *value = (typeof(*value)) {
-                       .is_set = value_comm->is_set,
-                       .value = (uint64_t) value_comm->value,
-               };
-
-               *offset += sizeof(*value_comm);
-               break;
-       }
-       default:
-               abort();
-       }
-
-       ret = 0;
-end:
-       return ret;
-}
-
 static
 const char *str_from_buffer(const struct lttng_buffer_view *view,
                size_t *offset)
@@ -763,12 +630,10 @@ ssize_t lttng_condition_on_event_create_from_payload(
                struct lttng_payload_view *view,
                struct lttng_condition **_condition)
 {
-       int optional_ret;
        ssize_t consumed_length;
        size_t offset = 0;
        ssize_t event_rule_length;
        uint32_t i, capture_descr_count;
-       optional_uint64 error_count;
        struct lttng_condition *condition = NULL;
        struct lttng_event_rule *event_rule = NULL;
 
@@ -791,25 +656,12 @@ ssize_t lttng_condition_on_event_create_from_payload(
 
        offset += event_rule_length;
 
-       /* Error count. */
-       optional_ret = optional_uint_from_buffer(&view->buffer,
-                       sizeof(error_count.value), &offset,
-                       &error_count);
-       if (optional_ret) {
-               goto error;
-       }
-
        /* Create condition (no capture descriptors yet) at this point */
        condition = lttng_condition_on_event_create(event_rule);
        if (!condition) {
                goto error;
        }
 
-       if (error_count.is_set) {
-               lttng_condition_on_event_set_error_count(
-                               condition, error_count.value);
-       }
-
        /* Capture descriptor count. */
        assert(event_rule_length >= 0);
        capture_descr_count = uint_from_buffer(&view->buffer, sizeof(uint32_t), &offset);
@@ -911,27 +763,6 @@ uint64_t lttng_condition_on_event_get_error_counter_index(
        return LTTNG_OPTIONAL_GET(on_event_cond->error_counter_index);
 }
 
-LTTNG_HIDDEN
-void lttng_condition_on_event_set_error_count(struct lttng_condition *condition,
-               uint64_t error_count)
-{
-       struct lttng_condition_on_event *on_event_cond =
-                       container_of(condition,
-                               struct lttng_condition_on_event, parent);
-
-       LTTNG_OPTIONAL_SET(&on_event_cond->error_count, error_count);
-}
-
-uint64_t lttng_condition_on_event_get_error_count(
-               const struct lttng_condition *condition)
-{
-       const struct lttng_condition_on_event *on_event_cond =
-                       container_of(condition,
-                               const struct lttng_condition_on_event, parent);
-
-       return LTTNG_OPTIONAL_GET(on_event_cond->error_count);
-}
-
 enum lttng_condition_status
 lttng_condition_on_event_append_capture_descriptor(
                struct lttng_condition *condition,
index f4bc040d08f0d19c2896269122fed2bb94abafdf..e2e35a3bc7eafc3634ee27bea5677f86494c7cb2 100644 (file)
@@ -32,7 +32,7 @@ int lttng_opt_quiet = 1;
 int lttng_opt_verbose;
 int lttng_opt_mi;
 
-#define NUM_TESTS 14
+#define NUM_TESTS 13
 
 static
 void test_condition_event_rule(void)
@@ -47,7 +47,6 @@ void test_condition_event_rule(void)
        const char *pattern="my_event_*";
        const char *filter="msg_id == 23 && size >= 2048";
        const char *exclusions[] = { "my_event_test1", "my_event_test2", "my_event_test3" };
-       uint64_t _error_count = 420, error_count;
        struct lttng_log_level_rule *log_level_rule_at_least_as_severe = NULL;
        struct lttng_payload buffer;
 
@@ -82,9 +81,6 @@ void test_condition_event_rule(void)
        condition = lttng_condition_on_event_create(tracepoint);
        ok(condition, "Created condition");
 
-       /* Set the error count information. */
-       lttng_condition_on_event_set_error_count(condition, _error_count);
-
        condition_status = lttng_condition_on_event_get_rule(
                        condition, &tracepoint_tmp);
        ok(condition_status == LTTNG_CONDITION_STATUS_OK,
@@ -107,12 +103,6 @@ void test_condition_event_rule(void)
        ok(lttng_condition_is_equal(condition, condition_from_buffer),
                        "Serialized and de-serialized conditions are equal");
 
-       /*
-        * Error count info is not considered in is_equal; test it separately.
-        */
-       error_count = lttng_condition_on_event_get_error_count(condition_from_buffer);
-       ok(error_count == _error_count, "Error count is the same. Got %" PRIu64 " Expected %" PRIu64, error_count, _error_count);
-
        lttng_payload_reset(&buffer);
        lttng_event_rule_destroy(tracepoint);
        lttng_condition_destroy(condition);
This page took 0.046733 seconds and 4 git commands to generate.