aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-02-22 22:49:01 +0100
committerGitHub <noreply@github.com>2020-02-22 22:49:01 +0100
commit5c105fa6ffe3ed27c633e48f17206d2b31307936 (patch)
treec66b48d95a8c1eee47350b1288e62295ab507142
parentd1e343ea538a0ca0f924564b0434837dff34d390 (diff)
parentfb751b67469af516373874a44c307fa1af2c6a83 (diff)
Merge pull request #12225 from vespa-engine/balder/avoid-the-need-for-propagating-shared_ptr-all-through-all-layers
Use enable_shared_from_this to simplify interface and keep the detail…
-rw-r--r--searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp4
-rw-r--r--searchcore/src/tests/proton/matchengine/matchengine.cpp54
-rw-r--r--searchcore/src/tests/proton/matching/matching_test.cpp2
-rw-r--r--searchcore/src/tests/proton/summaryengine/summaryengine.cpp56
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp8
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.h2
-rw-r--r--searchcore/src/vespa/searchcore/proton/common/doctypename.cpp12
-rw-r--r--searchcore/src/vespa/searchcore/proton/common/handlermap.hpp1
-rw-r--r--searchcore/src/vespa/searchcore/proton/matchengine/imatchhandler.h46
-rw-r--r--searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp7
-rw-r--r--searchcore/src/vespa/searchcore/proton/matchengine/matchengine.h8
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/search_session.h2
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/documentdb.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/documentdb.h3
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/emptysearchview.cpp19
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/emptysearchview.h13
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/matchview.cpp24
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/matchview.h12
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/proton.cpp3
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.cpp10
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.h5
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp8
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/searchhandlerproxy.cpp10
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/searchhandlerproxy.h6
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/searchview.cpp15
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/searchview.h9
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h1
-rw-r--r--searchcore/src/vespa/searchcore/proton/summaryengine/isearchhandler.h5
-rw-r--r--searchcore/src/vespa/searchcore/proton/summaryengine/summaryengine.cpp4
29 files changed, 139 insertions, 214 deletions
diff --git a/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp b/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp
index 3c3ed33b8ea..14ad82a0aa1 100644
--- a/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp
@@ -208,10 +208,10 @@ Fixture::initViewSet(ViewSet &views)
views._lidReuseDelayer = std::make_unique<documentmetastore::LidReuseDelayer>(views._writeService, metaStore->get());
IndexSearchable::SP indexSearchable;
MatchView::SP matchView(new MatchView(matchers, indexSearchable, attrMgr, sesMgr, metaStore, views._docIdLimit));
- views.searchView.set(make_shared<SearchView>
+ views.searchView.set(SearchView::create
(summaryMgr->createSummarySetup(SummaryConfig(), SummarymapConfig(),
JuniperrcConfig(), views.repo, attrMgr),
- matchView));
+ std::move(matchView)));
views.feedView.set(
make_shared<SearchableFeedView>(StoreOnlyFeedView::Context(summaryAdapter,
schema,
diff --git a/searchcore/src/tests/proton/matchengine/matchengine.cpp b/searchcore/src/tests/proton/matchengine/matchengine.cpp
index 9ae938981a4..fd48fffcb5c 100644
--- a/searchcore/src/tests/proton/matchengine/matchengine.cpp
+++ b/searchcore/src/tests/proton/matchengine/matchengine.cpp
@@ -18,18 +18,17 @@ class MySearchHandler : public ISearchHandler {
std::string _reply;
public:
MySearchHandler(size_t numHits = 0) :
- _numHits(numHits), _name("my"), _reply("myreply") {}
- virtual DocsumReply::UP getDocsums(const DocsumRequest &) override {
- return DocsumReply::UP(new DocsumReply);
+ _numHits(numHits), _name("my"), _reply("myreply")
+ {}
+ DocsumReply::UP getDocsums(const DocsumRequest &) override {
+ return std::make_unique<DocsumReply>();
}
- virtual search::engine::SearchReply::UP match(
- const ISearchHandler::SP &,
- const search::engine::SearchRequest &,
- vespalib::ThreadBundle &) const override {
- SearchReply::UP retval(new SearchReply);
+ SearchReply::UP match(const SearchRequest &, vespalib::ThreadBundle &) const override
+ {
+ auto retval = std::make_unique<SearchReply>();
for (size_t i = 0; i < _numHits; ++i) {
- retval->hits.push_back(SearchReply::Hit());
+ retval->hits.emplace_back();
}
return retval;
}
@@ -43,7 +42,7 @@ private:
public:
LocalSearchClient();
- ~LocalSearchClient();
+ ~LocalSearchClient() override;
void searchDone(SearchReply::UP reply) override {
std::lock_guard<std::mutex> guard(_lock);
_reply = std::move(reply);
@@ -62,8 +61,8 @@ public:
}
};
-LocalSearchClient::LocalSearchClient() {}
-LocalSearchClient::~LocalSearchClient() {}
+LocalSearchClient::LocalSearchClient() = default;
+LocalSearchClient::~LocalSearchClient() = default;
TEST("requireThatSearchesExecute")
{
@@ -71,23 +70,23 @@ TEST("requireThatSearchesExecute")
MatchEngine engine(numMatcherThreads, 1, 7);
engine.setNodeUp(true);
- MySearchHandler::SP handler(new MySearchHandler);
+ auto handler = std::make_shared<MySearchHandler>();
DocTypeName dtnvfoo("foo");
engine.putSearchHandler(dtnvfoo, handler);
LocalSearchClient client;
SearchRequest::Source request(new SearchRequest());
SearchReply::UP reply = engine.search(std::move(request), client);
- EXPECT_TRUE(reply.get() == NULL);
+ EXPECT_FALSE(reply);
reply = client.getReply(10000);
- EXPECT_TRUE(reply.get() != NULL);
+ EXPECT_TRUE(reply);
}
bool
assertSearchReply(MatchEngine & engine, const std::string & searchDocType, size_t expHits)
{
- SearchRequest *request = new SearchRequest();
+ auto *request = new SearchRequest();
request->propertiesMap.lookupCreate(search::MapNames::MATCH).add("documentdb.searchdoctype", searchDocType);
LocalSearchClient client;
engine.search(SearchRequest::Source(request), client);
@@ -99,9 +98,9 @@ TEST("requireThatCorrectHandlerIsUsed")
{
MatchEngine engine(1, 1, 7);
engine.setNodeUp(true);
- ISearchHandler::SP h1(new MySearchHandler(2));
- ISearchHandler::SP h2(new MySearchHandler(4));
- ISearchHandler::SP h3(new MySearchHandler(6));
+ auto h1 = std::make_shared<MySearchHandler>(2);
+ auto h2 = std::make_shared<MySearchHandler>(4);
+ auto h3 = std::make_shared<MySearchHandler>(6);
DocTypeName dtnvfoo("foo");
DocTypeName dtnvbar("bar");
DocTypeName dtnvbaz("baz");
@@ -120,13 +119,12 @@ struct ObserveBundleMatchHandler : MySearchHandler {
mutable size_t bundleSize;
ObserveBundleMatchHandler() : bundleSize(0) {}
- virtual search::engine::SearchReply::UP match(
- const ISearchHandler::SP &,
+ search::engine::SearchReply::UP match(
const search::engine::SearchRequest &,
vespalib::ThreadBundle &threadBundle) const override
{
bundleSize = threadBundle.size();
- return SearchReply::UP(new SearchReply);
+ return std::make_unique<SearchReply>();
}
};
@@ -135,7 +133,7 @@ TEST("requireThatBundlesAreUsed")
MatchEngine engine(15, 5, 7);
engine.setNodeUp(true);
- ObserveBundleMatchHandler::SP handler(new ObserveBundleMatchHandler());
+ auto handler = std::make_shared<ObserveBundleMatchHandler>();
DocTypeName dtnvfoo("foo");
engine.putSearchHandler(dtnvfoo, handler);
@@ -151,20 +149,20 @@ TEST("requireThatHandlersCanBeRemoved")
{
MatchEngine engine(1, 1, 7);
engine.setNodeUp(true);
- ISearchHandler::SP h(new MySearchHandler(1));
+ auto h = std::make_shared<MySearchHandler>(1);
DocTypeName docType("foo");
engine.putSearchHandler(docType, h);
ISearchHandler::SP r = engine.getSearchHandler(docType);
- EXPECT_TRUE(r.get() != NULL);
+ EXPECT_TRUE(r);
EXPECT_TRUE(h.get() == r.get());
r = engine.removeSearchHandler(docType);
- EXPECT_TRUE(r.get() != NULL);
+ EXPECT_TRUE(r);
EXPECT_TRUE(h.get() == r.get());
r = engine.getSearchHandler(docType);
- EXPECT_TRUE(r.get() == NULL);
+ EXPECT_FALSE(r);
}
TEST("requireThatEmptySearchReplyIsReturnedWhenEngineIsClosed")
@@ -175,7 +173,7 @@ TEST("requireThatEmptySearchReplyIsReturnedWhenEngineIsClosed")
LocalSearchClient client;
SearchRequest::Source request(new SearchRequest());
SearchReply::UP reply = engine.search(std::move(request), client);
- EXPECT_TRUE(reply.get() != NULL);
+ EXPECT_TRUE(reply );
EXPECT_EQUAL(0u, reply->hits.size());
EXPECT_EQUAL(7u, reply->getDistributionKey());
}
diff --git a/searchcore/src/tests/proton/matching/matching_test.cpp b/searchcore/src/tests/proton/matching/matching_test.cpp
index 95ab43dbcba..00a319db394 100644
--- a/searchcore/src/tests/proton/matching/matching_test.cpp
+++ b/searchcore/src/tests/proton/matching/matching_test.cpp
@@ -289,7 +289,7 @@ struct MyWorld {
DocsumReply::UP getDocsums(const DocsumRequest &) override {
return DocsumReply::UP();
}
- SearchReply::UP match(const ISearchHandler::SP &, const SearchRequest &, vespalib::ThreadBundle &) const override {
+ SearchReply::UP match(const SearchRequest &, vespalib::ThreadBundle &) const override {
return SearchReply::UP();
}
};
diff --git a/searchcore/src/tests/proton/summaryengine/summaryengine.cpp b/searchcore/src/tests/proton/summaryengine/summaryengine.cpp
index a9cae7d8ab7..7cdd8d767c6 100644
--- a/searchcore/src/tests/proton/summaryengine/summaryengine.cpp
+++ b/searchcore/src/tests/proton/summaryengine/summaryengine.cpp
@@ -42,7 +42,7 @@ public:
: _name(name), _reply(reply)
{}
- virtual DocsumReply::UP getDocsums(const DocsumRequest &request) override {
+ DocsumReply::UP getDocsums(const DocsumRequest &request) override {
return (request.useRootSlime())
? std::make_unique<DocsumReply>(createSlimeReply(request.hits.size()))
: createOldDocSum(request);
@@ -62,7 +62,7 @@ public:
}
DocsumReply::UP createOldDocSum(const DocsumRequest &request) {
- DocsumReply::UP retval(new DocsumReply());
+ auto retval = std::make_unique<DocsumReply>();
for (size_t i = 0; i < request.hits.size(); i++) {
const DocsumRequest::Hit &h = request.hits[i];
DocsumReply::Docsum docsum;
@@ -74,11 +74,8 @@ public:
return retval;
}
- virtual search::engine::SearchReply::UP match(
- const ISearchHandler::SP &,
- const search::engine::SearchRequest &,
- vespalib::ThreadBundle &) const override {
- return SearchReply::UP(new SearchReply);
+ SearchReply::UP match(const SearchRequest &, vespalib::ThreadBundle &) const override {
+ return std::make_unique<SearchReply>();
}
};
@@ -90,8 +87,7 @@ private:
public:
MyDocsumClient();
-
- ~MyDocsumClient();
+ ~MyDocsumClient() override;
void getDocsumsDone(DocsumReply::UP reply) override {
std::lock_guard<std::mutex> guard(_lock);
@@ -111,19 +107,19 @@ public:
}
};
-MyDocsumClient::MyDocsumClient() {}
+MyDocsumClient::MyDocsumClient() = default;
-MyDocsumClient::~MyDocsumClient() {}
+MyDocsumClient::~MyDocsumClient() = default;
DocsumRequest::UP
createRequest(size_t num = 1) {
- DocsumRequest::UP r(new DocsumRequest());
+ auto r = std::make_unique<DocsumRequest>();
if (num == 1) {
r->hits.emplace_back(GlobalId("aaaaaaaaaaaa"));
} else {
for (size_t i = 0; i < num; i++) {
vespalib::string s = vespalib::make_string("aaaaaaaaaaa%c", char('a' + i % 26));
- r->hits.push_back(GlobalId(s.c_str()));
+ r->hits.emplace_back(GlobalId(s.c_str()));
}
}
return r;
@@ -132,7 +128,7 @@ createRequest(size_t num = 1) {
TEST("requireThatGetDocsumsExecute") {
int numSummaryThreads = 2;
SummaryEngine engine(numSummaryThreads);
- ISearchHandler::SP handler(new MySearchHandler);
+ auto handler = std::make_shared<MySearchHandler>();
DocTypeName dtnvfoo("foo");
engine.putSearchHandler(dtnvfoo, handler);
@@ -140,9 +136,9 @@ TEST("requireThatGetDocsumsExecute") {
{ // async call when engine running
DocsumRequest::Source request(createRequest());
DocsumReply::UP reply = engine.getDocsums(std::move(request), client);
- EXPECT_TRUE(reply.get() == NULL);
+ EXPECT_FALSE(reply);
reply = client.getReply(10000);
- EXPECT_TRUE(reply.get() != NULL);
+ EXPECT_TRUE(reply);
EXPECT_EQUAL(1u, reply->docsums.size());
EXPECT_EQUAL(10u, reply->docsums[0].docid);
EXPECT_EQUAL(GlobalId("aaaaaaaaaaaa"), reply->docsums[0].gid);
@@ -152,7 +148,7 @@ TEST("requireThatGetDocsumsExecute") {
{ // sync call when engine closed
DocsumRequest::Source request(createRequest());
DocsumReply::UP reply = engine.getDocsums(std::move(request), client);
- EXPECT_TRUE(reply.get() != NULL);
+ EXPECT_TRUE(reply);
}
}
@@ -161,23 +157,23 @@ TEST("requireThatHandlersAreStored") {
DocTypeName dtnvbar("bar");
int numSummaryThreads = 2;
SummaryEngine engine(numSummaryThreads);
- ISearchHandler::SP h1(new MySearchHandler("foo"));
- ISearchHandler::SP h2(new MySearchHandler("bar"));
- ISearchHandler::SP h3(new MySearchHandler("baz"));
+ auto h1 = std::make_shared<MySearchHandler>("foo");
+ auto h2 = std::make_shared<MySearchHandler>("bar");
+ auto h3 = std::make_shared<MySearchHandler>("baz");
// not found
- EXPECT_TRUE(engine.getSearchHandler(dtnvfoo).get() == NULL);
- EXPECT_TRUE(engine.removeSearchHandler(dtnvfoo).get() == NULL);
+ EXPECT_FALSE(engine.getSearchHandler(dtnvfoo));
+ EXPECT_FALSE(engine.removeSearchHandler(dtnvfoo));
// put & get
- EXPECT_TRUE(engine.putSearchHandler(dtnvfoo, h1).get() == NULL);
+ EXPECT_FALSE(engine.putSearchHandler(dtnvfoo, h1));
EXPECT_EQUAL(engine.getSearchHandler(dtnvfoo).get(), h1.get());
- EXPECT_TRUE(engine.putSearchHandler(dtnvbar, h2).get() == NULL);
+ EXPECT_FALSE(engine.putSearchHandler(dtnvbar, h2));
EXPECT_EQUAL(engine.getSearchHandler(dtnvbar).get(), h2.get());
// replace
EXPECT_TRUE(engine.putSearchHandler(dtnvfoo, h3).get() == h1.get());
EXPECT_EQUAL(engine.getSearchHandler(dtnvfoo).get(), h3.get());
// remove
EXPECT_EQUAL(engine.removeSearchHandler(dtnvfoo).get(), h3.get());
- EXPECT_TRUE(engine.getSearchHandler(dtnvfoo).get() == NULL);
+ EXPECT_FALSE(engine.getSearchHandler(dtnvfoo));
}
bool
@@ -196,9 +192,9 @@ TEST("requireThatCorrectHandlerIsUsed") {
DocTypeName dtnvbar("bar");
DocTypeName dtnvbaz("baz");
SummaryEngine engine(1);
- ISearchHandler::SP h1(new MySearchHandler("foo", "foo reply"));
- ISearchHandler::SP h2(new MySearchHandler("bar", "bar reply"));
- ISearchHandler::SP h3(new MySearchHandler("baz", "baz reply"));
+ auto h1 = std::make_shared<MySearchHandler>("foo", "foo reply");
+ auto h2 = std::make_shared<MySearchHandler>("bar", "bar reply");
+ auto h3 = std::make_shared<MySearchHandler>("baz", "baz reply");
engine.putSearchHandler(dtnvfoo, h1);
engine.putSearchHandler(dtnvbar, h2);
engine.putSearchHandler(dtnvbaz, h3);
@@ -369,7 +365,7 @@ public:
Server::Server()
: BaseServer(),
engine(2),
- handler(new MySearchHandler("slime", stringref(buf.GetDrainPos(), buf.GetUsedLen()))),
+ handler(std::make_shared<MySearchHandler>("slime", stringref(buf.GetDrainPos(), buf.GetUsedLen()))),
docsumBySlime(engine),
docsumByRPC(docsumBySlime)
{
@@ -377,7 +373,7 @@ Server::Server()
engine.putSearchHandler(dtnvfoo, handler);
}
-Server::~Server() {}
+Server::~Server() = default;
vespalib::string
getAnswer(size_t num) {
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp
index 74e3e903540..f1035776a8f 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp
+++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp
@@ -361,7 +361,7 @@ public:
_immediateCommit(immediateCommit),
_onWriteDone(onWriteDone)
{}
- ~BatchRemoveTask() override {}
+ ~BatchRemoveTask() override = default;
void run() override {
for (auto field : _writeCtx.getFields()) {
auto &attr = field.getAttribute();
@@ -469,9 +469,9 @@ AttributeWriter::internalRemove(SerialNum serialNum, DocumentIdT lid, bool immed
}
}
-AttributeWriter::AttributeWriter(const proton::IAttributeManager::SP &mgr)
- : _mgr(mgr),
- _attributeFieldWriter(mgr->getAttributeFieldWriter()),
+AttributeWriter::AttributeWriter(proton::IAttributeManager::SP mgr)
+ : _mgr(std::move(mgr)),
+ _attributeFieldWriter(_mgr->getAttributeFieldWriter()),
_writeContexts(),
_dataType(nullptr),
_hasStructFieldAttribute(false),
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.h b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.h
index 9e5d8f4ce5d..8c9b756cd89 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.h
+++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.h
@@ -74,7 +74,7 @@ private:
bool immediateCommit, OnWriteDoneType onWriteDone);
public:
- AttributeWriter(const proton::IAttributeManager::SP &mgr);
+ AttributeWriter(proton::IAttributeManager::SP mgr);
~AttributeWriter();
/* Only for in tests that add attributes after AttributeWriter construction. */
diff --git a/searchcore/src/vespa/searchcore/proton/common/doctypename.cpp b/searchcore/src/vespa/searchcore/proton/common/doctypename.cpp
index 70daeeebeca..21b27ef6ffd 100644
--- a/searchcore/src/vespa/searchcore/proton/common/doctypename.cpp
+++ b/searchcore/src/vespa/searchcore/proton/common/doctypename.cpp
@@ -4,20 +4,16 @@
#include <vespa/searchlib/engine/request.h>
#include <vespa/document/datatype/documenttype.h>
-namespace proton
-{
+namespace proton {
DocTypeName::DocTypeName(const search::engine::Request &request)
: _name(request.propertiesMap.matchProperties().lookup("documentdb", "searchdoctype").get(""))
-{
-}
+{}
DocTypeName::DocTypeName(const document::DocumentType &docType)
: _name(docType.getName())
-{
-}
+{}
-
-} // namespace proton
+}
diff --git a/searchcore/src/vespa/searchcore/proton/common/handlermap.hpp b/searchcore/src/vespa/searchcore/proton/common/handlermap.hpp
index 3fb32a9d1e0..e762ac527f0 100644
--- a/searchcore/src/vespa/searchcore/proton/common/handlermap.hpp
+++ b/searchcore/src/vespa/searchcore/proton/common/handlermap.hpp
@@ -53,7 +53,6 @@ public:
bool valid() const override { return (_offset < _handlers.size()); }
T *get() const override { return _handlers[_offset].get(); }
- HandlerSP getSP() const { return _handlers[_offset]; }
void next() override { ++_offset; }
};
diff --git a/searchcore/src/vespa/searchcore/proton/matchengine/imatchhandler.h b/searchcore/src/vespa/searchcore/proton/matchengine/imatchhandler.h
deleted file mode 100644
index 63283de0a4a..00000000000
--- a/searchcore/src/vespa/searchcore/proton/matchengine/imatchhandler.h
+++ /dev/null
@@ -1,46 +0,0 @@
-// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#pragma once
-
-#include <vespa/searchcore/proton/summaryengine/isearchhandler.h>
-#include <vespa/vespalib/util/thread_bundle.h>
-
-namespace searche {
-namespace engine {
- class SearchRequest;
- class SearchReply;
-}
-}
-
-namespace proton {
-
-/**
- * This interface describes a sync match operation handler. It is implemented by
- * the DocumentDB class, and used by the MatchEngine class to delegate
- * operations to the appropriate db.
- */
-class IMatchHandler {
-protected:
- using SearchReply = search::engine::SearchReply;
- using SearchRequest = search::engine::SearchRequest;
- using ThreadBundle = vespalib::ThreadBundle;
- IMatchHandler() = default;
-public:
- IMatchHandler(const IMatchHandler &) = delete;
- IMatchHandler & operator = (const IMatchHandler &) = delete;
- /**
- * Convenience typedefs.
- */
- typedef std::unique_ptr<IMatchHandler> UP;
- typedef std::shared_ptr<IMatchHandler> SP;
-
- virtual ~IMatchHandler() { }
-
- /**
- * @return Use the request and produce the matching result.
- */
- virtual std::unique_ptr<SearchReply>
- match(const ISearchHandler::SP &searchHandler, const SearchRequest &req, ThreadBundle &threadBundle) const = 0;
-};
-
-} // namespace proton
-
diff --git a/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp b/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp
index b170f60d71f..ad47fb98232 100644
--- a/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp
+++ b/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.cpp
@@ -121,12 +121,12 @@ MatchEngine::performSearch(search::engine::SearchRequest::Source req,
ISearchHandler::SP searchHandler;
vespalib::SimpleThreadBundle::UP threadBundle = _threadBundlePool.obtain();
{ // try to find the match handler corresponding to the specified search doc type
- std::lock_guard<std::mutex> guard(_lock);
DocTypeName docTypeName(*searchRequest);
+ std::lock_guard<std::mutex> guard(_lock);
searchHandler = _handlers.getHandler(docTypeName);
}
if (searchHandler) {
- ret = searchHandler->match(searchHandler, *searchRequest, *threadBundle);
+ ret = searchHandler->match(*searchRequest, *threadBundle);
} else {
HandlerMap<ISearchHandler>::Snapshot snapshot;
{
@@ -134,8 +134,7 @@ MatchEngine::performSearch(search::engine::SearchRequest::Source req,
snapshot = _handlers.snapshot();
}
if (snapshot.valid()) {
- ISearchHandler::SP handler = snapshot.getSP();
- ret = handler->match(handler, *searchRequest, *threadBundle); // use the first handler
+ ret = snapshot.get()->match(*searchRequest, *threadBundle); // use the first handler
}
}
_threadBundlePool.release(std::move(threadBundle));
diff --git a/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.h b/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.h
index 896ac83403a..34aacdafcad 100644
--- a/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.h
+++ b/searchcore/src/vespa/searchcore/proton/matchengine/matchengine.h
@@ -1,7 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
-#include "imatchhandler.h"
+#include <vespa/searchcore/proton/summaryengine/isearchhandler.h>
#include <vespa/searchcore/proton/common/doctypename.h>
#include <vespa/searchcore/proton/common/handlermap.hpp>
#include <vespa/searchcore/proton/common/statusreport.h>
@@ -50,7 +50,7 @@ public:
* Frees any allocated resources. this will also stop all internal threads
* and wait for them to finish. All pending search requests are deleted.
*/
- ~MatchEngine();
+ ~MatchEngine() override;
/**
* Observe and reset internal executor stats
@@ -123,13 +123,11 @@ public:
StatusReport::UP reportStatus() const;
- // Implements SearchServer.
search::engine::SearchReply::UP search(
search::engine::SearchRequest::Source request,
search::engine::SearchClient &client) override;
- // Implements vespalib::StateExplorer
- virtual void get_state(const vespalib::slime::Inserter &inserter, bool full) const override;
+ void get_state(const vespalib::slime::Inserter &inserter, bool full) const override;
};
} // namespace proton
diff --git a/searchcore/src/vespa/searchcore/proton/matching/search_session.h b/searchcore/src/vespa/searchcore/proton/matching/search_session.h
index 0aec02e9d31..13d24624597 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/search_session.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/search_session.h
@@ -26,7 +26,7 @@ public:
OwnershipBundle(OwnershipBundle &&) = default;
OwnershipBundle & operator = (OwnershipBundle &&) = default;
~OwnershipBundle();
- ISearchHandler::SP search_handler;
+ std::shared_ptr<const ISearchHandler> search_handler;
std::unique_ptr<search::fef::Properties> feature_overrides;
std::unique_ptr<MatchContext> context;
IDocumentMetaStoreContext::IReadGuard::UP readGuard;
diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp
index 1b182c3e618..302ffc93f6a 100644
--- a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp
@@ -756,11 +756,11 @@ DocumentDB::getNewestFlushedSerial()
}
std::unique_ptr<SearchReply>
-DocumentDB::match(const ISearchHandler::SP &, const SearchRequest &req, vespalib::ThreadBundle &threadBundle) const
+DocumentDB::match(const SearchRequest &req, vespalib::ThreadBundle &threadBundle) const
{
// Ignore input searchhandler. Use readysubdb's searchhandler instead.
ISearchHandler::SP view(_subDBs.getReadySubDB()->getSearchView());
- return view->match(view, req, threadBundle);
+ return view->match(req, threadBundle);
}
std::unique_ptr<DocsumReply>
diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.h b/searchcore/src/vespa/searchcore/proton/server/documentdb.h
index 02ad144af68..f296e264903 100644
--- a/searchcore/src/vespa/searchcore/proton/server/documentdb.h
+++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.h
@@ -368,8 +368,7 @@ public:
virtual SerialNum getNewestFlushedSerial();
std::unique_ptr<search::engine::SearchReply>
- match(const ISearchHandler::SP &searchHandler,
- const search::engine::SearchRequest &req,
+ match(const search::engine::SearchRequest &req,
vespalib::ThreadBundle &threadBundle) const;
std::unique_ptr<search::engine::DocsumReply>
diff --git a/searchcore/src/vespa/searchcore/proton/server/emptysearchview.cpp b/searchcore/src/vespa/searchcore/proton/server/emptysearchview.cpp
index 90cf0011685..9f2ec26ad4b 100644
--- a/searchcore/src/vespa/searchcore/proton/server/emptysearchview.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/emptysearchview.cpp
@@ -14,10 +14,7 @@ using search::engine::SearchRequest;
namespace proton {
-EmptySearchView::EmptySearchView()
- : ISearchHandler()
-{
-}
+EmptySearchView::EmptySearchView() = default;
DocsumReply::UP
@@ -25,20 +22,16 @@ EmptySearchView::getDocsums(const DocsumRequest &req)
{
LOG(debug, "getDocsums(): resultClass(%s), numHits(%zu)",
req.resultClassName.c_str(), req.hits.size());
- DocsumReply::UP reply(new DocsumReply());
- for (size_t i = 0; i < req.hits.size(); ++i) {
- reply->docsums.push_back(DocsumReply::Docsum());
- reply->docsums.back().gid = req.hits[i].gid;
+ auto reply = std::make_unique<DocsumReply>();
+ for (const auto & hit : req.hits) {
+ reply->docsums.emplace_back(hit.gid);
}
return reply;
}
SearchReply::UP
-EmptySearchView::match(const ISearchHandler::SP &,
- const SearchRequest &,
- vespalib::ThreadBundle &) const {
- SearchReply::UP reply(new SearchReply);
- return reply;
+EmptySearchView::match(const SearchRequest &, vespalib::ThreadBundle &) const {
+ return std::make_unique<SearchReply>();
}
diff --git a/searchcore/src/vespa/searchcore/proton/server/emptysearchview.h b/searchcore/src/vespa/searchcore/proton/server/emptysearchview.h
index a3e2a2b176c..92fb97f6177 100644
--- a/searchcore/src/vespa/searchcore/proton/server/emptysearchview.h
+++ b/searchcore/src/vespa/searchcore/proton/server/emptysearchview.h
@@ -13,15 +13,10 @@ public:
EmptySearchView();
- /**
- * Implements ISearchHandler
- */
- virtual std::unique_ptr<DocsumReply> getDocsums(const DocsumRequest & req) override;
-
- virtual std::unique_ptr<SearchReply>
- match(const ISearchHandler::SP &searchHandler,
- const SearchRequest &req,
- vespalib::ThreadBundle &threadBundle) const override;
+ std::unique_ptr<DocsumReply> getDocsums(const DocsumRequest & req) override;
+
+ std::unique_ptr<SearchReply>
+ match(const SearchRequest &req, vespalib::ThreadBundle &threadBundle) const override;
};
} // namespace proton
diff --git a/searchcore/src/vespa/searchcore/proton/server/matchview.cpp b/searchcore/src/vespa/searchcore/proton/server/matchview.cpp
index 6f32f886637..7ba9b971715 100644
--- a/searchcore/src/vespa/searchcore/proton/server/matchview.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/matchview.cpp
@@ -31,17 +31,17 @@ using matching::ISearchContext;
using matching::Matcher;
using matching::SessionManager;
-MatchView::MatchView(const Matchers::SP &matchers,
- const IndexSearchable::SP &indexSearchable,
- const IAttributeManager::SP &attrMgr,
- const SessionManagerSP &sessionMgr,
- const IDocumentMetaStoreContext::SP &metaStore,
+MatchView::MatchView(Matchers::SP matchers,
+ IndexSearchable::SP indexSearchable,
+ IAttributeManager::SP attrMgr,
+ SessionManagerSP sessionMgr,
+ IDocumentMetaStoreContext::SP metaStore,
DocIdLimit &docIdLimit)
- : _matchers(matchers),
- _indexSearchable(indexSearchable),
- _attrMgr(attrMgr),
- _sessionMgr(sessionMgr),
- _metaStore(metaStore),
+ : _matchers(std::move(matchers)),
+ _indexSearchable(std::move(indexSearchable)),
+ _attrMgr(std::move(attrMgr)),
+ _sessionMgr(std::move(sessionMgr)),
+ _metaStore(std::move(metaStore)),
_docIdLimit(docIdLimit)
{ }
@@ -68,12 +68,12 @@ MatchView::createContext() const {
std::unique_ptr<SearchReply>
-MatchView::match(const ISearchHandler::SP &searchHandler, const SearchRequest &req,
+MatchView::match(std::shared_ptr<const ISearchHandler> searchHandler, const SearchRequest &req,
vespalib::ThreadBundle &threadBundle) const
{
Matcher::SP matcher = getMatcher(req.ranking);
SearchSession::OwnershipBundle owned_objects;
- owned_objects.search_handler = searchHandler;
+ owned_objects.search_handler = std::move(searchHandler);
owned_objects.context = createContext();
owned_objects.readGuard = _metaStore->getReadGuard();;
MatchContext *ctx = owned_objects.context.get();
diff --git a/searchcore/src/vespa/searchcore/proton/server/matchview.h b/searchcore/src/vespa/searchcore/proton/server/matchview.h
index 983e06d3414..721cb439508 100644
--- a/searchcore/src/vespa/searchcore/proton/server/matchview.h
+++ b/searchcore/src/vespa/searchcore/proton/server/matchview.h
@@ -36,11 +36,11 @@ public:
MatchView(const MatchView &) = delete;
MatchView & operator = (const MatchView &) = delete;
- MatchView(const Matchers::SP &matchers,
- const searchcorespi::IndexSearchable::SP &indexSearchable,
- const IAttributeManager::SP &attrMgr,
- const SessionManagerSP &sessionMgr,
- const IDocumentMetaStoreContext::SP &metaStore,
+ MatchView(Matchers::SP matchers,
+ searchcorespi::IndexSearchable::SP indexSearchable,
+ IAttributeManager::SP attrMgr,
+ SessionManagerSP sessionMgr,
+ IDocumentMetaStoreContext::SP metaStore,
DocIdLimit &docIdLimit);
~MatchView();
@@ -62,7 +62,7 @@ public:
matching::MatchContext::UP createContext() const;
std::unique_ptr<search::engine::SearchReply>
- match(const std::shared_ptr<ISearchHandler> &searchHandler,
+ match(std::shared_ptr<const ISearchHandler> searchHandler,
const search::engine::SearchRequest &req,
vespalib::ThreadBundle &threadBundle) const;
};
diff --git a/searchcore/src/vespa/searchcore/proton/server/proton.cpp b/searchcore/src/vespa/searchcore/proton/server/proton.cpp
index 28de4dff917..20de5bb07c1 100644
--- a/searchcore/src/vespa/searchcore/proton/server/proton.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/proton.cpp
@@ -628,8 +628,7 @@ Proton::removeDocumentDB(const DocTypeName &docTypeName)
{
// Not allowed to get to service layer to call pause().
std::unique_lock<std::shared_timed_mutex> persistenceWguard(_persistenceEngine->getWLock());
- IPersistenceHandler::SP oldHandler;
- oldHandler = _persistenceEngine->removeHandler(persistenceWguard, old->getBucketSpace(), docTypeName);
+ IPersistenceHandler::SP oldHandler = _persistenceEngine->removeHandler(persistenceWguard, old->getBucketSpace(), docTypeName);
if (_initComplete && oldHandler) {
// TODO: Fix race with bucket db modifying ops.
_persistenceEngine->grabExtraModifiedBuckets(old->getBucketSpace(), *oldHandler);
diff --git a/searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.cpp b/searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.cpp
index 069d3727850..9ef038b7325 100644
--- a/searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.cpp
@@ -84,17 +84,17 @@ reconfigureMatchView(const Matchers::SP &matchers,
}
void
-SearchableDocSubDBConfigurer::reconfigureSearchView(const MatchView::SP &matchView)
+SearchableDocSubDBConfigurer::reconfigureSearchView(MatchView::SP matchView)
{
SearchView::SP curr = _searchView.get();
- _searchView.set(SearchView::SP(new SearchView(curr->getSummarySetup(), matchView)));
+ _searchView.set(SearchView::create(curr->getSummarySetup(), std::move(matchView)));
}
void
-SearchableDocSubDBConfigurer::reconfigureSearchView(const ISummaryManager::ISummarySetup::SP &summarySetup,
- const MatchView::SP &matchView)
+SearchableDocSubDBConfigurer::reconfigureSearchView(ISummaryManager::ISummarySetup::SP summarySetup,
+ MatchView::SP matchView)
{
- _searchView.set(SearchView::SP(new SearchView(summarySetup, matchView)));
+ _searchView.set(SearchView::create(std::move(summarySetup), std::move(matchView)));
}
SearchableDocSubDBConfigurer::
diff --git a/searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.h b/searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.h
index 5aac069853b..459c4651e67 100644
--- a/searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.h
+++ b/searchcore/src/vespa/searchcore/proton/server/searchable_doc_subdb_configurer.h
@@ -65,11 +65,10 @@ private:
const IAttributeManager::SP &attrMgr);
void
- reconfigureSearchView(const MatchView::SP &matchView);
+ reconfigureSearchView(MatchView::SP matchView);
void
- reconfigureSearchView(const ISummaryManager::ISummarySetup::SP &summarySetup,
- const MatchView::SP &matchView);
+ reconfigureSearchView(ISummaryManager::ISummarySetup::SP summarySetup, MatchView::SP matchView);
public:
SearchableDocSubDBConfigurer(const SearchableDocSubDBConfigurer &) = delete;
diff --git a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp
index 77852dcc918..3ca8a4cff49 100644
--- a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp
@@ -203,16 +203,16 @@ SearchableDocSubDB::initViews(const DocumentDBConfig &configSnapshot, const Sess
const IIndexManager::SP &indexMgr = getIndexManager();
_constantValueRepo.reconfigure(configSnapshot.getRankingConstants());
Matchers::SP matchers(_configurer.createMatchers(schema, configSnapshot.getRankProfilesConfig()).release());
- auto matchView = std::make_shared<MatchView>(matchers, indexMgr->getSearchable(), attrMgr,
+ auto matchView = std::make_shared<MatchView>(std::move(matchers), indexMgr->getSearchable(), attrMgr,
sessionManager, _metaStoreCtx, _docIdLimit);
- _rSearchView.set(std::make_shared<SearchView>(
+ _rSearchView.set(SearchView::create(
getSummaryManager()->createSummarySetup(
configSnapshot.getSummaryConfig(),
configSnapshot.getSummarymapConfig(),
configSnapshot.getJuniperrcConfig(),
configSnapshot.getDocumentTypeRepoSP(),
- matchView->getAttributeManager()),
- matchView));
+ attrMgr),
+ std::move(matchView)));
auto attrWriter = std::make_shared<AttributeWriter>(attrMgr);
{
diff --git a/searchcore/src/vespa/searchcore/proton/server/searchhandlerproxy.cpp b/searchcore/src/vespa/searchcore/proton/server/searchhandlerproxy.cpp
index f611b4e1f4c..6da6c09cdba 100644
--- a/searchcore/src/vespa/searchcore/proton/server/searchhandlerproxy.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/searchhandlerproxy.cpp
@@ -7,8 +7,8 @@
namespace proton {
-SearchHandlerProxy::SearchHandlerProxy(const DocumentDB::SP &documentDB)
- : _documentDB(documentDB)
+SearchHandlerProxy::SearchHandlerProxy(DocumentDB::SP documentDB)
+ : _documentDB(std::move(documentDB))
{
_documentDB->retain();
}
@@ -25,11 +25,9 @@ SearchHandlerProxy::getDocsums(const DocsumRequest & request)
}
std::unique_ptr<search::engine::SearchReply>
-SearchHandlerProxy::match(const ISearchHandler::SP &searchHandler,
- const SearchRequest &req,
- vespalib::ThreadBundle &threadBundle) const
+SearchHandlerProxy::match(const SearchRequest &req, vespalib::ThreadBundle &threadBundle) const
{
- return _documentDB->match(searchHandler, req, threadBundle);
+ return _documentDB->match(req, threadBundle);
}
} // namespace proton
diff --git a/searchcore/src/vespa/searchcore/proton/server/searchhandlerproxy.h b/searchcore/src/vespa/searchcore/proton/server/searchhandlerproxy.h
index 4e9f5bdab8a..fc4f517fb36 100644
--- a/searchcore/src/vespa/searchcore/proton/server/searchhandlerproxy.h
+++ b/searchcore/src/vespa/searchcore/proton/server/searchhandlerproxy.h
@@ -13,11 +13,11 @@ class SearchHandlerProxy : public ISearchHandler
private:
std::shared_ptr<DocumentDB> _documentDB;
public:
- SearchHandlerProxy(const std::shared_ptr<DocumentDB> &documentDB);
+ SearchHandlerProxy(std::shared_ptr<DocumentDB> documentDB);
- virtual~SearchHandlerProxy();
+ ~SearchHandlerProxy() override;
std::unique_ptr<DocsumReply> getDocsums(const DocsumRequest & request) override;
- std::unique_ptr<SearchReply> match(const ISearchHandler::SP &searchHandler, const SearchRequest &req, ThreadBundle &threadBundle) const override;
+ std::unique_ptr<SearchReply> match(const SearchRequest &req, ThreadBundle &threadBundle) const override;
};
} // namespace proton
diff --git a/searchcore/src/vespa/searchcore/proton/server/searchview.cpp b/searchcore/src/vespa/searchcore/proton/server/searchview.cpp
index 9830048cdd8..36d873d9948 100644
--- a/searchcore/src/vespa/searchcore/proton/server/searchview.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/searchview.cpp
@@ -105,11 +105,14 @@ createEmptyReply(const DocsumRequest & request)
}
-SearchView::SearchView(const ISummaryManager::ISummarySetup::SP & summarySetup,
- const MatchView::SP & matchView)
+std::shared_ptr<SearchView>
+SearchView::create(ISummaryManager::ISummarySetup::SP summarySetup, MatchView::SP matchView) {
+ return std::shared_ptr<SearchView>( new SearchView(std::move(summarySetup), std::move(matchView)));
+}
+SearchView::SearchView(ISummaryManager::ISummarySetup::SP summarySetup, MatchView::SP matchView)
: ISearchHandler(),
- _summarySetup(summarySetup),
- _matchView(matchView)
+ _summarySetup(std::move(summarySetup)),
+ _matchView(std::move(matchView))
{ }
SearchView::~SearchView() = default;
@@ -161,8 +164,8 @@ SearchView::getDocsumsInternal(const DocsumRequest & req)
}
std::unique_ptr<SearchReply>
-SearchView::match(const ISearchHandler::SP &self, const SearchRequest &req, ThreadBundle &threadBundle) const {
- return _matchView->match(self, req, threadBundle);
+SearchView::match(const SearchRequest &req, ThreadBundle &threadBundle) const {
+ return _matchView->match(shared_from_this(), req, threadBundle);
}
} // namespace proton
diff --git a/searchcore/src/vespa/searchcore/proton/server/searchview.h b/searchcore/src/vespa/searchcore/proton/server/searchview.h
index 28c7ffd2b36..630d29c32fd 100644
--- a/searchcore/src/vespa/searchcore/proton/server/searchview.h
+++ b/searchcore/src/vespa/searchcore/proton/server/searchview.h
@@ -8,7 +8,7 @@
namespace proton {
-class SearchView : public ISearchHandler
+class SearchView : public ISearchHandler, public std::enable_shared_from_this<SearchView>
{
public:
using SessionManagerSP = std::shared_ptr<matching::SessionManager>;
@@ -16,12 +16,12 @@ public:
using InternalDocsumReply = std::pair<std::unique_ptr<DocsumReply>, bool>;
typedef std::shared_ptr<SearchView> SP;
- SearchView(const ISummaryManager::ISummarySetup::SP &summarySetup, const MatchView::SP &matchView);
+ static std::shared_ptr<SearchView> create(ISummaryManager::ISummarySetup::SP summarySetup, MatchView::SP matchView);
SearchView(const SearchView &) = delete;
SearchView(SearchView &&) = delete;
SearchView &operator=(const SearchView &) = delete;
SearchView &operator=(SearchView &&) = delete;
- ~SearchView();
+ ~SearchView() override;
const ISummaryManager::ISummarySetup::SP & getSummarySetup() const { return _summarySetup; }
const MatchView::SP & getMatchView() const { return _matchView; }
@@ -34,8 +34,9 @@ public:
matching::MatchingStats getMatcherStats(const vespalib::string &rankProfile) const { return _matchView->getMatcherStats(rankProfile); }
std::unique_ptr<DocsumReply> getDocsums(const DocsumRequest & req) override;
- std::unique_ptr<SearchReply> match(const ISearchHandler::SP &self, const SearchRequest &req, vespalib::ThreadBundle &threadBundle) const override;
+ std::unique_ptr<SearchReply> match(const SearchRequest &req, vespalib::ThreadBundle &threadBundle) const override;
private:
+ SearchView(ISummaryManager::ISummarySetup::SP summarySetup, MatchView::SP matchView);
InternalDocsumReply getDocsumsInternal(const DocsumRequest & req);
ISummaryManager::ISummarySetup::SP _summarySetup;
MatchView::SP _matchView;
diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h
index 9d5b8c18d01..14f62513c34 100644
--- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h
+++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h
@@ -13,7 +13,6 @@
#include <vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h>
#include <vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.h>
#include <vespa/searchcore/proton/documentmetastore/ilidreusedelayer.h>
-#include <vespa/searchcore/proton/matchengine/imatchhandler.h>
#include <vespa/searchcore/proton/summaryengine/isearchhandler.h>
#include <vespa/searchcore/proton/common/commit_time_tracker.h>
#include <vespa/searchcore/proton/persistenceengine/i_document_retriever.h>
diff --git a/searchcore/src/vespa/searchcore/proton/summaryengine/isearchhandler.h b/searchcore/src/vespa/searchcore/proton/summaryengine/isearchhandler.h
index ffcdfbaf365..b7dd438ae29 100644
--- a/searchcore/src/vespa/searchcore/proton/summaryengine/isearchhandler.h
+++ b/searchcore/src/vespa/searchcore/proton/summaryengine/isearchhandler.h
@@ -26,12 +26,11 @@ protected:
using DocsumRequest = search::engine::DocsumRequest;
using ThreadBundle = vespalib::ThreadBundle;
public:
- typedef std::unique_ptr<ISearchHandler> UP;
typedef std::shared_ptr<ISearchHandler> SP;
ISearchHandler(const ISearchHandler &) = delete;
ISearchHandler & operator = (const ISearchHandler &) = delete;
- virtual ~ISearchHandler() { }
+ virtual ~ISearchHandler() = default;
/**
* @return Use the request and produce the document summary result.
@@ -39,7 +38,7 @@ public:
virtual std::unique_ptr<DocsumReply> getDocsums(const DocsumRequest & request) = 0;
virtual std::unique_ptr<SearchReply>
- match(const ISearchHandler::SP &self, const SearchRequest &req, ThreadBundle &threadBundle) const = 0;
+ match(const SearchRequest &req, ThreadBundle &threadBundle) const = 0;
};
} // namespace proton
diff --git a/searchcore/src/vespa/searchcore/proton/summaryengine/summaryengine.cpp b/searchcore/src/vespa/searchcore/proton/summaryengine/summaryengine.cpp
index 692b05899f4..1189e8a550c 100644
--- a/searchcore/src/vespa/searchcore/proton/summaryengine/summaryengine.cpp
+++ b/searchcore/src/vespa/searchcore/proton/summaryengine/summaryengine.cpp
@@ -107,13 +107,13 @@ SummaryEngine::getDocsums(DocsumRequest::Source request, DocsumClient & client)
{
if (_closed) {
LOG(warning, "Receiving docsumrequest after engine has been shutdown");
- DocsumReply::UP ret(new DocsumReply());
+ auto ret = std::make_unique<DocsumReply>();
// TODO: Notify closed.
return ret;
}
- vespalib::Executor::Task::UP task(new DocsumTask(*this, std::move(request), client));
+ auto task =std::make_unique<DocsumTask>(*this, std::move(request), client);
_executor.execute(std::move(task));
return DocsumReply::UP();
}