aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-05-09 18:36:21 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2023-05-09 18:36:21 +0000
commitbb565352a9126272451b9b3cf5679d98b1f47536 (patch)
tree23ab2ff7dd2ce48196ac69162b54812d0affaf26 /searchcore/src
parente0dbf168c3080049e8d000bd175ace44b08f8e35 (diff)
Propagate DocumentMetaStore read gaurd to RequestContext.
Diffstat (limited to 'searchcore/src')
-rw-r--r--searchcore/src/tests/proton/matching/matching_test.cpp4
-rw-r--r--searchcore/src/tests/proton/matching/request_context/request_context_test.cpp2
-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
8 files changed, 18 insertions, 16 deletions
diff --git a/searchcore/src/tests/proton/matching/matching_test.cpp b/searchcore/src/tests/proton/matching/matching_test.cpp
index d5241f7d65b..bce9694cd58 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));
}
@@ -387,7 +387,7 @@ struct MyWorld {
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);
+ *request, searchContext, attributeContext, metaStore, overrides, ttb(), nullptr, true);
MatchTools::UP match_tools = match_tools_factory->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/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;