Fix logic for finding first error in loading coll from disk.

This commit is contained in:
Kishore Nallan 2024-07-11 10:57:28 +05:30
parent 0b75cdcc3d
commit 6466249f76
2 changed files with 7 additions and 6 deletions

View File

@ -85,14 +85,14 @@ private:
~CollectionManager() = default;
static Option<std::string> get_first_index_error(const std::vector<index_record>& index_records) {
static std::string get_first_index_error(const std::vector<index_record>& index_records) {
for(const auto & index_record: index_records) {
if(!index_record.indexed.ok()) {
return Option<std::string>(index_record.indexed.error());
return index_record.indexed.error();
}
}
return Option<std::string>(404, "Not found");
return "";
}
public:

View File

@ -2405,9 +2405,10 @@ Option<bool> CollectionManager::load_collection(const nlohmann::json &collection
batch_doc_str_size = 0;
if(num_indexed != num_records) {
const Option<std::string> & index_error_op = get_first_index_error(index_records);
if(!index_error_op.ok()) {
return Option<bool>(400, index_error_op.get());
const std::string& index_error = get_first_index_error(index_records);
if(!index_error.empty()) {
// for now, we will just ignore errors during loading of collection
//return Option<bool>(400, index_error);
}
}