diff options
author | Geir Storli <geirst@verizonmedia.com> | 2021-08-23 09:39:33 +0000 |
---|---|---|
committer | Geir Storli <geirst@verizonmedia.com> | 2021-08-23 09:39:33 +0000 |
commit | 955adc64bdc53ceb4dfd8993cad3d3d7f0e2d190 (patch) | |
tree | b316e576a8ffc08db970383de4955c2954792a9d /searchlib | |
parent | b5de4aa680f61f51f8b6ef0872e3d84a2c986e49 (diff) |
Report address space usage for shared string repo for non-dense tensor attributes.
Diffstat (limited to 'searchlib')
5 files changed, 18 insertions, 2 deletions
diff --git a/searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp b/searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp index db76d8bad25..f577aedfbf1 100644 --- a/searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp +++ b/searchlib/src/tests/attribute/tensorattribute/tensorattribute_test.cpp @@ -716,8 +716,14 @@ Fixture::test_populate_address_space_usage() { search::AddressSpaceUsage usage = _attr->getAddressSpaceUsage(); const auto& all = usage.get_all(); - EXPECT_EQUAL(1u, all.size()); - EXPECT_EQUAL(1u, all.count("tensor-store")); + if (_denseTensors) { + EXPECT_EQUAL(1u, all.size()); + EXPECT_EQUAL(1u, all.count("tensor-store")); + } else { + EXPECT_EQUAL(2u, all.size()); + EXPECT_EQUAL(1u, all.count("tensor-store")); + EXPECT_EQUAL(1u, all.count("shared-string-repo")); + } } template <class MakeFixture> diff --git a/searchlib/src/vespa/searchlib/attribute/address_space_components.cpp b/searchlib/src/vespa/searchlib/attribute/address_space_components.cpp index 1e6ad8f4ef7..00f2ea4a0a3 100644 --- a/searchlib/src/vespa/searchlib/attribute/address_space_components.cpp +++ b/searchlib/src/vespa/searchlib/attribute/address_space_components.cpp @@ -18,6 +18,7 @@ AddressSpace AddressSpaceComponents::default_multi_value_usage() { const vespalib::string AddressSpaceComponents::enum_store = "enum-store"; const vespalib::string AddressSpaceComponents::multi_value = "multi-value"; const vespalib::string AddressSpaceComponents::tensor_store = "tensor-store"; +const vespalib::string AddressSpaceComponents::shared_string_repo = "shared-string-repo"; const vespalib::string AddressSpaceComponents::hnsw_node_store = "hnsw-node-store"; const vespalib::string AddressSpaceComponents::hnsw_link_store = "hnsw-link-store"; diff --git a/searchlib/src/vespa/searchlib/attribute/address_space_components.h b/searchlib/src/vespa/searchlib/attribute/address_space_components.h index 213d86fa803..257d3079f1a 100644 --- a/searchlib/src/vespa/searchlib/attribute/address_space_components.h +++ b/searchlib/src/vespa/searchlib/attribute/address_space_components.h @@ -17,6 +17,7 @@ public: static const vespalib::string enum_store; static const vespalib::string multi_value; static const vespalib::string tensor_store; + static const vespalib::string shared_string_repo; static const vespalib::string hnsw_node_store; static const vespalib::string hnsw_link_store; }; diff --git a/searchlib/src/vespa/searchlib/tensor/tensor_attribute.cpp b/searchlib/src/vespa/searchlib/tensor/tensor_attribute.cpp index d61fc544839..8ecce17f033 100644 --- a/searchlib/src/vespa/searchlib/tensor/tensor_attribute.cpp +++ b/searchlib/src/vespa/searchlib/tensor/tensor_attribute.cpp @@ -8,6 +8,7 @@ #include <vespa/vespalib/data/slime/cursor.h> #include <vespa/vespalib/data/slime/inserter.h> #include <vespa/vespalib/util/rcuvector.hpp> +#include <vespa/vespalib/util/shared_string_repo.h> #include <vespa/eval/eval/fast_value.h> #include <vespa/eval/eval/value_codec.h> #include <vespa/eval/eval/tensor_spec.h> @@ -53,6 +54,7 @@ TensorAttribute::TensorAttribute(vespalib::stringref name, const Config &cfg, Te cfg.getGrowStrategy().getDocsGrowDelta(), getGenerationHolder()), _tensorStore(tensorStore), + _is_dense(cfg.tensorType().is_dense()), _emptyTensor(createEmptyTensor(cfg.tensorType())), _compactGeneration(0), _cached_tensor_store_memory_usage() @@ -195,6 +197,11 @@ void TensorAttribute::populate_address_space_usage(AddressSpaceUsage& usage) const { usage.set(AddressSpaceComponents::tensor_store, _tensorStore.get_address_space_usage()); + if (!_is_dense) { + auto stats = vespalib::SharedStringRepo::stats(); + usage.set(AddressSpaceComponents::shared_string_repo, + vespalib::AddressSpace(stats.max_part_usage, 0, stats.part_limit())); + } } vespalib::eval::Value::UP diff --git a/searchlib/src/vespa/searchlib/tensor/tensor_attribute.h b/searchlib/src/vespa/searchlib/tensor/tensor_attribute.h index 115a8d34058..156a04bdb14 100644 --- a/searchlib/src/vespa/searchlib/tensor/tensor_attribute.h +++ b/searchlib/src/vespa/searchlib/tensor/tensor_attribute.h @@ -24,6 +24,7 @@ protected: RefVector _refVector; // docId -> ref in data store for serialized tensor TensorStore &_tensorStore; // data store for serialized tensors + bool _is_dense; std::unique_ptr<vespalib::eval::Value> _emptyTensor; uint64_t _compactGeneration; // Generation when last compact occurred vespalib::MemoryUsage _cached_tensor_store_memory_usage; |