From ca050b7979e46d540fc9c04f7160f3e2640b3ed8 Mon Sep 17 00:00:00 2001 From: Bingyi Sun Date: Tue, 25 Feb 2025 10:30:02 +0800 Subject: [PATCH] fix: Skip create primary key index when loading pk index (#39922) (#40044) issue: https://github.com/milvus-io/milvus/issues/39907 pr: https://github.com/milvus-io/milvus/pull/39921 --------- Signed-off-by: sunby Signed-off-by: Yellow Shine Co-authored-by: yellow-shine --- .github/workflows/mac.yaml | 2 +- .github/workflows/main.yaml | 12 +++--- .../src/segcore/ChunkedSegmentSealedImpl.cpp | 40 ------------------- 3 files changed, 7 insertions(+), 47 deletions(-) diff --git a/.github/workflows/mac.yaml b/.github/workflows/mac.yaml index 56baec0715..cd1fb5595b 100644 --- a/.github/workflows/mac.yaml +++ b/.github/workflows/mac.yaml @@ -67,7 +67,7 @@ jobs: fi make milvus - name: Upload Cmake log - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: ${{ failure() }} with: name: cmake-log diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index cae4242c8f..05687f5a97 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -100,7 +100,7 @@ jobs: - run: | zip -r code.zip . -x "./.docker/*" -x "./cmake_build/thirdparty/**" -x ".git/**" - name: Archive code - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: code path: code.zip @@ -129,7 +129,7 @@ jobs: remove-android: 'true' remove-haskell: 'true' - name: Download code - uses: actions/download-artifact@v3.0.1 + uses: actions/download-artifact@v4 with: name: code - run: | @@ -181,7 +181,7 @@ jobs: remove-android: 'true' remove-haskell: 'true' - name: Download code - uses: actions/download-artifact@v3.0.1 + uses: actions/download-artifact@v4 with: name: code - run: | @@ -233,7 +233,7 @@ jobs: remove-android: 'true' remove-haskell: 'true' - name: Download code - uses: actions/download-artifact@v3.0.1 + uses: actions/download-artifact@v4 with: name: code - run: | @@ -279,11 +279,11 @@ jobs: with: fetch-depth: 0 - name: Download Go code coverage results - uses: actions/download-artifact@v4.1.0 + uses: actions/download-artifact@v4 with: name: go-result - name: Download Integration Test coverage results - uses: actions/download-artifact@v4.1.0 + uses: actions/download-artifact@v4 with: name: it-result - name: Display structure of code coverage results diff --git a/internal/core/src/segcore/ChunkedSegmentSealedImpl.cpp b/internal/core/src/segcore/ChunkedSegmentSealedImpl.cpp index 5eb5b452cf..ec71d6109a 100644 --- a/internal/core/src/segcore/ChunkedSegmentSealedImpl.cpp +++ b/internal/core/src/segcore/ChunkedSegmentSealedImpl.cpp @@ -192,46 +192,6 @@ ChunkedSegmentSealedImpl::LoadScalarIndex(const LoadIndexInfo& info) { scalar_indexings_[field_id] = std::move(const_cast(info).index); - // reverse pk from scalar index and set pks to offset - if (schema_->get_primary_field_id() == field_id) { - AssertInfo(field_id.get() != -1, "Primary key is -1"); - switch (field_meta.get_data_type()) { - case DataType::INT64: { - auto int64_index = dynamic_cast*>( - scalar_indexings_[field_id].get()); - if (!is_sorted_by_pk_ && insert_record_.empty_pks() && - int64_index->HasRawData()) { - for (int i = 0; i < row_count; ++i) { - auto raw = int64_index->Reverse_Lookup(i); - AssertInfo(raw.has_value(), "pk not found"); - insert_record_.insert_pk(raw.value(), i); - } - insert_record_.seal_pks(); - } - break; - } - case DataType::VARCHAR: { - auto string_index = - dynamic_cast*>( - scalar_indexings_[field_id].get()); - if (!is_sorted_by_pk_ && insert_record_.empty_pks() && - string_index->HasRawData()) { - for (int i = 0; i < row_count; ++i) { - auto raw = string_index->Reverse_Lookup(i); - AssertInfo(raw.has_value(), "pk not found"); - insert_record_.insert_pk(raw.value(), i); - } - insert_record_.seal_pks(); - } - break; - } - default: { - PanicInfo(DataTypeInvalid, - fmt::format("unsupported primary key type {}", - field_meta.get_data_type())); - } - } - } set_bit(index_ready_bitset_, field_id, true); update_row_count(row_count);