mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-03-21 15:45:01 +00:00
lib/logstorage: small clarifications in comments
This commit is contained in:
parent
81b2fb88cc
commit
522415bf56
1 changed files with 6 additions and 3 deletions
|
@ -122,7 +122,7 @@ type searchResultFunc func(workerID uint, br *blockResult)
|
||||||
|
|
||||||
// search searches for the matching rows according to so.
|
// search searches for the matching rows according to so.
|
||||||
//
|
//
|
||||||
// It calls f for each found matching block.
|
// It calls processBlockResult for each found matching block.
|
||||||
func (s *Storage) search(workersCount int, so *genericSearchOptions, stopCh <-chan struct{}, processBlockResult searchResultFunc) {
|
func (s *Storage) search(workersCount int, so *genericSearchOptions, stopCh <-chan struct{}, processBlockResult searchResultFunc) {
|
||||||
// Spin up workers
|
// Spin up workers
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
|
@ -179,7 +179,7 @@ func (s *Storage) search(workersCount int, so *genericSearchOptions, stopCh <-ch
|
||||||
close(workCh)
|
close(workCh)
|
||||||
wg.Wait()
|
wg.Wait()
|
||||||
|
|
||||||
// Decrement references to parts
|
// Decrement references to parts, which were incremented inside partition.search().
|
||||||
for _, pw := range pws {
|
for _, pw := range pws {
|
||||||
pw.decRef()
|
pw.decRef()
|
||||||
}
|
}
|
||||||
|
@ -277,6 +277,9 @@ func (ddb *datadb) search(pwsDst []*partWrapper, so *searchOptions, workCh chan<
|
||||||
pwsDst = appendPartsInTimeRange(pwsDst, ddb.inmemoryParts, so.minTimestamp, so.maxTimestamp)
|
pwsDst = appendPartsInTimeRange(pwsDst, ddb.inmemoryParts, so.minTimestamp, so.maxTimestamp)
|
||||||
pwsDst = appendPartsInTimeRange(pwsDst, ddb.fileParts, so.minTimestamp, so.maxTimestamp)
|
pwsDst = appendPartsInTimeRange(pwsDst, ddb.fileParts, so.minTimestamp, so.maxTimestamp)
|
||||||
pws := pwsDst[pwsDstLen:]
|
pws := pwsDst[pwsDstLen:]
|
||||||
|
|
||||||
|
// Increase references to the searched parts, so they aren't deleted during search.
|
||||||
|
// References to the searched parts must be decremented by the caller.
|
||||||
for _, pw := range pws {
|
for _, pw := range pws {
|
||||||
pw.incRef()
|
pw.incRef()
|
||||||
}
|
}
|
||||||
|
@ -584,7 +587,7 @@ func getCommonTimeFilter(f filter) (*timeFilter, filter) {
|
||||||
for _, filter := range t.filters {
|
for _, filter := range t.filters {
|
||||||
tf, ok := filter.(*timeFilter)
|
tf, ok := filter.(*timeFilter)
|
||||||
if ok {
|
if ok {
|
||||||
// The tf must remain in af in order to properly filter out rows outside the selected time range
|
// The tf must remain in t.filters order to properly filter out rows outside the selected time range
|
||||||
return tf, f
|
return tf, f
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue