mirror of https://github.com/milvus-io/milvus.git
fix: Fix performance issue and use after free bug (#39343)
cherry pick some fixes in https://github.com/milvus-io/milvus/pull/39249 Signed-off-by: sunby <sunbingyi1992@gmail.com>pull/39390/head
parent
47e410feb1
commit
56cb1683eb
|
@ -684,10 +684,13 @@ class SegmentExpr : public Expr {
|
||||||
if constexpr (std::is_same_v<T, std::string_view> ||
|
if constexpr (std::is_same_v<T, std::string_view> ||
|
||||||
std::is_same_v<T, Json>) {
|
std::is_same_v<T, Json>) {
|
||||||
if (segment_->type() == SegmentType::Sealed) {
|
if (segment_->type() == SegmentType::Sealed) {
|
||||||
valid_data = segment_
|
auto batch_views = segment_->get_batch_views<T>(
|
||||||
->get_batch_views<T>(
|
field_id_, i, data_pos, size);
|
||||||
field_id_, i, data_pos, size)
|
valid_data = batch_views.second.data();
|
||||||
.second.data();
|
ApplyValidData(valid_data,
|
||||||
|
res + processed_size,
|
||||||
|
valid_res + processed_size,
|
||||||
|
size);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
auto chunk = segment_->chunk_data<T>(field_id_, i);
|
auto chunk = segment_->chunk_data<T>(field_id_, i);
|
||||||
|
@ -695,12 +698,12 @@ class SegmentExpr : public Expr {
|
||||||
if (valid_data != nullptr) {
|
if (valid_data != nullptr) {
|
||||||
valid_data += data_pos;
|
valid_data += data_pos;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
ApplyValidData(valid_data,
|
ApplyValidData(valid_data,
|
||||||
res + processed_size,
|
res + processed_size,
|
||||||
valid_res + processed_size,
|
valid_res + processed_size,
|
||||||
size);
|
size);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
processed_size += size;
|
processed_size += size;
|
||||||
if (processed_size >= batch_size_) {
|
if (processed_size >= batch_size_) {
|
||||||
|
|
|
@ -138,8 +138,8 @@ SegmentChunkReader::GetChunkDataAccessor<std::string>(
|
||||||
current_chunk_size =
|
current_chunk_size =
|
||||||
segment_->chunk_size(field_id, current_chunk_id);
|
segment_->chunk_size(field_id, current_chunk_id);
|
||||||
}
|
}
|
||||||
auto chunk_data = chunk_info.first;
|
auto& chunk_data = chunk_info.first;
|
||||||
auto chunk_valid_data = chunk_info.second;
|
auto& chunk_valid_data = chunk_info.second;
|
||||||
if (current_chunk_pos < chunk_valid_data.size() &&
|
if (current_chunk_pos < chunk_valid_data.size() &&
|
||||||
!chunk_valid_data[current_chunk_pos]) {
|
!chunk_valid_data[current_chunk_pos]) {
|
||||||
current_chunk_pos++;
|
current_chunk_pos++;
|
||||||
|
|
Loading…
Reference in New Issue