From 77033dbfb60d355f4b6c1ddaeee591229ca12161 Mon Sep 17 00:00:00 2001 From: XLONG96 <1073501156@qq.com> Date: Tue, 14 Nov 2023 06:09:39 +0800 Subject: [PATCH] lib/logstorage: fix streamID and tenantID search (#4856) (#5295) --- lib/logstorage/storage_search.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/logstorage/storage_search.go b/lib/logstorage/storage_search.go index a82b9e477..a9fa20cfe 100644 --- a/lib/logstorage/storage_search.go +++ b/lib/logstorage/storage_search.go @@ -382,7 +382,7 @@ 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) { + 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-- } @@ -493,7 +493,7 @@ 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) { + 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-- }