Skip to content

Commit

Permalink
fix querying out of retention (netdata#16094)
Browse files Browse the repository at this point in the history
if the db does not have enough data to satisfy a query, cancel it
  • Loading branch information
ktsaou authored Oct 2, 2023
1 parent 90a0f4a commit 366eac5
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions web/api/queries/query.c
Original file line number Diff line number Diff line change
Expand Up @@ -1364,10 +1364,12 @@ static bool query_plan(QUERY_ENGINE_OPS *ops, time_t after_wanted, time_t before

if(!query_metric_is_valid_tier(qm, selected_tier))
return false;
}

if(qm->tiers[selected_tier].db_first_time_s > before_wanted ||
qm->tiers[selected_tier].db_last_time_s < after_wanted)
return false;
if(qm->tiers[selected_tier].db_first_time_s > before_wanted ||
qm->tiers[selected_tier].db_last_time_s < after_wanted) {
// we don't have any data to satisfy this query
return false;
}

qm->plan.used = 1;
Expand Down

0 comments on commit 366eac5

Please sign in to comment.