diff options
Diffstat (limited to 'searchcore/src/vespa/searchcore/proton/attribute/imported_attributes_context.cpp')
-rw-r--r-- | searchcore/src/vespa/searchcore/proton/attribute/imported_attributes_context.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/imported_attributes_context.cpp b/searchcore/src/vespa/searchcore/proton/attribute/imported_attributes_context.cpp index 0aaa88db859..376c84c12d6 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/imported_attributes_context.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/imported_attributes_context.cpp @@ -23,7 +23,15 @@ ImportedAttributesContext::getOrCacheAttribute(const vespalib::string &name, Att } const ImportedAttributeVector::SP & result = _repo.get(name); if (result) { - auto insRes = attributes.emplace(name, result->makeReadGuard(stableEnumGuard)); + auto metaItr = _metaStores.find(result->getTargetDocumentMetaStore().get()); + std::shared_ptr<MetaStoreReadGuard> metaGuard; + if (metaItr == _metaStores.end()) { + metaGuard = result->getTargetDocumentMetaStore()->getReadGuard(); + _metaStores.emplace(result->getTargetDocumentMetaStore().get(), metaGuard); + } else { + metaGuard = metaItr->second; + } + auto insRes = attributes.emplace(name, result->makeReadGuard(std::move(metaGuard), stableEnumGuard)); return insRes.first->second->attribute(); } else { return nullptr; @@ -34,6 +42,7 @@ ImportedAttributesContext::ImportedAttributesContext(const ImportedAttributesRep : _repo(repo), _guardedAttributes(), _enumGuardedAttributes(), + _metaStores(), _cacheMutex() { } |