From c24244240e0128bebafa1d38ff7bc56e585563d0 Mon Sep 17 00:00:00 2001 From: XuanYang-cn Date: Wed, 26 Oct 2022 18:57:36 +0800 Subject: [PATCH] Fix insert search concurrency problem (#20065) Signed-off-by: yangxuan Signed-off-by: yangxuan --- internal/core/src/query/SearchOnGrowing.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/core/src/query/SearchOnGrowing.cpp b/internal/core/src/query/SearchOnGrowing.cpp index 119f3c8df..b5f3520af 100644 --- a/internal/core/src/query/SearchOnGrowing.cpp +++ b/internal/core/src/query/SearchOnGrowing.cpp @@ -9,6 +9,7 @@ // is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express // or implied. See the License for the specific language governing permissions and limitations under the License +#include #include "common/BitsetView.h" #include "common/QueryInfo.h" #include "SearchOnGrowing.h" @@ -86,7 +87,7 @@ SearchOnGrowing(const segcore::SegmentGrowingImpl& segment, SearchResult& results) { auto& schema = segment.get_schema(); auto& record = segment.get_insert_record(); - auto active_count = segment.get_active_count(timestamp); + auto active_count = std::min(int64_t(bitset.size()), segment.get_active_count(timestamp)); // step 1.1: get meta // step 1.2: get which vector field to search -- GitLab