mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-11-23 12:31:07 +01:00
app/vmselect/netstorage: add a comment explaining why all the samples in block are taken into account when checking the -search.maxSamplesPerQuery limit
Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5851
This is a follow-up for b07a02c516
This commit is contained in:
parent
b07a02c516
commit
6a0cf2cd29
@ -1192,6 +1192,11 @@ func ProcessSearchQuery(qt *querytracer.Tracer, sq *storage.SearchQuery, deadlin
|
||||
return nil, fmt.Errorf("timeout exceeded while fetching data block #%d from storage: %s", blocksRead, deadline.String())
|
||||
}
|
||||
br := sr.MetricBlockRef.BlockRef
|
||||
|
||||
// Take into account all the samples in the block when checking for *maxSamplesPerQuery limit,
|
||||
// since CPU time is spent on unpacking all the samples in the block, even if only a few samples
|
||||
// are left then because of the given time range.
|
||||
// This allows effectively limiting CPU resources used per query.
|
||||
samples += br.RowsCount()
|
||||
if *maxSamplesPerQuery > 0 && samples > *maxSamplesPerQuery {
|
||||
putTmpBlocksFile(tbf)
|
||||
|
Loading…
Reference in New Issue
Block a user