/api/v2/X part 6 (#14785)
* additional check for consistency of rrdr * do not query the host if the contexts are not initialized for it
Costa Tsaousis committed
Mar 22, 2023 at 10:08 UTC
def14d13f552487267c670c97dc41dc25034f9b0
2 files changed
+4
-1
database/contexts/query_scope.c
+3
@@ -72,6 +72,9 @@ ssize_t query_scope_foreach_host(SIMPLE_PATTERN *scope_hosts_sp, SIMPLE_PATTERN
72
73
ssize_t query_scope_foreach_context(RRDHOST *host, const char *scope_contexts, SIMPLE_PATTERN *scope_contexts_sp,
74
SIMPLE_PATTERN *contexts_sp, foreach_context_cb_t cb, bool queryable_host, void *data) {
75
+ if(unlikely(!host->rrdctx.contexts))
76
+ return 0;
77
+
78
ssize_t added = 0;
79
80
RRDCONTEXT_ACQUIRED *rca = NULL;
web/api/queries/weights.c
+1
-1
@@ -1103,7 +1103,7 @@ static void rrdset_weights_multi_dimensional_value(struct query_weights_data *qw
1103
ONEWAYALLOC *owa = onewayalloc_create(16 * 1024);
1104
RRDR *r = rrd2rrdr(owa, query_target_create(&qtr));
1105
1106
- if(rrdr_rows(r) != 1 || !r->d)
1106
+ if(rrdr_rows(r) != 1 || !r->d || r->d != r->internal.qt->query.used)
1107
goto cleanup;
1108
1109
QUERY_VALUE qv = {