diff --git a/docs/VictoriaLogs/CHANGELOG.md b/docs/VictoriaLogs/CHANGELOG.md index 54b233739..208095f5b 100644 --- a/docs/VictoriaLogs/CHANGELOG.md +++ b/docs/VictoriaLogs/CHANGELOG.md @@ -18,6 +18,7 @@ according to [these docs](https://docs.victoriametrics.com/VictoriaLogs/QuickSta ## tip +* BUGFIX: properly locate logs for the [requested streams](https://docs.victoriametrics.com/VictoriaLogs/LogsQL.html#stream-filter). Previously logs for some streams may be missing in query results. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/4856). Thanks to @XLONG96 for [the fix](https://github.com/VictoriaMetrics/VictoriaMetrics/pull/5295)! * BUGFIX: [web UI](https://docs.victoriametrics.com/VictoriaLogs/querying/#web-ui): properly sort found logs by time. See [this issue](https://github.com/VictoriaMetrics/VictoriaMetrics/issues/5300). diff --git a/lib/logstorage/storage_search.go b/lib/logstorage/storage_search.go index a9fa20cfe..ea2d5a8ab 100644 --- a/lib/logstorage/storage_search.go +++ b/lib/logstorage/storage_search.go @@ -382,10 +382,8 @@ func (p *part) searchByTenantIDs(so *searchOptions, bhss *blockHeaders, workCh c n = sort.Search(len(ibhs), func(i int) bool { return !ibhs[i].streamID.tenantID.less(tenantID) }) - if n == len(ibhs) || n > 0 && !ibhs[n].streamID.tenantID.equal(tenantID) { - // The end of ibhs[n-1] may contain blocks for the given tenantID, so move it backwards - n-- - } + // The end of ibhs[n-1] may contain blocks for the given tenantID, so move it backwards + n-- } ibh := &ibhs[n] ibhs = ibhs[n+1:] @@ -493,10 +491,8 @@ func (p *part) searchByStreamIDs(so *searchOptions, bhss *blockHeaders, workCh c n = sort.Search(len(ibhs), func(i int) bool { return !ibhs[i].streamID.less(streamID) }) - if n == len(ibhs) || n > 0 && !ibhs[n].streamID.equal(streamID) { - // The end of ibhs[n-1] may contain blocks for the given streamID, so move it backwards - n-- - } + // The end of ibhs[n-1] may contain blocks for the given streamID, so move it backwards. + n-- } ibh := &ibhs[n] ibhs = ibhs[n+1:]