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>
Thu, 22 Oct 2015 20:37:49 +0000 (16:37 -0400)
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 def13707bdf52fd40149dc0d9705393b4652b618..5380cd8e424acadd52ce7b604bd67624053fd948 100644 (file)
@@ -126,6 +126,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:
@@ -148,6 +154,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),
@@ -859,8 +866,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.");
@@ -943,7 +951,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. It must be kept for as long as
  * the returned agent_event is used.
@@ -952,7 +960,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;
@@ -967,6 +975,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 af8254e1b0433d2b1f016f7b2c09c86ef44dba8c..2b3d864a6515b54ff5cf817ab818d2da3e66c8da 100644 (file)
@@ -37,6 +37,7 @@ struct agent_ht_key {
        const char *name;
        int loglevel_value;
        enum lttng_loglevel_type loglevel_type;
+       char *filter_expression;
 };
 
 /*
@@ -139,7 +140,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 c0e2014aecaf33205da24203d0d03bcf10d305be..e4c79df74a4dca37f132478408caacd92d9f2577 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.028259 seconds and 4 git commands to generate.