diff options
author | Tim Barron <tjbarron@google.com> | 2022-05-20 20:39:53 +0000 |
---|---|---|
committer | Tim Barron <tjbarron@google.com> | 2022-05-20 20:39:53 +0000 |
commit | 9ea2234cfe87ffeca5e632704c8cf3ddbb00609b (patch) | |
tree | 62f140d7fa7af039b91935470bc0b59e0d8ed61e /icing/index/lite | |
parent | 21441c71652b1116c467e106e1b735a9bd90541d (diff) | |
download | icing-9ea2234cfe87ffeca5e632704c8cf3ddbb00609b.tar.gz |
Sync from upstream.
Descriptions:
======================================================================
Fix bug in schema store where a failure during RegenerateDerivedFiles would lead to a dangling pointer.
======================================================================
Add RAII class that will create and destroy file directories.
======================================================================
Convert MainIndexDebugInfoProto and LiteIndexDebugInfoProto to string
======================================================================
Make SchemaStore move assignable.
======================================================================
Rollback of "convert the string lexicon debug information to a protocol buffer"
======================================================================
Fix NPE caused by a remap failure.
======================================================================
Unify the name "priority" and "severity" in Icing logging
======================================================================
Avoiding string formatting in Icing logging when we should not log
======================================================================
Switch to use an enum with BASIC/DETAILED to control the verbosity of getDebugInfo
======================================================================
Remove the behavior in the Language Segmenter to filter out non-ascii+non-alphanumeric characters.
======================================================================
Fix the SetSchema bug when we override a schema with nested incompatible types
======================================================================
Wrap __android_log_write with __android_is_loggable
======================================================================
Enable removing expired page tokens to free cache space
======================================================================
Bug: 146903474
Bug: 193453081
Bug: 222349894
Bug: 229770338
Bug: 229778472
Bug: 230879098
Bug: 231416401
Bug: 231237897
Bug: 232273174
Change-Id: I22f050de16f56dce39e12a7033947519d598c840
Diffstat (limited to 'icing/index/lite')
-rw-r--r-- | icing/index/lite/lite-index.cc | 25 | ||||
-rw-r--r-- | icing/index/lite/lite-index.h | 6 |
2 files changed, 19 insertions, 12 deletions
diff --git a/icing/index/lite/lite-index.cc b/icing/index/lite/lite-index.cc index dd964df..fc40225 100644 --- a/icing/index/lite/lite-index.cc +++ b/icing/index/lite/lite-index.cc @@ -391,15 +391,22 @@ bool LiteIndex::is_full() const { lexicon_.min_free_fraction() < (1.0 - kTrieFullFraction)); } -IndexDebugInfoProto::LiteIndexDebugInfoProto LiteIndex::GetDebugInfo( - int verbosity) { - IndexDebugInfoProto::LiteIndexDebugInfoProto res; - res.set_curr_size(header_->cur_size()); - res.set_hit_buffer_size(options_.hit_buffer_size); - res.set_last_added_document_id(header_->last_added_docid()); - res.set_searchable_end(header_->searchable_end()); - res.set_index_crc(ComputeChecksum().Get()); - *res.mutable_lexicon_info() = lexicon_.GetDebugInfo(verbosity); +std::string LiteIndex::GetDebugInfo(DebugInfoVerbosity::Code verbosity) { + std::string res; + std::string lexicon_info; + lexicon_.GetDebugInfo(verbosity, &lexicon_info); + IcingStringUtil::SStringAppendF( + &res, 0, + "curr_size: %u\n" + "hit_buffer_size: %u\n" + "last_added_document_id %u\n" + "searchable_end: %u\n" + "index_crc: %u\n" + "\n" + "lite_lexicon_info:\n%s\n", + header_->cur_size(), options_.hit_buffer_size, + header_->last_added_docid(), header_->searchable_end(), + ComputeChecksum().Get(), lexicon_info.c_str()); return res; } diff --git a/icing/index/lite/lite-index.h b/icing/index/lite/lite-index.h index 378fc94..42d69f8 100644 --- a/icing/index/lite/lite-index.h +++ b/icing/index/lite/lite-index.h @@ -240,9 +240,9 @@ class LiteIndex { const IcingDynamicTrie& lexicon() const { return lexicon_; } // Returns debug information for the index in out. - // verbosity <= 0, simplest debug information - size of lexicon, hit buffer - // verbosity > 0, more detailed debug information from the lexicon. - IndexDebugInfoProto::LiteIndexDebugInfoProto GetDebugInfo(int verbosity); + // verbosity = BASIC, simplest debug information - size of lexicon, hit buffer + // verbosity = DETAILED, more detailed debug information from the lexicon. + std::string GetDebugInfo(DebugInfoVerbosity::Code verbosity); // Returns the byte size of all the elements held in the index. This excludes // the size of any internal metadata of the index, e.g. the index's header. |