diff options
author | Costa Tsaousis <costa@netdata.cloud> | 2023-10-03 11:57:31 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-03 11:57:31 +0300 |
commit | 20e3113847f8d525dc9c1b034e73ce1fb753207b (patch) | |
tree | aae6fa87e555af71f11baa99a35ba101a1f601d8 /libnetdata | |
parent | f4a44dfaa5cd302c852fffc3d3397475eb885de6 (diff) |
journal: fix incremental queries (#16098)
fix if_modified_since to not return empty responses and no overlapping data
Diffstat (limited to 'libnetdata')
-rw-r--r-- | libnetdata/facets/facets.c | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/libnetdata/facets/facets.c b/libnetdata/facets/facets.c index 26029c41e7..d8b0d56d81 100644 --- a/libnetdata/facets/facets.c +++ b/libnetdata/facets/facets.c @@ -1772,40 +1772,40 @@ bool facets_row_finished(FACETS *facets, usec_t usec) { bool within_anchor = facets_is_entry_within_anchor(facets, usec); - if(within_anchor && selected_keys >= total_keys - 1) { - size_t found = 0; (void)found; + if(likely(within_anchor)) { + if(selected_keys >= total_keys - 1) { + size_t found = 0; + (void) found; - for(size_t p = 0; p < entries ;p++) { - FACET_KEY *k = facets->keys_with_values.array[p]; + for(size_t p = 0; p < entries; p++) { + FACET_KEY *k = facets->keys_with_values.array[p]; - size_t counted_by = selected_keys; + size_t counted_by = selected_keys; - if (counted_by != total_keys && !k->key_values_selected_in_row) - counted_by++; + if(counted_by != total_keys && !k->key_values_selected_in_row) + counted_by++; - if (counted_by == total_keys) { - FACET_VALUE *v = FACET_VALUE_GET_CURRENT_VALUE(k); - v->final_facet_value_counter++; + if(counted_by == total_keys) { + FACET_VALUE *v = FACET_VALUE_GET_CURRENT_VALUE(k); + v->final_facet_value_counter++; - found++; + found++; + } } - } - - internal_fatal(!found, "We should find at least one facet to count this row"); - } - if(selected_keys == total_keys) { - // we need to keep this row - - facets_histogram_update_value(facets, usec); + internal_fatal(!found, "We should find at least one facet to count this row"); + } - if(within_anchor) + if(selected_keys == total_keys) { + // we need to keep this row + facets_histogram_update_value(facets, usec); facets_row_keep(facets, usec); + } } facets_reset_keys_with_value_and_row(facets); - return selected_keys == total_keys; + return selected_keys == total_keys && within_anchor; } // ---------------------------------------------------------------------------- |