summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-05-10 15:27:51 +0200
committerGitHub <noreply@github.com>2023-05-10 15:27:51 +0200
commit70d8b564e724fa4fec99bf13d1a4187901a63abb (patch)
treea6c21c97adcc11fe6c10e23113dd6f96bd66328a /searchcore
parent7de61e8691b8c4b97e09bc162499a8f9cec75c38 (diff)
parente87209100d3beef0f384120315d50e6910388405 (diff)
Merge pull request #27055 from vespa-engine/balder/propagate-metastorereadguard
Balder/propagate metastorereadguard
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/tests/proton/matching/matching_test.cpp7
-rw-r--r--searchcore/src/tests/proton/matching/request_context/request_context_test.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/imported_attributes_context.h2
-rw-r--r--searchcore/src/vespa/searchcore/proton/documentmetastore/i_document_meta_store_context.h2
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp6
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_tools.h1
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/matcher.cpp8
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/matcher.h1
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/requestcontext.cpp9
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/requestcontext.h3
-rw-r--r--searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_mapper.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_mapper.h8
-rw-r--r--searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_mapper_factory.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_mapper_factory.h4
14 files changed, 28 insertions, 33 deletions
diff --git a/searchcore/src/tests/proton/matching/matching_test.cpp b/searchcore/src/tests/proton/matching/matching_test.cpp
index d5241f7d65b..130fb29c289 100644
--- a/searchcore/src/tests/proton/matching/matching_test.cpp
+++ b/searchcore/src/tests/proton/matching/matching_test.cpp
@@ -377,7 +377,7 @@ struct MyWorld {
void verify_diversity_filter(const SearchRequest & req, bool expectDiverse) {
Matcher::SP matcher = createMatcher();
search::fef::Properties overrides;
- auto mtf = matcher->create_match_tools_factory(req, searchContext, attributeContext, metaStore, overrides, ttb(), true);
+ auto mtf = matcher->create_match_tools_factory(req, searchContext, attributeContext, metaStore, overrides, ttb(), nullptr, true);
auto diversity = mtf->createDiversifier(HeapSize::lookup(config));
EXPECT_EQUAL(expectDiverse, static_cast<bool>(diversity));
}
@@ -386,9 +386,8 @@ struct MyWorld {
Matcher::SP matcher = createMatcher();
SearchRequest::SP request = createSimpleRequest("f1", "spread");
search::fef::Properties overrides;
- MatchToolsFactory::UP match_tools_factory = matcher->create_match_tools_factory(
- *request, searchContext, attributeContext, metaStore, overrides, ttb(), true);
- MatchTools::UP match_tools = match_tools_factory->createMatchTools();
+ auto mtf = matcher->create_match_tools_factory(*request, searchContext, attributeContext, metaStore, overrides, ttb(), nullptr, true);
+ MatchTools::UP match_tools = mtf->createMatchTools();
match_tools->setup_first_phase(nullptr);
return match_tools->match_data().get_termwise_limit();
}
diff --git a/searchcore/src/tests/proton/matching/request_context/request_context_test.cpp b/searchcore/src/tests/proton/matching/request_context/request_context_test.cpp
index 3e74ed152b1..96cdba4c2d6 100644
--- a/searchcore/src/tests/proton/matching/request_context/request_context_test.cpp
+++ b/searchcore/src/tests/proton/matching/request_context/request_context_test.cpp
@@ -55,7 +55,7 @@ public:
_attr_ctx(),
_index_env(),
_query_env(&_index_env),
- _request_ctx(_doom, _attr_ctx, _query_env, _query_env.getObjectStore(), AttributeBlueprintParams()),
+ _request_ctx(_doom, _attr_ctx, _query_env, _query_env.getObjectStore(), AttributeBlueprintParams(), nullptr),
_query_tensor(SimpleValue::from_spec(TensorSpec("tensor(x[2])")
.add({{"x", 0}}, 3).add({{"x", 1}}, 5)))
{
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/imported_attributes_context.h b/searchcore/src/vespa/searchcore/proton/attribute/imported_attributes_context.h
index 39fde4f5fb7..69f566b70a6 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/imported_attributes_context.h
+++ b/searchcore/src/vespa/searchcore/proton/attribute/imported_attributes_context.h
@@ -2,7 +2,7 @@
#pragma once
#include <vespa/searchcommon/attribute/iattributecontext.h>
-#include <vespa/searchlib/common/i_document_meta_store_context.h>
+#include <vespa/searchcommon/attribute/i_document_meta_store_context.h>
#include <vespa/vespalib/stllike/hash_fun.h>
#include <vespa/vespalib/stllike/hash_map.h>
#include <mutex>
diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/i_document_meta_store_context.h b/searchcore/src/vespa/searchcore/proton/documentmetastore/i_document_meta_store_context.h
index 9853c4af5b6..42c9ee26f35 100644
--- a/searchcore/src/vespa/searchcore/proton/documentmetastore/i_document_meta_store_context.h
+++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/i_document_meta_store_context.h
@@ -3,7 +3,7 @@
#pragma once
#include "i_document_meta_store.h"
-#include <vespa/searchlib/common/i_document_meta_store_context.h>
+#include <vespa/searchcommon/attribute/i_document_meta_store_context.h>
namespace proton {
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp
index ef9606f96a8..c7cbdc29689 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_tools.cpp
@@ -10,9 +10,6 @@
#include <vespa/searchlib/engine/trace.h>
#include <vespa/searchlib/fef/indexproperties.h>
#include <vespa/searchlib/fef/ranksetup.h>
-#include <vespa/vespalib/data/slime/cursor.h>
-#include <vespa/vespalib/data/slime/inject.h>
-#include <vespa/vespalib/data/slime/inserter.h>
#include <vespa/vespalib/util/issue.h>
#include <vespa/vespalib/util/thread_bundle.h>
@@ -176,13 +173,14 @@ MatchToolsFactory(QueryLimiter & queryLimiter,
const Properties & rankProperties,
const Properties & featureOverrides,
vespalib::ThreadBundle & thread_bundle,
+ const search::IDocumentMetaStoreContext::IReadGuard::SP * metaStoreReadGuard,
bool is_search)
: _queryLimiter(queryLimiter),
_global_filter_params(extract_global_filter_params(rankSetup, rankProperties, metaStore.getNumActiveLids(), searchContext.getDocIdLimit())),
_query(),
_match_limiter(),
_queryEnv(indexEnv, attributeContext, rankProperties, searchContext.getIndexes()),
- _requestContext(doom, attributeContext, _queryEnv, _queryEnv.getObjectStore(), _global_filter_params),
+ _requestContext(doom, attributeContext, _queryEnv, _queryEnv.getObjectStore(), _global_filter_params, metaStoreReadGuard),
_mdl(),
_rankSetup(rankSetup),
_featureOverrides(featureOverrides),
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_tools.h b/searchcore/src/vespa/searchcore/proton/matching/match_tools.h
index b00415a309f..607a9d6aab0 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_tools.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_tools.h
@@ -154,6 +154,7 @@ public:
const Properties &rankProperties,
const Properties &featureOverrides,
vespalib::ThreadBundle &thread_bundle,
+ const search::IDocumentMetaStoreContext::IReadGuard::SP * metaStoreReadGuard,
bool is_search);
~MatchToolsFactory();
bool valid() const { return _valid; }
diff --git a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp
index 657f3d11e76..e2c5f4ef559 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp
@@ -143,6 +143,7 @@ std::unique_ptr<MatchToolsFactory>
Matcher::create_match_tools_factory(const search::engine::Request &request, ISearchContext &searchContext,
IAttributeContext &attrContext, const search::IDocumentMetaStore &metaStore,
const Properties &feature_overrides, vespalib::ThreadBundle &thread_bundle,
+ const IDocumentMetaStoreContext::IReadGuard::SP * metaStoreReadGuard,
bool is_search) const
{
const Properties & rankProperties = request.propertiesMap.rankProperties();
@@ -163,7 +164,8 @@ Matcher::create_match_tools_factory(const search::engine::Request &request, ISea
return std::make_unique<MatchToolsFactory>(_queryLimiter, doom, searchContext, attrContext,
request.trace(), request.getStackRef(), request.location,
_viewResolver, metaStore, _indexEnv, *_rankSetup,
- rankProperties, feature_overrides, thread_bundle, is_search);
+ rankProperties, feature_overrides, thread_bundle,
+ metaStoreReadGuard, is_search);
}
size_t
@@ -224,7 +226,7 @@ Matcher::match(const SearchRequest &request, vespalib::ThreadBundle &threadBundl
}
MatchToolsFactory::UP mtf = create_match_tools_factory(request, searchContext, attrContext, metaStore,
- *feature_overrides, threadBundle, true);
+ *feature_overrides, threadBundle, &owned_objects.readGuard, true);
isDoomExplicit = mtf->getRequestContext().getDoom().isExplicitSoftDoom();
traceQuery(6, request.trace(), mtf->query());
if (!mtf->valid()) {
@@ -376,7 +378,7 @@ Matcher::create_docsum_matcher(const DocsumRequest &req, ISearchContext &search_
StupidMetaStore meta;
MatchToolsFactory::UP mtf = create_match_tools_factory(req, search_ctx, attr_ctx, meta,
req.propertiesMap.featureOverrides(),
- vespalib::ThreadBundle::trivial(), false);
+ vespalib::ThreadBundle::trivial(), nullptr, false);
if (!mtf->valid()) {
LOG(warning, "could not initialize docsum matching: %s",
(expectedSessionCached) ? "session has expired" : "invalid query");
diff --git a/searchcore/src/vespa/searchcore/proton/matching/matcher.h b/searchcore/src/vespa/searchcore/proton/matching/matcher.h
index 198334e4021..3e40eb640f1 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/matcher.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/matcher.h
@@ -105,6 +105,7 @@ public:
create_match_tools_factory(const search::engine::Request &request, ISearchContext &searchContext,
IAttributeContext &attrContext, const search::IDocumentMetaStore &metaStore,
const Properties &feature_overrides, vespalib::ThreadBundle &thread_bundle,
+ const IDocumentMetaStoreContext::IReadGuard::SP * metaStoreReadGuard,
bool is_search) const;
/**
diff --git a/searchcore/src/vespa/searchcore/proton/matching/requestcontext.cpp b/searchcore/src/vespa/searchcore/proton/matching/requestcontext.cpp
index ddd8d83fd3b..39d6dec41c6 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/requestcontext.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/requestcontext.cpp
@@ -6,7 +6,6 @@
#include <vespa/searchlib/attribute/attributevector.h>
#include <vespa/searchlib/fef/iqueryenvironment.h>
#include <vespa/searchlib/fef/query_value.h>
-#include <vespa/vespalib/objects/nbostream.h>
#include <vespa/vespalib/util/issue.h>
#include <vespa/log/log.h>
@@ -22,15 +21,15 @@ using search::attribute::IAttributeVector;
RequestContext::RequestContext(const Doom & doom, IAttributeContext & attributeContext,
const search::fef::IQueryEnvironment& query_env,
search::fef::IObjectStore& shared_store,
- const search::attribute::AttributeBlueprintParams& attribute_blueprint_params)
+ const search::attribute::AttributeBlueprintParams& attribute_blueprint_params,
+ const MetaStoreReadGuardSP * metaStoreReadGuard)
: _doom(doom),
_attributeContext(attributeContext),
_query_env(query_env),
_shared_store(shared_store),
_attribute_blueprint_params(attribute_blueprint_params),
- _metaStoreReadGuard(nullptr)
-{
-}
+ _metaStoreReadGuard(metaStoreReadGuard)
+{ }
const search::attribute::IAttributeVector *
RequestContext::getAttribute(const vespalib::string &name) const
diff --git a/searchcore/src/vespa/searchcore/proton/matching/requestcontext.h b/searchcore/src/vespa/searchcore/proton/matching/requestcontext.h
index 661e5fbd208..b4b919c6975 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/requestcontext.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/requestcontext.h
@@ -26,7 +26,8 @@ public:
IAttributeContext& attributeContext,
const search::fef::IQueryEnvironment& query_env,
search::fef::IObjectStore& shared_store,
- const search::attribute::AttributeBlueprintParams& attribute_blueprint_params);
+ const search::attribute::AttributeBlueprintParams& attribute_blueprint_params,
+ const MetaStoreReadGuardSP * metaStoreReadGuard);
const Doom & getDoom() const override { return _doom; }
const search::attribute::IAttributeVector *getAttribute(const vespalib::string &name) const override;
diff --git a/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_mapper.cpp b/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_mapper.cpp
index e17c670a9d1..c0831f554de 100644
--- a/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_mapper.cpp
+++ b/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_mapper.cpp
@@ -10,9 +10,7 @@ GidToLidMapper::GidToLidMapper(const search::IDocumentMetaStoreContext &dmsConte
{
}
-GidToLidMapper::~GidToLidMapper()
-{
-}
+GidToLidMapper::~GidToLidMapper() = default;
void
GidToLidMapper::foreach(const search::IGidToLidMapperVisitor &visitor) const
diff --git a/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_mapper.h b/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_mapper.h
index dd0e462aa49..5229b08e765 100644
--- a/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_mapper.h
+++ b/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_mapper.h
@@ -2,13 +2,11 @@
#pragma once
-#include <vespa/searchlib/common/i_document_meta_store_context.h>
+#include <vespa/searchcommon/attribute/i_document_meta_store_context.h>
#include <vespa/searchlib/common/i_gid_to_lid_mapper.h>
namespace proton {
-class DocumentMetaStore;
-
/*
* Class for mapping from gid to lid. Instances should be short lived
* due to read guards preventing resource reuse.
@@ -18,8 +16,8 @@ class GidToLidMapper : public search::IGidToLidMapper
search::IDocumentMetaStoreContext::IReadGuard::SP _guard;
public:
GidToLidMapper(const search::IDocumentMetaStoreContext &dmsContext);
- virtual ~GidToLidMapper();
- virtual void foreach(const search::IGidToLidMapperVisitor &visitor) const override;
+ ~GidToLidMapper() override;
+ void foreach(const search::IGidToLidMapperVisitor &visitor) const override;
};
} // namespace proton
diff --git a/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_mapper_factory.cpp b/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_mapper_factory.cpp
index 1f4e6fc081b..fff23fab681 100644
--- a/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_mapper_factory.cpp
+++ b/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_mapper_factory.cpp
@@ -11,9 +11,7 @@ GidToLidMapperFactory::GidToLidMapperFactory(std::shared_ptr<const search::IDocu
{
}
-GidToLidMapperFactory::~GidToLidMapperFactory()
-{
-}
+GidToLidMapperFactory::~GidToLidMapperFactory() = default;
std::unique_ptr<search::IGidToLidMapper>
GidToLidMapperFactory::getMapper() const
diff --git a/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_mapper_factory.h b/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_mapper_factory.h
index 7fd2aa603a4..31668e8332d 100644
--- a/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_mapper_factory.h
+++ b/searchcore/src/vespa/searchcore/proton/reference/gid_to_lid_mapper_factory.h
@@ -15,8 +15,8 @@ class GidToLidMapperFactory : public search::IGidToLidMapperFactory
std::shared_ptr<const search::IDocumentMetaStoreContext> _dmsContext;
public:
GidToLidMapperFactory(std::shared_ptr<const search::IDocumentMetaStoreContext> dmsContext);
- virtual ~GidToLidMapperFactory();
- virtual std::unique_ptr<search::IGidToLidMapper> getMapper() const override;
+ ~GidToLidMapperFactory() override;
+ std::unique_ptr<search::IGidToLidMapper> getMapper() const override;
};
} // namespace proton