aboutsummaryrefslogtreecommitdiffstats
path: root/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector.cpp
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-06-04 11:04:55 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2022-06-04 11:04:55 +0000
commit934a08b254e99acb3fce4282170b612ee2cf286e (patch)
treec1d56fb2e4eadf139bebf8ffa1699ea1d72f65c4 /searchlib/src/vespa/searchlib/attribute/imported_attribute_vector.cpp
parent24a3487c20c02b450b9934f6d48431ec407678d5 (diff)
Creating the document metastore read guard is expensive and is not necessary to do for every imported attribute.
We do it once per metastore and cache it in the ImportedAttributeContext. It would be even better if we could drop support for the default makeReadGuard(bool). Then we would also avoid copying the shared_ptr.
Diffstat (limited to 'searchlib/src/vespa/searchlib/attribute/imported_attribute_vector.cpp')
-rw-r--r--searchlib/src/vespa/searchlib/attribute/imported_attribute_vector.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector.cpp b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector.cpp
index 1ae2b6ee749..6218f3d72b2 100644
--- a/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/imported_attribute_vector.cpp
@@ -43,7 +43,13 @@ ImportedAttributeVector::~ImportedAttributeVector() = default;
std::unique_ptr<AttributeReadGuard>
ImportedAttributeVector::makeReadGuard(bool stableEnumGuard) const
{
- return std::make_unique<ImportedAttributeVectorReadGuard>(*this, stableEnumGuard);
+ return makeReadGuard(_target_document_meta_store->getReadGuard(), stableEnumGuard);
+}
+
+std::unique_ptr<AttributeReadGuard>
+ImportedAttributeVector::makeReadGuard(std::shared_ptr<MetaStoreReadGuard> targetMetaStoreReadGuard, bool stableEnumGuard) const
+{
+ return std::make_unique<ImportedAttributeVectorReadGuard>(std::move(targetMetaStoreReadGuard), *this, stableEnumGuard);
}
void ImportedAttributeVector::clearSearchCache() {