diff options
author | Grace Zhao <gracezrx@google.com> | 2022-10-27 13:52:32 -0700 |
---|---|---|
committer | Grace Zhao <gracezrx@google.com> | 2022-10-27 21:06:49 +0000 |
commit | d0795655ecf1aac89bb1802f4e1d3f5fb7dcb2b0 (patch) | |
tree | ff367f5a9c0f94a1da09638e5d986d5e9bcb62ff /icing/store | |
parent | 4af97ca767a9f2e88dc75e05784dd010e7541d13 (diff) | |
download | icing-d0795655ecf1aac89bb1802f4e1d3f5fb7dcb2b0.tar.gz |
Sync from upstream.
Descriptions:
======================================================================
Fix the bug in PostingListAccessor found by the Icing Monkey test
======================================================================
Add the logic to handle fatal errors from IcingDynamicTrie to avoid crashing
======================================================================
Clear out the dead code IcingDynamicTrie::Compact
======================================================================
[MemoryMappedFile][RemapV2][1/x] Add factory method for
MemoryMappedFile
======================================================================
[MemoryMappedFile][RemapV2][2/x] Create GrowAndRemapIfNecessary and change factory method
======================================================================
[MemoryMappedFile][RemapV2][3/x] Migrate FileBackedVector to use GrowAndRemapIfNecessary
======================================================================
Add JNI latency for query latency stats breakdown
======================================================================
Bug: 247671531
Bug: 247929909
Bug: 253282365
Change-Id: Ic3b88d0f044edacfe2dfeb08fa381b2186c731cb
Diffstat (limited to 'icing/store')
-rw-r--r-- | icing/store/document-log-creator.cc | 3 | ||||
-rw-r--r-- | icing/store/dynamic-trie-key-mapper.h | 24 |
2 files changed, 17 insertions, 10 deletions
diff --git a/icing/store/document-log-creator.cc b/icing/store/document-log-creator.cc index b3f694e..c9769f2 100644 --- a/icing/store/document-log-creator.cc +++ b/icing/store/document-log-creator.cc @@ -142,7 +142,8 @@ libtextclassifier3::Status DocumentLogCreator::MigrateFromV0ToV1( DocumentProto empty_document; // Start reading out from the old log and putting them in the new log. - auto iterator = v0_proto_log->GetIterator(); + ICING_ASSIGN_OR_RETURN(FileBackedProtoLog<DocumentWrapper>::Iterator iterator, + v0_proto_log->GetIterator()); auto iterator_status = iterator.Advance(); while (iterator_status.ok()) { libtextclassifier3::StatusOr<DocumentWrapper> document_wrapper_or = diff --git a/icing/store/dynamic-trie-key-mapper.h b/icing/store/dynamic-trie-key-mapper.h index f3f346f..35d2200 100644 --- a/icing/store/dynamic-trie-key-mapper.h +++ b/icing/store/dynamic-trie-key-mapper.h @@ -32,6 +32,7 @@ #include "icing/legacy/index/icing-filesystem.h" #include "icing/store/key-mapper.h" #include "icing/util/crc32.h" +#include "icing/util/logging.h" #include "icing/util/status-macros.h" namespace icing { @@ -227,11 +228,14 @@ libtextclassifier3::StatusOr<T> DynamicTrieKeyMapper<T, Formatter>::GetOrPut( std::string_view key, T next_value) { std::string string_key(key); uint32_t value_index; - if (!trie_.Insert(string_key.c_str(), &next_value, &value_index, - /*replace=*/false)) { - return absl_ports::InternalError( - absl_ports::StrCat("Unable to insert key ", Formatter()(string_key), - " into DynamicTrieKeyMapper ", file_prefix_, ".")); + libtextclassifier3::Status status = + trie_.Insert(string_key.c_str(), &next_value, &value_index, + /*replace=*/false); + if (!status.ok()) { + ICING_LOG(DBG) << "Unable to insert key " << string_key + << " into DynamicTrieKeyMapper " << file_prefix_ << ".\n" + << status.error_message(); + return status; } // This memory address could be unaligned since we're just grabbing the value // from somewhere in the trie's suffix array. The suffix array is filled with @@ -250,10 +254,12 @@ template <typename T, typename Formatter> libtextclassifier3::Status DynamicTrieKeyMapper<T, Formatter>::Put( std::string_view key, T value) { std::string string_key(key); - if (!trie_.Insert(string_key.c_str(), &value)) { - return absl_ports::InternalError( - absl_ports::StrCat("Unable to insert key ", Formatter()(string_key), - " into DynamicTrieKeyMapper ", file_prefix_, ".")); + libtextclassifier3::Status status = trie_.Insert(string_key.c_str(), &value); + if (!status.ok()) { + ICING_LOG(DBG) << "Unable to insert key " << string_key + << " into DynamicTrieKeyMapper " << file_prefix_ << ".\n" + << status.error_message(); + return status; } return libtextclassifier3::Status::OK; } |