summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2017-08-07 13:40:52 +0200
committerGitHub <noreply@github.com>2017-08-07 13:40:52 +0200
commitc983e3bb1886d1eea4a2c246b0d81221ef97b84c (patch)
tree81d6a7c36e038e36c7360321d236f2ea8d3749e4 /searchcore
parent0428c9e03e534b7f6d6cff3ae0746d21de690c98 (diff)
parent0872f9c292f9566bf8871a76d4d7b5baedb50f17 (diff)
Merge pull request #3053 from yahoo/balder/keep-the-documentmetastore-readguard-alive-in-session-cache
Keep the DocumentMetaStore readguard live in teh ssession cache so th…
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/match_context.h7
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/matcher.cpp18
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/search_session.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/search_session.h4
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/matchview.cpp5
5 files changed, 19 insertions, 17 deletions
diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_context.h b/searchcore/src/vespa/searchcore/proton/matching/match_context.h
index 1665f5f4f1d..1209ffc48ac 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/match_context.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/match_context.h
@@ -6,8 +6,7 @@
#include <vespa/searchcommon/attribute/iattributecontext.h>
#include <memory>
-namespace proton {
-namespace matching {
+namespace proton::matching {
class MatchContext {
using IAttributeContext = search::attribute::IAttributeContext;
@@ -30,6 +29,4 @@ public:
void releaseEnumGuards() { _attrCtx->releaseEnumGuards(); }
};
-} // namespace proton::matching
-} // namespace proton
-
+}
diff --git a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp
index 1e7839e9714..852176e4918 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/matcher.cpp
@@ -20,9 +20,11 @@ LOG_SETUP(".proton.matching.matcher");
using search::fef::Properties;
using namespace search::fef::indexproperties::matching;
-using namespace search;
using namespace search::engine;
using namespace search::grouping;
+using search::DocumentMetaData;
+using search::LidUsageStats;
+using search::FeatureSet;
using search::attribute::IAttributeContext;
using search::fef::MatchDataLayout;
using search::fef::MatchData;
@@ -35,7 +37,7 @@ namespace proton::matching {
namespace {
// used to give out empty blacklist blueprints
-struct StupidMetaStore : IDocumentMetaStore {
+struct StupidMetaStore : search::IDocumentMetaStore {
bool getGid(DocId, GlobalId &) const override { return false; }
bool getGidEvenIfMoved(DocId, GlobalId &) const override { return false; }
bool getLid(const GlobalId &, DocId &) const override { return false; }
@@ -121,7 +123,7 @@ Matcher::getFeatureSet(const DocsumRequest & req,
return findFeatureSet(req, *mtf, summaryFeatures);
}
-Matcher::Matcher(const index::Schema &schema,
+Matcher::Matcher(const search::index::Schema &schema,
const Properties &props,
const vespalib::Clock &clock,
QueryLimiter &queryLimiter,
@@ -137,9 +139,9 @@ Matcher::Matcher(const index::Schema &schema,
_queryLimiter(queryLimiter),
_distributionKey(distributionKey)
{
- features::setup_search_features(_blueprintFactory);
- fef::test::setup_fef_test_plugin(_blueprintFactory);
- _rankSetup.reset(new fef::RankSetup(_blueprintFactory, _indexEnv));
+ search::features::setup_search_features(_blueprintFactory);
+ search::fef::test::setup_fef_test_plugin(_blueprintFactory);
+ _rankSetup.reset(new search::fef::RankSetup(_blueprintFactory, _indexEnv));
_rankSetup->configure(); // reads config values from the property map
if (!_rankSetup->compile()) {
throw vespalib::IllegalArgumentException("failed to compile rank setup", VESPA_STRLOC);
@@ -163,7 +165,7 @@ std::unique_ptr<MatchToolsFactory>
Matcher::create_match_tools_factory(const search::engine::Request &request,
ISearchContext &searchContext,
IAttributeContext &attrContext,
- const IDocumentMetaStore &metaStore,
+ const search::IDocumentMetaStore &metaStore,
const Properties &feature_overrides) const
{
const Properties & rankProperties = request.propertiesMap.rankProperties();
@@ -211,7 +213,7 @@ Matcher::match(const SearchRequest &request,
ISearchContext &searchContext,
IAttributeContext &attrContext,
SessionManager &sessionMgr,
- const IDocumentMetaStore &metaStore,
+ const search::IDocumentMetaStore &metaStore,
SearchSession::OwnershipBundle &&owned_objects)
{
fastos::StopWatch total_matching_time;
diff --git a/searchcore/src/vespa/searchcore/proton/matching/search_session.cpp b/searchcore/src/vespa/searchcore/proton/matching/search_session.cpp
index 8a5d22012e6..a077edcc3fe 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/search_session.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matching/search_session.cpp
@@ -23,7 +23,7 @@ SearchSession::releaseEnumGuards() {
SearchSession::~SearchSession() { }
-SearchSession::OwnershipBundle::OwnershipBundle() { }
+SearchSession::OwnershipBundle::OwnershipBundle() = default;
SearchSession::OwnershipBundle::~OwnershipBundle() { }
}
diff --git a/searchcore/src/vespa/searchcore/proton/matching/search_session.h b/searchcore/src/vespa/searchcore/proton/matching/search_session.h
index 691a33022c3..9bea3fdcc5a 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/search_session.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/search_session.h
@@ -2,6 +2,7 @@
#pragma once
+#include <vespa/searchcore/proton/documentmetastore/i_document_meta_store_context.h>
#include <vespa/searchcore/proton/summaryengine/isearchhandler.h>
#include <vespa/vespalib/stllike/string.h>
#include <memory>
@@ -28,6 +29,7 @@ public:
ISearchHandler::SP search_handler;
std::unique_ptr<search::fef::Properties> feature_overrides;
std::unique_ptr<MatchContext> context;
+ IDocumentMetaStoreContext::IReadGuard::UP readGuard;
};
private:
typedef vespalib::string SessionId;
@@ -35,7 +37,7 @@ private:
SessionId _session_id;
fastos::TimeStamp _create_time;
fastos::TimeStamp _time_of_doom;
- OwnershipBundle _owned_objects;
+ OwnershipBundle _owned_objects;
std::unique_ptr<MatchToolsFactory> _match_tools_factory;
public:
diff --git a/searchcore/src/vespa/searchcore/proton/server/matchview.cpp b/searchcore/src/vespa/searchcore/proton/server/matchview.cpp
index c0081dccd05..0f38e48a8e2 100644
--- a/searchcore/src/vespa/searchcore/proton/server/matchview.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/matchview.cpp
@@ -69,13 +69,14 @@ MatchView::match(const ISearchHandler::SP &searchHandler, const SearchRequest &r
vespalib::ThreadBundle &threadBundle) const
{
Matcher::SP matcher = getMatcher(req.ranking);
- IDocumentMetaStoreContext::IReadGuard::UP guard = _metaStore->getReadGuard();
SearchSession::OwnershipBundle owned_objects;
owned_objects.search_handler = searchHandler;
owned_objects.context = createContext();
+ owned_objects.readGuard = _metaStore->getReadGuard();;
MatchContext *ctx = owned_objects.context.get();
+ const search::IDocumentMetaStore & dms = owned_objects.readGuard->get();
return matcher->match(req, threadBundle, ctx->getSearchContext(), ctx->getAttributeContext(),
- *_sessionMgr, guard->get(), std::move(owned_objects));
+ *_sessionMgr, dms, std::move(owned_objects));
}