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 <sunbingyi1992@gmail.com>
Signed-off-by: Yellow Shine <sammy.huang@zilliz.com>
Co-authored-by: yellow-shine <sammy.huang@zilliz.com>
hotfix-2.5.4
Bingyi Sun 2025-02-25 10:30:02 +08:00 committed by GitHub
parent 01f8faacae
commit ca050b7979
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 7 additions and 47 deletions

View File

@ -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

View File

@ -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

View File

@ -192,46 +192,6 @@ ChunkedSegmentSealedImpl::LoadScalarIndex(const LoadIndexInfo& info) {
scalar_indexings_[field_id] =
std::move(const_cast<LoadIndexInfo&>(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<index::ScalarIndex<int64_t>*>(
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<index::ScalarIndex<std::string>*>(
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);