From a886bd1f33f776573e19bf23f0c2d1391050331f Mon Sep 17 00:00:00 2001 From: Cai Zhang Date: Thu, 21 Aug 2025 11:52:50 +0800 Subject: [PATCH] fix conflict Signed-off-by: Cai Zhang --- internal/core/src/index/RTreeIndexWrapper.cpp | 14 +++++--------- internal/core/src/index/RTreeIndexWrapper.h | 1 - 2 files changed, 5 insertions(+), 10 deletions(-) diff --git a/internal/core/src/index/RTreeIndexWrapper.cpp b/internal/core/src/index/RTreeIndexWrapper.cpp index ec00790f9aa..104fa584615 100644 --- a/internal/core/src/index/RTreeIndexWrapper.cpp +++ b/internal/core/src/index/RTreeIndexWrapper.cpp @@ -42,11 +42,10 @@ void RTreeIndexWrapper::add_geometry(const uint8_t* wkb_data, size_t len, int64_t row_offset) { - // Acquire write lock to protect rtree_ modification - folly::SharedMutexWritePriority::WriteHolder lock(rtree_mutex_); + // Acquire write lock to protect rtree_ + std::unique_lock guard(rtree_mutex_); AssertInfo(is_build_mode_, "Cannot add geometry in load mode"); - std::unique_lock guard(rtree_mutex_); // Parse WKB data to OGR geometry OGRGeometry* geom = nullptr; @@ -79,10 +78,10 @@ RTreeIndexWrapper::bulk_load_from_field_data( const std::vector>& field_datas, bool nullable) { // Acquire write lock to protect rtree_ creation and modification - folly::SharedMutexWritePriority::WriteHolder lock(rtree_mutex_); + std::unique_lock guard(rtree_mutex_); AssertInfo(is_build_mode_, "Cannot bulk load in load mode"); - std::unique_lock guard(rtree_mutex_); + std::vector local_values; local_values.reserve(1024); int64_t absolute_offset = 0; @@ -123,8 +122,6 @@ RTreeIndexWrapper::bulk_load_from_field_data( void RTreeIndexWrapper::finish() { // Acquire write lock to protect rtree_ modification and cleanup - folly::SharedMutexWritePriority::WriteHolder lock(rtree_mutex_); - // Guard against repeated invocations which could otherwise attempt to // release resources multiple times (e.g. BuildWithRawDataForUT() calls // finish(), and Upload() may call it again). @@ -164,11 +161,10 @@ RTreeIndexWrapper::finish() { void RTreeIndexWrapper::load() { // Acquire write lock to protect rtree_ initialization during loading - folly::SharedMutexWritePriority::WriteHolder lock(rtree_mutex_); + std::unique_lock guard(rtree_mutex_); AssertInfo(!is_build_mode_, "Cannot load in build mode"); - std::unique_lock guard(rtree_mutex_); try { // Read meta (optional) try { diff --git a/internal/core/src/index/RTreeIndexWrapper.h b/internal/core/src/index/RTreeIndexWrapper.h index f6240f52b07..0ba9ef92a7d 100644 --- a/internal/core/src/index/RTreeIndexWrapper.h +++ b/internal/core/src/index/RTreeIndexWrapper.h @@ -19,7 +19,6 @@ #include #include "ogr_geometry.h" #include "pb/plan.pb.h" -#include // Forward declaration to avoid pulling heavy field data headers here namespace milvus {