aboutsummaryrefslogtreecommitdiff
path: root/icing/file/posting_list/flash-index-storage.cc
diff options
context:
space:
mode:
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);