Skip to content

Commit b07a08a

Browse files
bugfix: If it fails or not found in search, do not return directly and process the next pk. (#296)
bugfix: 修复kv检索 遇到不存在的key就整体返回 无法处理后续的key的情况
1 parent 35afe4e commit b07a08a

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

aios/storage/indexlib/table/kv_table/KVTabletReader.cpp

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,21 @@ KVTabletReader::FillRows(const std::shared_ptr<index::KVIndexReader>& kvReader,
208208
base::PartitionResponse& partitionResponse)
209209
{
210210
for (int i = 0; i < pkList.size(); ++i) {
211-
auto row = partitionResponse.add_rows();
211+
base::Row row;
212212
if constexpr (std::is_integral<T>::value) {
213-
RETURN_STATUS_DIRECTLY_IF_ERROR(QueryAttrWithPk(kvReader, pkList[i], attrs, packAttributeFormatter, *row));
213+
// Note: If it fails or not found, do not return directly, need process the next pk.
214+
auto st = QueryAttrWithPk(kvReader, pkList[i], attrs, packAttributeFormatter, row);
215+
if (!st.is_ok()) {
216+
continue;
217+
}
218+
partitionResponse.add_rows()->Swap(&row);
214219
} else {
215220
autil::StringView constStr(pkList[i].data(), pkList[i].size());
216-
RETURN_STATUS_DIRECTLY_IF_ERROR(QueryAttrWithPk(kvReader, constStr, attrs, packAttributeFormatter, *row));
221+
auto st = QueryAttrWithPk(kvReader, constStr, attrs, packAttributeFormatter, row);
222+
if (!st.is_ok()) {
223+
continue;
224+
}
225+
partitionResponse.add_rows()->Swap(&row);
217226
}
218227
}
219228
indexlib::index::AttrHelper::FillAttrInfo(attrs, partitionResponse);

0 commit comments

Comments
 (0)