diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-02-13 17:16:02 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-02-13 17:16:02 +0000 |
commit | 396c327fe40b1db11fc204d7ae7ace84503de681 (patch) | |
tree | 6718eb5d5dcf3c6e3c93e32ac6ac9a857f6ca56e /web/api/queries | |
parent | Releasing debian version 1.38.0-1. (diff) | |
download | netdata-396c327fe40b1db11fc204d7ae7ace84503de681.tar.xz netdata-396c327fe40b1db11fc204d7ae7ace84503de681.zip |
Merging upstream version 1.38.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'web/api/queries')
-rw-r--r-- | web/api/queries/query.c | 28 | ||||
-rw-r--r-- | web/api/queries/rrdr.h | 2 | ||||
-rw-r--r-- | web/api/queries/weights.c | 3 |
3 files changed, 23 insertions, 10 deletions
diff --git a/web/api/queries/query.c b/web/api/queries/query.c index 1f10c5137..df7e09799 100644 --- a/web/api/queries/query.c +++ b/web/api/queries/query.c @@ -2273,9 +2273,11 @@ RRDR *rrd2rrdr(ONEWAYALLOC *owa, QUERY_TARGET *qt) { r->internal.grouping_reset(r); if(ops[c]) { - r->od[c] |= RRDR_DIMENSION_SELECTED; + r->od[c] |= RRDR_DIMENSION_QUERIED; rrd2rrdr_query_execute(r, c, ops[c]); } + else + continue; global_statistics_rrdr_query_completed( 1, @@ -2385,15 +2387,23 @@ RRDR *rrd2rrdr(ONEWAYALLOC *owa, QUERY_TARGET *qt) { // free all resources used by the grouping method r->internal.grouping_free(r); - // when all the dimensions are zero, we should return all of them - if(unlikely((qt->window.options & RRDR_OPTION_NONZERO) && !dimensions_nonzero && !(r->result_options & RRDR_RESULT_OPTION_CANCEL))) { - // all the dimensions are zero - // mark them as NONZERO to send them all - for(size_t c = 0, max = qt->query.used; c < max ; c++) { - if(unlikely(r->od[c] & RRDR_DIMENSION_HIDDEN)) continue; - r->od[c] |= RRDR_DIMENSION_NONZERO; + if(likely(dimensions_used)) { + // when all the dimensions are zero, we should return all of them + if (unlikely((qt->window.options & RRDR_OPTION_NONZERO) && !dimensions_nonzero && + !(r->result_options & RRDR_RESULT_OPTION_CANCEL))) { + // all the dimensions are zero + // mark them as NONZERO to send them all + for (size_t c = 0, max = qt->query.used; c < max; c++) { + if (unlikely(r->od[c] & RRDR_DIMENSION_HIDDEN)) continue; + if (unlikely(!(r->od[c] & RRDR_DIMENSION_QUERIED))) continue; + r->od[c] |= RRDR_DIMENSION_NONZERO; + } } + + return r; } - return r; + // we couldn't query any dimension + rrdr_free(owa, r); + return NULL; } diff --git a/web/api/queries/rrdr.h b/web/api/queries/rrdr.h index e31a98099..2d982b136 100644 --- a/web/api/queries/rrdr.h +++ b/web/api/queries/rrdr.h @@ -58,7 +58,7 @@ typedef enum rrdr_dimension_flag { RRDR_DIMENSION_DEFAULT = 0x00, RRDR_DIMENSION_HIDDEN = 0x04, // the dimension is hidden (not to be presented to callers) RRDR_DIMENSION_NONZERO = 0x08, // the dimension is non zero (contains non-zero values) - RRDR_DIMENSION_SELECTED = 0x10, // the dimension is selected for evaluation in this RRDR + RRDR_DIMENSION_QUERIED = 0x10, // the dimension is selected for evaluation in this RRDR } RRDR_DIMENSION_FLAGS; // RRDR result options diff --git a/web/api/queries/weights.c b/web/api/queries/weights.c index dc98aeedf..485aaca26 100644 --- a/web/api/queries/weights.c +++ b/web/api/queries/weights.c @@ -541,6 +541,9 @@ NETDATA_DOUBLE *rrd2rrdr_ks2( if(unlikely(r->od[0] & RRDR_DIMENSION_HIDDEN)) goto cleanup; + if(unlikely(!(r->od[0] & RRDR_DIMENSION_QUERIED))) + goto cleanup; + if(unlikely(!(r->od[0] & RRDR_DIMENSION_NONZERO))) goto cleanup; |