Fix: include the filter expression in agent events' primary key
authorAlexandre Montplaisir <alexmonthy@efficios.com>
Fri, 11 Sep 2015 22:38:52 +0000 (18:38 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Mon, 2 Nov 2015 23:26:17 +0000 (18:26 -0500)
Similar fix to a931962, but for filter expressions this time.

UST events's key already includes the filter bytecode, so adding the
string itself should not be needed.

Signed-off-by: Alexandre Montplaisir <alexmonthy@efficios.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/agent.c
src/bin/lttng-sessiond/agent.h
src/bin/lttng-sessiond/event.c

index eed7e68c6d264dfcd2f5a3c33f92d2804cd47def..e9cd5fa050a2ac5b32d46e0e5478ec22d99f9a86 100644 (file)
@@ -89,6 +89,12 @@ static int ht_match_event(struct cds_lfht_node *node,
                goto no_match;
        }
 
+       /* Filter expression */
+       if (strncmp(event->filter_expression, key->filter_expression,
+                       strlen(event->filter_expression)) != 0) {
+               goto no_match;
+       }
+
        return 1;
 
 no_match:
@@ -111,6 +117,7 @@ static void add_unique_agent_event(struct lttng_ht *ht,
        key.name = event->name;
        key.loglevel_value = event->loglevel_value;
        key.loglevel_type = event->loglevel_type;
+       key.filter_expression = event->filter_expression;
 
        node_ptr = cds_lfht_add_unique(ht->ht,
                        ht->hash_fct(event->node.key, lttng_ht_seed),
@@ -798,8 +805,9 @@ struct agent_event *agent_create_event(const char *name,
 {
        struct agent_event *event = NULL;
 
-       DBG3("Agent create new event with name %s, loglevel type %d and loglevel value %d",
-               name, loglevel_type, loglevel_value);
+       DBG3("Agent create new event with name %s, loglevel type %d, \
+                       loglevel value %d and filter %s",
+                       name, loglevel_type, loglevel_value, filter_expression);
 
        if (!name) {
                ERR("Failed to create agent event; no name provided.");
@@ -885,7 +893,7 @@ void agent_event_next_duplicate(const char *name,
 }
 
 /*
- * Find a agent event in the given agent using name and loglevel.
+ * Find a agent event in the given agent using name, loglevel and filter.
  *
  * RCU read side lock MUST be acquired.
  *
@@ -893,7 +901,7 @@ void agent_event_next_duplicate(const char *name,
  */
 struct agent_event *agent_find_event(const char *name,
                enum lttng_loglevel_type loglevel_type, int loglevel_value,
-               struct agent *agt)
+               char *filter_expression, struct agent *agt)
 {
        struct lttng_ht_node_str *node;
        struct lttng_ht_iter iter;
@@ -908,6 +916,7 @@ struct agent_event *agent_find_event(const char *name,
        key.name = name;
        key.loglevel_value = loglevel_value;
        key.loglevel_type = loglevel_type;
+       key.filter_expression = filter_expression;
 
        cds_lfht_lookup(ht->ht, ht->hash_fct((void *) name, lttng_ht_seed),
                        ht_match_event, &key, &iter.iter);
index 49393e8096202b82a4fb1f6e802201f4f796d8f4..2f3a6b95fac8ccfc41ed9b60702356faaac45b2d 100644 (file)
@@ -38,6 +38,7 @@ struct agent_ht_key {
        const char *name;
        int loglevel_value;
        enum lttng_loglevel_type loglevel_type;
+       char *filter_expression;
 };
 
 /*
@@ -140,7 +141,7 @@ void agent_add_event(struct agent_event *event, struct agent *agt);
 
 struct agent_event *agent_find_event(const char *name,
                enum lttng_loglevel_type loglevel_type, int loglevel_value,
-               struct agent *agt);
+               char *filter_expression, struct agent *agt);
 void agent_find_events_by_name(const char *name, struct agent *agt,
                struct lttng_ht_iter* iter);
 void agent_event_next_duplicate(const char *name,
index 589d88eacca6d468c5e7187baf5998f37fe8da1d..3606a2a6ae58a6c3016bcd8ea1f386ce4d4f2362 100644 (file)
@@ -439,7 +439,7 @@ int event_agent_enable(struct ltt_ust_session *usess,
                        filter_expression ? filter_expression : "NULL");
 
        aevent = agent_find_event(event->name, event->loglevel_type,
-               event->loglevel, agt);
+               event->loglevel, filter_expression, agt);
        if (!aevent) {
                aevent = agent_create_event(event->name, event->loglevel_type,
                                event->loglevel, filter,
This page took 0.029737 seconds and 4 git commands to generate.