aboutsummaryrefslogtreecommitdiff
path: root/icing/file/posting_list/flash-index-storage.cc
diff options
context:
space:
mode:
authorXin Li <delphij@google.com>2024-01-17 22:13:52 -0800
committerXin Li <delphij@google.com>2024-01-17 22:13:52 -0800
commitb6d2d80d87a6b4096bb32833cc6ac67295713f55 (patch)
tree9892cbbd0fb247ce252a38f258e33741ca025a45 /icing/file/posting_list/flash-index-storage.cc
parent95f4ed2f5a7365814321253aea37ce9cd9572dc6 (diff)
parentad9e08ff59020f5b52410dc093061d8ef715a781 (diff)
downloadicing-b6d2d80d87a6b4096bb32833cc6ac67295713f55.tar.gz
Merge Android 24Q1 Release (ab/11220357)temp_319669529
Bug: 319669529 Merged-In: I9f448463ecaae2b44ce31833a90d9672c33907b1 Change-Id: I986936f038c20a9b2579d658eea5176ede545011
Diffstat (limited to 'icing/file/posting_list/flash-index-storage.cc')
-rw-r--r--icing/file/posting_list/flash-index-storage.cc9
1 files changed, 8 insertions, 1 deletions
diff --git a/icing/file/posting_list/flash-index-storage.cc b/icing/file/posting_list/flash-index-storage.cc
index cd7ac12..2198d2c 100644
--- a/icing/file/posting_list/flash-index-storage.cc
+++ b/icing/file/posting_list/flash-index-storage.cc
@@ -75,7 +75,11 @@ FlashIndexStorage::ReadHeaderMagic(const Filesystem* filesystem,
FlashIndexStorage::~FlashIndexStorage() {
if (header_block_ != nullptr) {
- FlushInMemoryFreeList();
+ libtextclassifier3::Status status = FlushInMemoryFreeList();
+ if (!status.ok()) {
+ ICING_LOG(ERROR) << "Cannot flush in memory free list: "
+ << status.error_message();
+ }
PersistToDisk();
}
}
@@ -487,6 +491,9 @@ libtextclassifier3::Status FlashIndexStorage::FreePostingList(
PostingListHolder&& holder) {
ICING_ASSIGN_OR_RETURN(IndexBlock block,
GetIndexBlock(holder.id.block_index()));
+ if (block.posting_list_bytes() == max_posting_list_bytes()) {
+ ICING_RETURN_IF_ERROR(block.SetNextBlockIndex(kInvalidBlockIndex));
+ }
uint32_t posting_list_bytes = block.posting_list_bytes();
int best_block_info_index = FindBestIndexBlockInfo(posting_list_bytes);