diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-08-07 09:03:50 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2017-08-07 09:03:50 +0200 |
commit | 3b82c54303b75f7f298ac0e2181d3dda935251fe (patch) | |
tree | 0b38a7fa1100a76a7761341250b91c96358d21cf /searchcore/src | |
parent | 3055b8c99bfdaf304648b0156ede5c797c881080 (diff) |
Keep the DocumentMetaStore readguard live in teh ssession cache so the blueprint are still valid afterwards.
Diffstat (limited to 'searchcore/src')
4 files changed, 18 insertions, 16 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.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)); } |