From 01fc253eb7ef5211a4618d231cf450dcf9ffaaae Mon Sep 17 00:00:00 2001 From: Aliaksandr Valialkin Date: Fri, 17 May 2024 16:14:22 +0200 Subject: [PATCH] wip --- lib/logstorage/block_search.go | 2 +- lib/logstorage/filter.go | 4 ++-- lib/logstorage/filter_and.go | 4 ++-- lib/logstorage/filter_any_case_phrase.go | 2 +- lib/logstorage/filter_any_case_prefix.go | 2 +- lib/logstorage/filter_exact.go | 2 +- lib/logstorage/filter_exact_prefix.go | 2 +- lib/logstorage/filter_in.go | 2 +- lib/logstorage/filter_ipv4_range.go | 2 +- lib/logstorage/filter_len_range.go | 2 +- lib/logstorage/filter_noop.go | 2 +- lib/logstorage/filter_not.go | 4 ++-- lib/logstorage/filter_or.go | 4 ++-- lib/logstorage/filter_phrase.go | 2 +- lib/logstorage/filter_prefix.go | 2 +- lib/logstorage/filter_range.go | 2 +- lib/logstorage/filter_regexp.go | 2 +- lib/logstorage/filter_sequence.go | 2 +- lib/logstorage/filter_stream.go | 2 +- lib/logstorage/filter_string_range.go | 2 +- lib/logstorage/filter_time.go | 2 +- 21 files changed, 25 insertions(+), 25 deletions(-) diff --git a/lib/logstorage/block_search.go b/lib/logstorage/block_search.go index 4e2710610..3e54346a1 100644 --- a/lib/logstorage/block_search.go +++ b/lib/logstorage/block_search.go @@ -156,7 +156,7 @@ func (bs *blockSearch) search(bsw *blockSearchWork, bm *bitmap) { // search rows matching the given filter bm.init(int(bsw.bh.rowsCount)) bm.setBits() - bs.bsw.so.filter.apply(bs, bm) + bs.bsw.so.filter.applyToBlockSearch(bs, bm) if bm.isZero() { // The filter doesn't match any logs in the current block. diff --git a/lib/logstorage/filter.go b/lib/logstorage/filter.go index 11a30ab93..c27c4ca26 100644 --- a/lib/logstorage/filter.go +++ b/lib/logstorage/filter.go @@ -8,8 +8,8 @@ type filter interface { // udpdateNeededFields must update neededFields with fields needed for the filter updateNeededFields(neededFields fieldsSet) - // apply must update bm according to the filter applied to the given bs block - apply(bs *blockSearch, bm *bitmap) + // applyToBlockSearch must update bm according to the filter applied to the given bs block + applyToBlockSearch(bs *blockSearch, bm *bitmap) // applyToBlockResult must update bm according to the filter applied to the given br block applyToBlockResult(br *blockResult, bm *bitmap) diff --git a/lib/logstorage/filter_and.go b/lib/logstorage/filter_and.go index 1528bf797..caea8ae6f 100644 --- a/lib/logstorage/filter_and.go +++ b/lib/logstorage/filter_and.go @@ -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) { // Fast path - fa doesn't match _msg bloom filter. bm.resetBits() @@ -57,7 +57,7 @@ func (fa *filterAnd) apply(bs *blockSearch, bm *bitmap) { // Slow path - verify every filter separately. for _, f := range fa.filters { - f.apply(bs, bm) + f.applyToBlockSearch(bs, bm) if bm.isZero() { // Shortcut - there is no need in applying the remaining filters, // since the result will be zero anyway. diff --git a/lib/logstorage/filter_any_case_phrase.go b/lib/logstorage/filter_any_case_phrase.go index af9cefd97..8409d3d8f 100644 --- a/lib/logstorage/filter_any_case_phrase.go +++ b/lib/logstorage/filter_any_case_phrase.go @@ -56,7 +56,7 @@ func (fp *filterAnyCasePhrase) applyToBlockResult(br *blockResult, bm *bitmap) { 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 phraseLowercase := fp.getPhraseLowercase() diff --git a/lib/logstorage/filter_any_case_prefix.go b/lib/logstorage/filter_any_case_prefix.go index 86f413e67..16e0036ca 100644 --- a/lib/logstorage/filter_any_case_prefix.go +++ b/lib/logstorage/filter_any_case_prefix.go @@ -60,7 +60,7 @@ func (fp *filterAnyCasePrefix) applyToBlockResult(br *blockResult, bm *bitmap) { 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 prefixLowercase := fp.getPrefixLowercase() diff --git a/lib/logstorage/filter_exact.go b/lib/logstorage/filter_exact.go index 11e749e85..fbd74d17d 100644 --- a/lib/logstorage/filter_exact.go +++ b/lib/logstorage/filter_exact.go @@ -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 value := fe.value diff --git a/lib/logstorage/filter_exact_prefix.go b/lib/logstorage/filter_exact_prefix.go index 13d7684f4..653bdfc4b 100644 --- a/lib/logstorage/filter_exact_prefix.go +++ b/lib/logstorage/filter_exact_prefix.go @@ -40,7 +40,7 @@ func (fep *filterExactPrefix) applyToBlockResult(br *blockResult, bm *bitmap) { 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 prefix := fep.prefix diff --git a/lib/logstorage/filter_in.go b/lib/logstorage/filter_in.go index 67dfd4fc5..c150fbee3 100644 --- a/lib/logstorage/filter_in.go +++ b/lib/logstorage/filter_in.go @@ -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 if len(fi.values) == 0 { diff --git a/lib/logstorage/filter_ipv4_range.go b/lib/logstorage/filter_ipv4_range.go index ef774a78f..87eb034d5 100644 --- a/lib/logstorage/filter_ipv4_range.go +++ b/lib/logstorage/filter_ipv4_range.go @@ -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 minValue := fr.minValue maxValue := fr.maxValue diff --git a/lib/logstorage/filter_len_range.go b/lib/logstorage/filter_len_range.go index 3820cf394..85a1e2f36 100644 --- a/lib/logstorage/filter_len_range.go +++ b/lib/logstorage/filter_len_range.go @@ -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 minLen := fr.minLen maxLen := fr.maxLen diff --git a/lib/logstorage/filter_noop.go b/lib/logstorage/filter_noop.go index 22718e537..3581c169b 100644 --- a/lib/logstorage/filter_noop.go +++ b/lib/logstorage/filter_noop.go @@ -16,6 +16,6 @@ func (fn *filterNoop) applyToBlockResult(_ *blockResult, _ *bitmap) { // nothing to do } -func (fn *filterNoop) apply(_ *blockSearch, _ *bitmap) { +func (fn *filterNoop) applyToBlockSearch(_ *blockSearch, _ *bitmap) { // nothing to do } diff --git a/lib/logstorage/filter_not.go b/lib/logstorage/filter_not.go index 292763033..8b39415ca 100644 --- a/lib/logstorage/filter_not.go +++ b/lib/logstorage/filter_not.go @@ -30,12 +30,12 @@ func (fn *filterNot) applyToBlockResult(br *blockResult, bm *bitmap) { 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 // only to the rows, which match the bm, e.g. they may change the bm result. bmTmp := getBitmap(bm.bitsLen) bmTmp.copyFrom(bm) - fn.f.apply(bs, bmTmp) + fn.f.applyToBlockSearch(bs, bmTmp) bm.andNot(bmTmp) putBitmap(bmTmp) } diff --git a/lib/logstorage/filter_or.go b/lib/logstorage/filter_or.go index 0ec3e7c83..5349c4370 100644 --- a/lib/logstorage/filter_or.go +++ b/lib/logstorage/filter_or.go @@ -50,7 +50,7 @@ func (fo *filterOr) applyToBlockResult(br *blockResult, bm *bitmap) { putBitmap(bmResult) } -func (fo *filterOr) apply(bs *blockSearch, bm *bitmap) { +func (fo *filterOr) applyToBlockSearch(bs *blockSearch, bm *bitmap) { bmResult := getBitmap(bm.bitsLen) bmTmp := getBitmap(bm.bitsLen) 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. break } - f.apply(bs, bmTmp) + f.applyToBlockSearch(bs, bmTmp) bmResult.or(bmTmp) } putBitmap(bmTmp) diff --git a/lib/logstorage/filter_phrase.go b/lib/logstorage/filter_phrase.go index 4ca15e6f7..3b4c04174 100644 --- a/lib/logstorage/filter_phrase.go +++ b/lib/logstorage/filter_phrase.go @@ -49,7 +49,7 @@ func (fp *filterPhrase) applyToBlockResult(br *blockResult, bm *bitmap) { 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 phrase := fp.phrase diff --git a/lib/logstorage/filter_prefix.go b/lib/logstorage/filter_prefix.go index 853e2d5f9..7b0fa9964 100644 --- a/lib/logstorage/filter_prefix.go +++ b/lib/logstorage/filter_prefix.go @@ -47,7 +47,7 @@ func (fp *filterPrefix) applyToBlockResult(bs *blockResult, bm *bitmap) { 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 prefix := fp.prefix diff --git a/lib/logstorage/filter_range.go b/lib/logstorage/filter_range.go index 851faf340..cf45e314d 100644 --- a/lib/logstorage/filter_range.go +++ b/lib/logstorage/filter_range.go @@ -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 minValue := fr.minValue maxValue := fr.maxValue diff --git a/lib/logstorage/filter_regexp.go b/lib/logstorage/filter_regexp.go index 725bf5aed..31b383826 100644 --- a/lib/logstorage/filter_regexp.go +++ b/lib/logstorage/filter_regexp.go @@ -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 re := fr.re diff --git a/lib/logstorage/filter_sequence.go b/lib/logstorage/filter_sequence.go index 38c7516bc..46ca9732f 100644 --- a/lib/logstorage/filter_sequence.go +++ b/lib/logstorage/filter_sequence.go @@ -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 phrases := fs.getNonEmptyPhrases() diff --git a/lib/logstorage/filter_stream.go b/lib/logstorage/filter_stream.go index 5d7023ea6..73aa49367 100644 --- a/lib/logstorage/filter_stream.go +++ b/lib/logstorage/filter_stream.go @@ -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() { return } diff --git a/lib/logstorage/filter_string_range.go b/lib/logstorage/filter_string_range.go index f7f5f514d..4ab081b60 100644 --- a/lib/logstorage/filter_string_range.go +++ b/lib/logstorage/filter_string_range.go @@ -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 minValue := fr.minValue maxValue := fr.maxValue diff --git a/lib/logstorage/filter_time.go b/lib/logstorage/filter_time.go index f4b5bb7b5..155a81244 100644 --- a/lib/logstorage/filter_time.go +++ b/lib/logstorage/filter_time.go @@ -110,7 +110,7 @@ func (ft *filterTime) matchTimestampValue(timestamp int64) bool { 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 maxTimestamp := ft.maxTimestamp