summaryrefslogtreecommitdiffstats
path: root/searchlib
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2024-04-24 12:16:00 +0200
committerGitHub <noreply@github.com>2024-04-24 12:16:00 +0200
commite5698732b678dded938edaec10dd290de4f58165 (patch)
tree9129320e3c5ec2702d02e019b0a1a23d884604fc /searchlib
parent5a45898ac1dc3c512e3306d92a2c082f04f4f837 (diff)
parent1e52b163f7b454738fe51299274df5c0ef91d71e (diff)
Merge pull request #31012 from vespa-engine/toregge/use-frozen-btree-size-in-reader-thread
search::predicate::SimpleIndex: Use frozen btree size in reader thread
Diffstat (limited to 'searchlib')
-rw-r--r--searchlib/src/vespa/searchlib/predicate/simple_index.h3
-rw-r--r--searchlib/src/vespa/searchlib/predicate/simple_index.hpp6
2 files changed, 8 insertions, 1 deletions
diff --git a/searchlib/src/vespa/searchlib/predicate/simple_index.h b/searchlib/src/vespa/searchlib/predicate/simple_index.h
index 0e3c9828b21..b117bf188ed 100644
--- a/searchlib/src/vespa/searchlib/predicate/simple_index.h
+++ b/searchlib/src/vespa/searchlib/predicate/simple_index.h
@@ -166,6 +166,7 @@ private:
double ratio, size_t vector_length) const;
double getDocumentRatio(size_t document_count, uint32_t doc_id_limit) const;
size_t getDocumentCount(vespalib::datastore::EntryRef ref) const;
+ size_t get_frozen_document_count(vespalib::datastore::EntryRef ref) const;
bool shouldCreateVectorPosting(size_t size, double ratio) const;
bool shouldRemoveVectorPosting(size_t size, double ratio) const;
size_t getVectorPostingSize(const PostingVector &vector) const {
@@ -226,7 +227,7 @@ template<typename FunctionType>
void
SimpleIndex<Posting, Key, DocId>::foreach_frozen_key(vespalib::datastore::EntryRef ref, Key key, FunctionType func) const {
auto it = _vector_posting_lists.getFrozenView().find(key);
- double ratio = getDocumentRatio(getDocumentCount(ref), _limit_provider.getDocIdLimit());
+ double ratio = getDocumentRatio(get_frozen_document_count(ref), _limit_provider.getDocIdLimit());
if (it.valid() && ratio > _config.foreach_vector_threshold) {
auto &vector = *it.getData();
size_t size = getVectorPostingSize(vector);
diff --git a/searchlib/src/vespa/searchlib/predicate/simple_index.hpp b/searchlib/src/vespa/searchlib/predicate/simple_index.hpp
index 0516227081e..b1a6f9b1a49 100644
--- a/searchlib/src/vespa/searchlib/predicate/simple_index.hpp
+++ b/searchlib/src/vespa/searchlib/predicate/simple_index.hpp
@@ -253,6 +253,12 @@ SimpleIndex<Posting, Key, DocId>::getDocumentCount(vespalib::datastore::EntryRef
};
template <typename Posting, typename Key, typename DocId>
+size_t
+SimpleIndex<Posting, Key, DocId>::get_frozen_document_count(vespalib::datastore::EntryRef ref) const {
+ return _btree_posting_lists.frozenSize(ref);
+};
+
+template <typename Posting, typename Key, typename DocId>
bool
SimpleIndex<Posting, Key, DocId>::shouldRemoveVectorPosting(size_t size, double ratio) const {
return size < _config.lower_vector_size_threshold || ratio < _config.lower_docid_freq_threshold;