diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-10-26 17:10:03 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-10-26 17:10:03 +0000 |
commit | 271f618a49421e87945c1f68b59a8775469390d5 (patch) | |
tree | 166cbc9497e13b878bdd7043ca58f6b3da006f2a /libnetdata | |
parent | Adding upstream version 1.43.0. (diff) | |
download | netdata-271f618a49421e87945c1f68b59a8775469390d5.tar.xz netdata-271f618a49421e87945c1f68b59a8775469390d5.zip |
Adding upstream version 1.43.1.upstream/1.43.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'libnetdata')
-rw-r--r-- | libnetdata/dictionary/dictionary.c | 13 | ||||
-rw-r--r-- | libnetdata/dictionary/dictionary.h | 2 | ||||
-rw-r--r-- | libnetdata/facets/facets.c | 27 | ||||
-rw-r--r-- | libnetdata/simple_pattern/simple_pattern.c | 8 |
4 files changed, 41 insertions, 9 deletions
diff --git a/libnetdata/dictionary/dictionary.c b/libnetdata/dictionary/dictionary.c index a74a59583..2d5313c39 100644 --- a/libnetdata/dictionary/dictionary.c +++ b/libnetdata/dictionary/dictionary.c @@ -137,6 +137,7 @@ struct dictionary { const char *creation_function; const char *creation_file; size_t creation_line; + pid_t creation_tid; #endif usec_t last_gc_run_us; @@ -1873,6 +1874,7 @@ void cleanup_destroyed_dictionaries(void) { size_t line = dict->creation_line; const char *file = dict->creation_file; const char *function = dict->creation_function; + pid_t pid = dict->creation_tid; #endif DICTIONARY_STATS_DICT_DESTROY_QUEUED_MINUS1(dict); @@ -1880,13 +1882,19 @@ void cleanup_destroyed_dictionaries(void) { internal_error( true, - "DICTIONARY: freed dictionary with delayed destruction, created from %s() %zu@%s.", - function, line, file); + "DICTIONARY: freed dictionary with delayed destruction, created from %s() %zu@%s pid %d.", + function, line, file, pid); if(last) last->next = next; else dictionaries_waiting_to_be_destroyed = next; } else { + + internal_error( + true, + "DICTIONARY: cannot free dictionary with delayed destruction, created from %s() %zu@%s pid %d.", + function, line, file, pid); + DICTIONARY_STATS_DICT_DESTROY_QUEUED_PLUS1(dict); last = dict; } @@ -2085,6 +2093,7 @@ DICTIONARY *dictionary_create_view(DICTIONARY *master) { dict->creation_function = function; dict->creation_file = file; dict->creation_line = line; + dict->creation_tid = gettid(); #endif DICTIONARY_STATS_DICT_CREATIONS_PLUS1(dict); diff --git a/libnetdata/dictionary/dictionary.h b/libnetdata/dictionary/dictionary.h index 72efe1d03..391be4ee5 100644 --- a/libnetdata/dictionary/dictionary.h +++ b/libnetdata/dictionary/dictionary.h @@ -162,6 +162,8 @@ void dictionary_version_increment(DICTIONARY *dict); void dictionary_garbage_collect(DICTIONARY *dict); +void cleanup_destroyed_dictionaries(void); + // ---------------------------------------------------------------------------- // Set an item in the dictionary // diff --git a/libnetdata/facets/facets.c b/libnetdata/facets/facets.c index 52898feb3..e72cb7321 100644 --- a/libnetdata/facets/facets.c +++ b/libnetdata/facets/facets.c @@ -284,7 +284,8 @@ struct facets { struct { FACET_ROW_SEVERITY severity; - size_t keys_matched_by_query; // the number of fields matched the full text search (per row) + size_t keys_matched_by_query_positive; // the number of fields matched the full text search (per row) + size_t keys_matched_by_query_negative; // the number of fields matched the full text search (per row) } current_row; struct { @@ -1570,8 +1571,18 @@ static inline void facets_key_check_value(FACETS *facets, FACET_KEY *k) { if(facets->query && !facet_key_value_empty(k) && ((k->options & FACET_KEY_OPTION_FTS) || facets->options & FACETS_OPTION_ALL_KEYS_FTS)) { facets->operations.fts.searches++; facets_key_value_copy_to_buffer(k); - if(simple_pattern_matches(facets->query, buffer_tostring(k->current_value.b))) - facets->current_row.keys_matched_by_query++; + switch(simple_pattern_matches_extract(facets->query, buffer_tostring(k->current_value.b), NULL, 0)) { + case SP_MATCHED_POSITIVE: + facets->current_row.keys_matched_by_query_positive++; + break; + + case SP_MATCHED_NEGATIVE: + facets->current_row.keys_matched_by_query_negative++; + break; + + case SP_NOT_MATCHED: + break; + } } if(k->values.enabled) @@ -1831,7 +1842,8 @@ static void facets_reset_keys_with_value_and_row(FACETS *facets) { } facets->current_row.severity = FACET_ROW_SEVERITY_NORMAL; - facets->current_row.keys_matched_by_query = 0; + facets->current_row.keys_matched_by_query_positive = 0; + facets->current_row.keys_matched_by_query_negative = 0; facets->keys_in_row.used = 0; } @@ -1849,9 +1861,10 @@ void facets_rows_begin(FACETS *facets) { bool facets_row_finished(FACETS *facets, usec_t usec) { facets->operations.rows.evaluated++; - if(unlikely((facets->query && facets->keys_filtered_by_query && !facets->current_row.keys_matched_by_query) || - (facets->timeframe.before_ut && usec > facets->timeframe.before_ut) || - (facets->timeframe.after_ut && usec < facets->timeframe.after_ut))) { + if(unlikely((facets->query && facets->keys_filtered_by_query && + (!facets->current_row.keys_matched_by_query_positive || facets->current_row.keys_matched_by_query_negative)) || + (facets->timeframe.before_ut && usec > facets->timeframe.before_ut) || + (facets->timeframe.after_ut && usec < facets->timeframe.after_ut))) { // this row is not useful // 1. not matched by full text search, or // 2. not in our timeframe diff --git a/libnetdata/simple_pattern/simple_pattern.c b/libnetdata/simple_pattern/simple_pattern.c index 70bde73a6..a0051e8f0 100644 --- a/libnetdata/simple_pattern/simple_pattern.c +++ b/libnetdata/simple_pattern/simple_pattern.c @@ -144,6 +144,14 @@ SIMPLE_PATTERN *simple_pattern_create(const char *list, const char *separators, m->negative = negative; m->case_sensitive = case_sensitive; + if(default_mode == SIMPLE_PATTERN_SUBSTRING) { + m->mode = SIMPLE_PATTERN_SUBSTRING; + + struct simple_pattern *tm = m; + for(tm = m; tm->child ; tm = tm->child) ; + tm->mode = SIMPLE_PATTERN_SUBSTRING; + } + // link it at the end if(unlikely(!root)) root = last = m; |