diff options
author | Costa Tsaousis <costa@netdata.cloud> | 2023-10-03 15:49:00 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-03 15:49:00 +0300 |
commit | 70ff3991a7d5d52418668b3aff46b50460ec9441 (patch) | |
tree | 0f4480abc4988f27ad4956f82108b1775ec19a83 /libnetdata | |
parent | 385d022035f0cff9102deedf0b225cc9916ef344 (diff) |
journal: respect anchor on non-data-only queries (#16109)
respect anchor on non-data-only queries
Diffstat (limited to 'libnetdata')
-rw-r--r-- | libnetdata/facets/facets.c | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/libnetdata/facets/facets.c b/libnetdata/facets/facets.c index 7e7e829103..ef7911f9e6 100644 --- a/libnetdata/facets/facets.c +++ b/libnetdata/facets/facets.c @@ -1736,14 +1736,18 @@ void facets_rows_begin(FACETS *facets) { bool facets_row_finished(FACETS *facets, usec_t usec) { facets->operations.rows.evaluated++; - if((facets->query && facets->keys_filtered_by_query && !facets->current_row.keys_matched_by_query) || + 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) || - !facets_is_entry_within_anchor(facets, usec) /* this has to be last */) { + (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, or - // 3. is not selected by the anchor + // 2. not in our timeframe + facets_reset_keys_with_value_and_row(facets); + return false; + } + + bool within_anchor = facets_is_entry_within_anchor(facets, usec); + if(unlikely(!within_anchor && (facets->options & FACETS_OPTION_DATA_ONLY))) { facets_reset_keys_with_value_and_row(facets); return false; } @@ -1798,7 +1802,9 @@ bool facets_row_finished(FACETS *facets, usec_t usec) { if(selected_keys == total_keys) { // we need to keep this row facets_histogram_update_value(facets, usec); - facets_row_keep(facets, usec); + + if(within_anchor) + facets_row_keep(facets, usec); } facets_reset_keys_with_value_and_row(facets); |