diff options
author | Tim Barron <tjbarron@google.com> | 2022-04-12 14:30:14 -0700 |
---|---|---|
committer | Tim Barron <tjbarron@google.com> | 2022-04-12 14:36:38 -0700 |
commit | d5c9ae94052a0f2f1b9ddec9dbbe502bc4f11d54 (patch) | |
tree | 90b929dc92d5874b5c15caca064401196ab4fc65 /icing/store/document-log-creator.cc | |
parent | beff93fe1f5165aeeb871d9711963aa1846299ae (diff) | |
download | icing-d5c9ae94052a0f2f1b9ddec9dbbe502bc4f11d54.tar.gz |
Sync from upstream.
======================================================================
Refactor DocumentStore::Initialize to improve readability of document store recovery.
======================================================================
Remove non-NDK API usages of ICU4C in libicing.
======================================================================
Move IcuDataFileHelper to the testing directory since it is a test-only util.
======================================================================
Support dump function for DocumentStore
======================================================================
Switch to use PRead rather than MMap in the proto log.
======================================================================
Support dump function for main/lite index and lexicon
======================================================================
Fix LiteIndex::AppendHits
======================================================================
Enable and fix DocumentStoreTest.LoadScoreCacheAndInitializeSuccessfully
======================================================================
Fix MainIndex::GetStorageInfo.
======================================================================
Fix icing-search-engine_fuzz_test by making IcuLanguageSegmenterIterator::Advance non-recursive.
======================================================================
Allow to return additional information for deleted documents in DeleteByQuery
======================================================================
Using enum class in Token::Type for better type safety.
======================================================================
Bug: 158089703
Bug: 185845269
Bug: 209071710
Bug: 211785521
Bug: 218413237
Bug: 223549255
Change-Id: Id2786047ab279734bdd2aee883e82607b6a0e403
Diffstat (limited to 'icing/store/document-log-creator.cc')
-rw-r--r-- | icing/store/document-log-creator.cc | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/icing/store/document-log-creator.cc b/icing/store/document-log-creator.cc index 5e0426e..5e23a8e 100644 --- a/icing/store/document-log-creator.cc +++ b/icing/store/document-log-creator.cc @@ -72,19 +72,20 @@ DocumentLogCreator::Create(const Filesystem* filesystem, bool v1_exists = filesystem->FileExists(MakeDocumentLogFilenameV1(base_dir).c_str()); - bool regen_derived_files = false; + bool new_file = false; + int preexisting_file_version = kCurrentVersion; if (v0_exists && !v1_exists) { ICING_RETURN_IF_ERROR(MigrateFromV0ToV1(filesystem, base_dir)); // Need to regenerate derived files since documents may be written to a // different file offset in the log. - regen_derived_files = true; + preexisting_file_version = 0; } else if (!v1_exists) { // First time initializing a v1 log. There are no existing derived files at // this point, so we should generate some. "regenerate" here also means // "generate for the first time", i.e. we shouldn't expect there to be any // existing derived files. - regen_derived_files = true; + new_file = true; } ICING_ASSIGN_OR_RETURN( @@ -96,7 +97,7 @@ DocumentLogCreator::Create(const Filesystem* filesystem, /*compress_in=*/true))); CreateResult create_result = {std::move(log_create_result), - regen_derived_files}; + preexisting_file_version, new_file}; return create_result; } |