Skip to content

Commit

Permalink
fixes panic (#979)
Browse files Browse the repository at this point in the history
* fixes panic
VictoriaMetrics/helm-charts#89

* add fast-path

* Apply suggestions from code review

Co-authored-by: Aliaksandr Valialkin <valyala@gmail.com>
  • Loading branch information
f41gh7 and valyala committed Dec 24, 2020
1 parent d8511b6 commit 0b87f02
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions app/vmselect/prometheus/prometheus.go
Expand Up @@ -500,8 +500,15 @@ func DeleteHandler(startTime time.Time, at *auth.Token, r *http.Request) error {
var deleteDuration = metrics.NewSummary(`vm_request_duration_seconds{path="/api/v1/admin/tsdb/delete_series"}`)

func resetRollupResultCaches() {
resetRollupResultCacheCalls.Inc()
// Reset local cache before checking whether selectNodes list is empty.
// This guarantees that at least local cache is reset if selectNodes list is empty.
promql.ResetRollupResultCache()
if len(*selectNodes) == 0 {
logger.Panicf("BUG: missing -selectNode flag")
logger.Warnf("missing -selectNode flag, cache reset request wont be propagated to the other vmselect nodes." +
"This can be fixed by enumerating all the vmselect node addresses in `-selectNode` command line flag. " +
" For example: -selectNode=select-addr-1:8481,select-addr-2:8481")
return
}
for _, selectNode := range *selectNodes {
callURL := fmt.Sprintf("http://%s/internal/resetRollupResultCache", selectNode)
Expand All @@ -519,7 +526,6 @@ func resetRollupResultCaches() {
}
_ = resp.Body.Close()
}
resetRollupResultCacheCalls.Inc()
}

var (
Expand Down

0 comments on commit 0b87f02

Please sign in to comment.