mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2024-12-31 15:06:26 +00:00
wip
This commit is contained in:
parent
0d51cad96f
commit
01fc253eb7
21 changed files with 25 additions and 25 deletions
|
@ -156,7 +156,7 @@ func (bs *blockSearch) search(bsw *blockSearchWork, bm *bitmap) {
|
||||||
// search rows matching the given filter
|
// search rows matching the given filter
|
||||||
bm.init(int(bsw.bh.rowsCount))
|
bm.init(int(bsw.bh.rowsCount))
|
||||||
bm.setBits()
|
bm.setBits()
|
||||||
bs.bsw.so.filter.apply(bs, bm)
|
bs.bsw.so.filter.applyToBlockSearch(bs, bm)
|
||||||
|
|
||||||
if bm.isZero() {
|
if bm.isZero() {
|
||||||
// The filter doesn't match any logs in the current block.
|
// The filter doesn't match any logs in the current block.
|
||||||
|
|
|
@ -8,8 +8,8 @@ type filter interface {
|
||||||
// udpdateNeededFields must update neededFields with fields needed for the filter
|
// udpdateNeededFields must update neededFields with fields needed for the filter
|
||||||
updateNeededFields(neededFields fieldsSet)
|
updateNeededFields(neededFields fieldsSet)
|
||||||
|
|
||||||
// apply must update bm according to the filter applied to the given bs block
|
// applyToBlockSearch must update bm according to the filter applied to the given bs block
|
||||||
apply(bs *blockSearch, bm *bitmap)
|
applyToBlockSearch(bs *blockSearch, bm *bitmap)
|
||||||
|
|
||||||
// applyToBlockResult must update bm according to the filter applied to the given br block
|
// applyToBlockResult must update bm according to the filter applied to the given br block
|
||||||
applyToBlockResult(br *blockResult, bm *bitmap)
|
applyToBlockResult(br *blockResult, bm *bitmap)
|
||||||
|
|
|
@ -48,7 +48,7 @@ func (fa *filterAnd) applyToBlockResult(br *blockResult, bm *bitmap) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fa *filterAnd) apply(bs *blockSearch, bm *bitmap) {
|
func (fa *filterAnd) applyToBlockSearch(bs *blockSearch, bm *bitmap) {
|
||||||
if !fa.matchMessageBloomFilter(bs) {
|
if !fa.matchMessageBloomFilter(bs) {
|
||||||
// Fast path - fa doesn't match _msg bloom filter.
|
// Fast path - fa doesn't match _msg bloom filter.
|
||||||
bm.resetBits()
|
bm.resetBits()
|
||||||
|
@ -57,7 +57,7 @@ func (fa *filterAnd) apply(bs *blockSearch, bm *bitmap) {
|
||||||
|
|
||||||
// Slow path - verify every filter separately.
|
// Slow path - verify every filter separately.
|
||||||
for _, f := range fa.filters {
|
for _, f := range fa.filters {
|
||||||
f.apply(bs, bm)
|
f.applyToBlockSearch(bs, bm)
|
||||||
if bm.isZero() {
|
if bm.isZero() {
|
||||||
// Shortcut - there is no need in applying the remaining filters,
|
// Shortcut - there is no need in applying the remaining filters,
|
||||||
// since the result will be zero anyway.
|
// since the result will be zero anyway.
|
||||||
|
|
|
@ -56,7 +56,7 @@ func (fp *filterAnyCasePhrase) applyToBlockResult(br *blockResult, bm *bitmap) {
|
||||||
applyToBlockResultGeneric(br, bm, fp.fieldName, phraseLowercase, matchAnyCasePhrase)
|
applyToBlockResultGeneric(br, bm, fp.fieldName, phraseLowercase, matchAnyCasePhrase)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fp *filterAnyCasePhrase) apply(bs *blockSearch, bm *bitmap) {
|
func (fp *filterAnyCasePhrase) applyToBlockSearch(bs *blockSearch, bm *bitmap) {
|
||||||
fieldName := fp.fieldName
|
fieldName := fp.fieldName
|
||||||
phraseLowercase := fp.getPhraseLowercase()
|
phraseLowercase := fp.getPhraseLowercase()
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ func (fp *filterAnyCasePrefix) applyToBlockResult(br *blockResult, bm *bitmap) {
|
||||||
applyToBlockResultGeneric(br, bm, fp.fieldName, prefixLowercase, matchAnyCasePrefix)
|
applyToBlockResultGeneric(br, bm, fp.fieldName, prefixLowercase, matchAnyCasePrefix)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fp *filterAnyCasePrefix) apply(bs *blockSearch, bm *bitmap) {
|
func (fp *filterAnyCasePrefix) applyToBlockSearch(bs *blockSearch, bm *bitmap) {
|
||||||
fieldName := fp.fieldName
|
fieldName := fp.fieldName
|
||||||
prefixLowercase := fp.getPrefixLowercase()
|
prefixLowercase := fp.getPrefixLowercase()
|
||||||
|
|
||||||
|
|
|
@ -163,7 +163,7 @@ func matchColumnByExactValue(br *blockResult, bm *bitmap, c *blockResultColumn,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fe *filterExact) apply(bs *blockSearch, bm *bitmap) {
|
func (fe *filterExact) applyToBlockSearch(bs *blockSearch, bm *bitmap) {
|
||||||
fieldName := fe.fieldName
|
fieldName := fe.fieldName
|
||||||
value := fe.value
|
value := fe.value
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ func (fep *filterExactPrefix) applyToBlockResult(br *blockResult, bm *bitmap) {
|
||||||
applyToBlockResultGeneric(br, bm, fep.fieldName, fep.prefix, matchExactPrefix)
|
applyToBlockResultGeneric(br, bm, fep.fieldName, fep.prefix, matchExactPrefix)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fep *filterExactPrefix) apply(bs *blockSearch, bm *bitmap) {
|
func (fep *filterExactPrefix) applyToBlockSearch(bs *blockSearch, bm *bitmap) {
|
||||||
fieldName := fep.fieldName
|
fieldName := fep.fieldName
|
||||||
prefix := fep.prefix
|
prefix := fep.prefix
|
||||||
|
|
||||||
|
|
|
@ -341,7 +341,7 @@ func matchColumnByBinValues(br *blockResult, bm *bitmap, c *blockResultColumn, b
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fi *filterIn) apply(bs *blockSearch, bm *bitmap) {
|
func (fi *filterIn) applyToBlockSearch(bs *blockSearch, bm *bitmap) {
|
||||||
fieldName := fi.fieldName
|
fieldName := fi.fieldName
|
||||||
|
|
||||||
if len(fi.values) == 0 {
|
if len(fi.values) == 0 {
|
||||||
|
|
|
@ -92,7 +92,7 @@ func (fr *filterIPv4Range) applyToBlockResult(br *blockResult, bm *bitmap) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fr *filterIPv4Range) apply(bs *blockSearch, bm *bitmap) {
|
func (fr *filterIPv4Range) applyToBlockSearch(bs *blockSearch, bm *bitmap) {
|
||||||
fieldName := fr.fieldName
|
fieldName := fr.fieldName
|
||||||
minValue := fr.minValue
|
minValue := fr.minValue
|
||||||
maxValue := fr.maxValue
|
maxValue := fr.maxValue
|
||||||
|
|
|
@ -115,7 +115,7 @@ func matchColumnByLenRange(br *blockResult, bm *bitmap, c *blockResultColumn, mi
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fr *filterLenRange) apply(bs *blockSearch, bm *bitmap) {
|
func (fr *filterLenRange) applyToBlockSearch(bs *blockSearch, bm *bitmap) {
|
||||||
fieldName := fr.fieldName
|
fieldName := fr.fieldName
|
||||||
minLen := fr.minLen
|
minLen := fr.minLen
|
||||||
maxLen := fr.maxLen
|
maxLen := fr.maxLen
|
||||||
|
|
|
@ -16,6 +16,6 @@ func (fn *filterNoop) applyToBlockResult(_ *blockResult, _ *bitmap) {
|
||||||
// nothing to do
|
// nothing to do
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fn *filterNoop) apply(_ *blockSearch, _ *bitmap) {
|
func (fn *filterNoop) applyToBlockSearch(_ *blockSearch, _ *bitmap) {
|
||||||
// nothing to do
|
// nothing to do
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,12 +30,12 @@ func (fn *filterNot) applyToBlockResult(br *blockResult, bm *bitmap) {
|
||||||
putBitmap(bmTmp)
|
putBitmap(bmTmp)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fn *filterNot) apply(bs *blockSearch, bm *bitmap) {
|
func (fn *filterNot) applyToBlockSearch(bs *blockSearch, bm *bitmap) {
|
||||||
// Minimize the number of rows to check by the filter by applying it
|
// Minimize the number of rows to check by the filter by applying it
|
||||||
// only to the rows, which match the bm, e.g. they may change the bm result.
|
// only to the rows, which match the bm, e.g. they may change the bm result.
|
||||||
bmTmp := getBitmap(bm.bitsLen)
|
bmTmp := getBitmap(bm.bitsLen)
|
||||||
bmTmp.copyFrom(bm)
|
bmTmp.copyFrom(bm)
|
||||||
fn.f.apply(bs, bmTmp)
|
fn.f.applyToBlockSearch(bs, bmTmp)
|
||||||
bm.andNot(bmTmp)
|
bm.andNot(bmTmp)
|
||||||
putBitmap(bmTmp)
|
putBitmap(bmTmp)
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ func (fo *filterOr) applyToBlockResult(br *blockResult, bm *bitmap) {
|
||||||
putBitmap(bmResult)
|
putBitmap(bmResult)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fo *filterOr) apply(bs *blockSearch, bm *bitmap) {
|
func (fo *filterOr) applyToBlockSearch(bs *blockSearch, bm *bitmap) {
|
||||||
bmResult := getBitmap(bm.bitsLen)
|
bmResult := getBitmap(bm.bitsLen)
|
||||||
bmTmp := getBitmap(bm.bitsLen)
|
bmTmp := getBitmap(bm.bitsLen)
|
||||||
for _, f := range fo.filters {
|
for _, f := range fo.filters {
|
||||||
|
@ -65,7 +65,7 @@ func (fo *filterOr) apply(bs *blockSearch, bm *bitmap) {
|
||||||
// since the result already matches all the values from the block.
|
// since the result already matches all the values from the block.
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
f.apply(bs, bmTmp)
|
f.applyToBlockSearch(bs, bmTmp)
|
||||||
bmResult.or(bmTmp)
|
bmResult.or(bmTmp)
|
||||||
}
|
}
|
||||||
putBitmap(bmTmp)
|
putBitmap(bmTmp)
|
||||||
|
|
|
@ -49,7 +49,7 @@ func (fp *filterPhrase) applyToBlockResult(br *blockResult, bm *bitmap) {
|
||||||
applyToBlockResultGeneric(br, bm, fp.fieldName, fp.phrase, matchPhrase)
|
applyToBlockResultGeneric(br, bm, fp.fieldName, fp.phrase, matchPhrase)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fp *filterPhrase) apply(bs *blockSearch, bm *bitmap) {
|
func (fp *filterPhrase) applyToBlockSearch(bs *blockSearch, bm *bitmap) {
|
||||||
fieldName := fp.fieldName
|
fieldName := fp.fieldName
|
||||||
phrase := fp.phrase
|
phrase := fp.phrase
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ func (fp *filterPrefix) applyToBlockResult(bs *blockResult, bm *bitmap) {
|
||||||
applyToBlockResultGeneric(bs, bm, fp.fieldName, fp.prefix, matchPrefix)
|
applyToBlockResultGeneric(bs, bm, fp.fieldName, fp.prefix, matchPrefix)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fp *filterPrefix) apply(bs *blockSearch, bm *bitmap) {
|
func (fp *filterPrefix) applyToBlockSearch(bs *blockSearch, bm *bitmap) {
|
||||||
fieldName := fp.fieldName
|
fieldName := fp.fieldName
|
||||||
prefix := fp.prefix
|
prefix := fp.prefix
|
||||||
|
|
||||||
|
|
|
@ -135,7 +135,7 @@ func (fr *filterRange) applyToBlockResult(br *blockResult, bm *bitmap) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fr *filterRange) apply(bs *blockSearch, bm *bitmap) {
|
func (fr *filterRange) applyToBlockSearch(bs *blockSearch, bm *bitmap) {
|
||||||
fieldName := fr.fieldName
|
fieldName := fr.fieldName
|
||||||
minValue := fr.minValue
|
minValue := fr.minValue
|
||||||
maxValue := fr.maxValue
|
maxValue := fr.maxValue
|
||||||
|
|
|
@ -30,7 +30,7 @@ func (fr *filterRegexp) applyToBlockResult(br *blockResult, bm *bitmap) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fr *filterRegexp) apply(bs *blockSearch, bm *bitmap) {
|
func (fr *filterRegexp) applyToBlockSearch(bs *blockSearch, bm *bitmap) {
|
||||||
fieldName := fr.fieldName
|
fieldName := fr.fieldName
|
||||||
re := fr.re
|
re := fr.re
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ func (fs *filterSequence) applyToBlockResult(br *blockResult, bm *bitmap) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fs *filterSequence) apply(bs *blockSearch, bm *bitmap) {
|
func (fs *filterSequence) applyToBlockSearch(bs *blockSearch, bm *bitmap) {
|
||||||
fieldName := fs.fieldName
|
fieldName := fs.fieldName
|
||||||
phrases := fs.getNonEmptyPhrases()
|
phrases := fs.getNonEmptyPhrases()
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@ func (fs *filterStream) applyToBlockResult(br *blockResult, bm *bitmap) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fs *filterStream) apply(bs *blockSearch, bm *bitmap) {
|
func (fs *filterStream) applyToBlockSearch(bs *blockSearch, bm *bitmap) {
|
||||||
if fs.f.isEmpty() {
|
if fs.f.isEmpty() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ func (fr *filterStringRange) applyToBlockResult(br *blockResult, bm *bitmap) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fr *filterStringRange) apply(bs *blockSearch, bm *bitmap) {
|
func (fr *filterStringRange) applyToBlockSearch(bs *blockSearch, bm *bitmap) {
|
||||||
fieldName := fr.fieldName
|
fieldName := fr.fieldName
|
||||||
minValue := fr.minValue
|
minValue := fr.minValue
|
||||||
maxValue := fr.maxValue
|
maxValue := fr.maxValue
|
||||||
|
|
|
@ -110,7 +110,7 @@ func (ft *filterTime) matchTimestampValue(timestamp int64) bool {
|
||||||
return timestamp >= ft.minTimestamp && timestamp <= ft.maxTimestamp
|
return timestamp >= ft.minTimestamp && timestamp <= ft.maxTimestamp
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ft *filterTime) apply(bs *blockSearch, bm *bitmap) {
|
func (ft *filterTime) applyToBlockSearch(bs *blockSearch, bm *bitmap) {
|
||||||
minTimestamp := ft.minTimestamp
|
minTimestamp := ft.minTimestamp
|
||||||
maxTimestamp := ft.maxTimestamp
|
maxTimestamp := ft.maxTimestamp
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue