summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorGeir Storli <geirst@yahoo-inc.com>2017-02-23 13:11:00 +0000
committerGeir Storli <geirst@yahoo-inc.com>2017-02-23 13:11:00 +0000
commiteb7d20ee992075f675827049fb56d6f3c743d3a0 (patch)
tree971aa69c626ebd0bc7a5180c989e4add06928d6f /searchcore
parentc12d2c78f24f03b97c3b0b8c401356af1fd3c89c (diff)
Extend applyConfig() function with a document db reference resolver.
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp17
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/documentdb.cpp25
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp5
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h4
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.h3
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h30
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h23
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp7
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h3
-rw-r--r--searchcore/src/vespa/searchcore/proton/test/dummy_document_sub_db.h4
12 files changed, 81 insertions, 48 deletions
diff --git a/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp b/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp
index 62ba6ca7027..58872174813 100644
--- a/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp
@@ -1,20 +1,23 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+#include <vespa/searchcore/proton/attribute/imported_attributes_repo.h>
#include <vespa/searchcore/proton/bucketdb/bucketdbhandler.h>
+#include <vespa/searchcore/proton/common/hw_info.h>
#include <vespa/searchcore/proton/initializer/task_runner.h>
#include <vespa/searchcore/proton/metrics/attribute_metrics.h>
#include <vespa/searchcore/proton/metrics/attribute_metrics_collection.h>
#include <vespa/searchcore/proton/metrics/legacy_attribute_metrics.h>
#include <vespa/searchcore/proton/metrics/legacy_documentdb_metrics.h>
#include <vespa/searchcore/proton/metrics/metricswireservice.h>
+#include <vespa/searchcore/proton/reference/i_document_db_reference_resolver.h>
#include <vespa/searchcore/proton/reprocessing/i_reprocessing_task.h>
#include <vespa/searchcore/proton/reprocessing/reprocessingrunner.h>
+#include <vespa/searchcore/proton/server/bootstrapconfig.h>
#include <vespa/searchcore/proton/server/document_subdb_explorer.h>
#include <vespa/searchcore/proton/server/emptysearchview.h>
#include <vespa/searchcore/proton/server/fast_access_document_retriever.h>
#include <vespa/searchcore/proton/server/minimal_document_retriever.h>
#include <vespa/searchcore/proton/server/searchabledocsubdb.h>
-#include <vespa/searchcore/proton/server/bootstrapconfig.h>
#include <vespa/searchcore/proton/test/test.h>
#include <vespa/searchcore/proton/test/thread_utils.h>
#include <vespa/searchcorespi/plugin/iindexmanagerfactory.h>
@@ -22,7 +25,6 @@
#include <vespa/vespalib/io/fileutil.h>
#include <vespa/vespalib/test/insertion_operators.h>
#include <vespa/vespalib/testkit/test_kit.h>
-#include <vespa/searchcore/proton/common/hw_info.h>
#include <iostream>
@@ -104,6 +106,13 @@ struct MyMetricsWireService : public DummyWireService
}
};
+struct MyDocumentDBReferenceResolver : public IDocumentDBReferenceResolver {
+ std::unique_ptr<ImportedAttributesRepo> resolve(const search::IAttributeManager &) override {
+ return std::make_unique<ImportedAttributesRepo>();
+ }
+
+};
+
struct MyStoreOnlyConfig
{
StoreOnlyConfig _cfg;
@@ -346,11 +355,13 @@ struct FixtureBase
cmpResult.attributesChanged = true;
cmpResult._documenttypesChanged = true;
cmpResult._documentTypeRepoChanged = true;
+ MyDocumentDBReferenceResolver resolver;
IReprocessingTask::List tasks =
_subDb.applyConfig(*newCfg->_cfg,
*_snapshot->_cfg,
serialNum,
- ReconfigParams(cmpResult));
+ ReconfigParams(cmpResult),
+ resolver);
_snapshot = std::move(newCfg);
if (!tasks.empty()) {
ReprocessingRunner runner;
diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp
index 24930a72c40..b9eecd798c0 100644
--- a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp
@@ -1,27 +1,28 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#include "documentdb.h"
#include "combiningfeedview.h"
+#include "commit_and_wait_document_retriever.h"
#include "document_meta_store_read_guards.h"
#include "document_subdb_collection_explorer.h"
+#include "documentdb.h"
+#include "documentdbconfigscout.h"
#include "idocumentdbowner.h"
#include "lid_space_compaction_handler.h"
#include "maintenance_jobs_injector.h"
-#include "commit_and_wait_document_retriever.h"
-#include "documentdbconfigscout.h"
#include "reconfig_params.h"
+#include <vespa/searchcommon/common/schemaconfigurer.h>
#include <vespa/searchcore/proton/attribute/attribute_writer.h>
+#include <vespa/searchcore/proton/attribute/imported_attributes_repo.h>
#include <vespa/searchcore/proton/common/eventlogger.h>
#include <vespa/searchcore/proton/common/schemautil.h>
#include <vespa/searchcore/proton/index/index_writer.h>
#include <vespa/searchcore/proton/initializer/task_runner.h>
+#include <vespa/searchcore/proton/reference/i_document_db_reference_resolver.h>
+#include <vespa/searchcore/proton/reference/i_document_db_referent_registry.h>
#include <vespa/searchlib/attribute/attributefactory.h>
#include <vespa/searchlib/attribute/configconverter.h>
-#include <vespa/searchcommon/common/schemaconfigurer.h>
-#include <vespa/searchlib/engine/searchreply.h>
#include <vespa/searchlib/engine/docsumreply.h>
-#include <vespa/searchcore/proton/reference/i_document_db_referent_registry.h>
-
+#include <vespa/searchlib/engine/searchreply.h>
#include <vespa/vespalib/io/fileutil.h>
#include <vespa/vespalib/util/closuretask.h>
#include <vespa/vespalib/util/exceptions.h>
@@ -383,6 +384,13 @@ DocumentDB::handleRejectedConfig(DocumentDBConfig::SP &configSnapshot,
}
}
+namespace {
+struct EmptyDocumentDBReferenceResolver : public IDocumentDBReferenceResolver {
+ std::unique_ptr<ImportedAttributesRepo> resolve(const search::IAttributeManager &) override {
+ return std::make_unique<ImportedAttributesRepo>();
+ }
+};
+}
void
DocumentDB::applyConfig(DocumentDBConfig::SP configSnapshot,
@@ -465,7 +473,8 @@ DocumentDB::applyConfig(DocumentDBConfig::SP configSnapshot,
_writeService.setTaskLimit(_defaultExecutorTaskLimit);
}
if (params.shouldSubDbsChange() || hasVisibilityDelayChanged) {
- _subDBs.applyConfig(*configSnapshot, *_activeConfigSnapshot, serialNum, params);
+ EmptyDocumentDBReferenceResolver resolver;
+ _subDBs.applyConfig(*configSnapshot, *_activeConfigSnapshot, serialNum, params, resolver);
if (serialNum < _feedHandler.getSerialNum()) {
// Not last entry in tls. Reprocessing should already be done.
_subDBs.getReprocessingRunner().reset();
diff --git a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp
index 846adb1889e..63d6e2347d4 100644
--- a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.cpp
@@ -262,13 +262,14 @@ void
DocumentSubDBCollection::applyConfig(const DocumentDBConfig &newConfigSnapshot,
const DocumentDBConfig &oldConfigSnapshot,
SerialNum serialNum,
- const ReconfigParams & params)
+ const ReconfigParams &params,
+ IDocumentDBReferenceResolver &resolver)
{
_reprocessingRunner.reset();
for (auto subDb : _subDBs) {
IReprocessingTask::List tasks;
tasks = subDb->applyConfig(newConfigSnapshot, oldConfigSnapshot,
- serialNum, params);
+ serialNum, params, resolver);
_reprocessingRunner.addTasks(tasks);
}
}
diff --git a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h
index 05554e6ec27..0ad7c42634e 100644
--- a/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h
+++ b/searchcore/src/vespa/searchcore/proton/server/documentsubdbcollection.h
@@ -22,6 +22,7 @@ class DocumentDBMetricsCollection;
class MaintenanceController;
class MetricsWireService;
class ICommitable;
+class IDocumentDBReferenceResolver;
class IGetSerialNum;
class DocumentSubDBCollection {
@@ -117,7 +118,8 @@ public:
applyConfig(const DocumentDBConfig &newConfigSnapshot,
const DocumentDBConfig &oldConfigSnapshot,
SerialNum serialNum,
- const ReconfigParams & params);
+ const ReconfigParams &params,
+ IDocumentDBReferenceResolver &resolver);
IFeedView::SP getFeedView();
IFlushTarget::List getFlushTargets();
diff --git a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp
index 5b68ed0c3f2..57547e44918 100644
--- a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.cpp
@@ -248,8 +248,10 @@ IReprocessingTask::List
FastAccessDocSubDB::applyConfig(const DocumentDBConfig &newConfigSnapshot,
const DocumentDBConfig &oldConfigSnapshot,
SerialNum serialNum,
- const ReconfigParams & params)
+ const ReconfigParams &params,
+ IDocumentDBReferenceResolver &resolver)
{
+ (void) resolver;
IReprocessingTask::List tasks;
updateLidReuseDelayer(&newConfigSnapshot);
/*
diff --git a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.h b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.h
index 8ef49ba80f7..d0ceb5a93f3 100644
--- a/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.h
+++ b/searchcore/src/vespa/searchcore/proton/server/fast_access_doc_subdb.h
@@ -116,7 +116,8 @@ public:
IReprocessingTask::List applyConfig(const DocumentDBConfig &newConfigSnapshot,
const DocumentDBConfig &oldConfigSnapshot,
SerialNum serialNum,
- const ReconfigParams & params) override;
+ const ReconfigParams &params,
+ IDocumentDBReferenceResolver &resolver) override;
proton::IAttributeManager::SP getAttributeManager() const override;
IDocumentRetriever::UP getDocumentRetriever() override;
diff --git a/searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h b/searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h
index ec6bc471065..fade5fbb5b4 100644
--- a/searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h
+++ b/searchcore/src/vespa/searchcore/proton/server/idocumentsubdb.h
@@ -24,23 +24,24 @@ namespace searchcorespi {
namespace proton {
namespace matching { class SessionManager; }
-class FeedHandler;
class DocumentDBConfig;
-class FileConfigManager;
-class IReplayConfig;
-class IIndexWriter;
-class IDcoumentRetriever;
class DocumentSubDbInitializer;
class DocumentSubDbInitializerResult;
-class ReconfigParams;
+class FeedHandler;
+class FileConfigManager;
+class IAttributeManager;
+class IDcoumentRetriever;
+class IDocumentDBReferenceResolver;
+class IDocumentDBReferent;
+class IDocumentMetaStoreContext;
+class IDocumentRetriever;
class IFeedView;
+class IIndexWriter;
+class IReplayConfig;
class ISearchHandler;
-class ISummaryManager;
class ISummaryAdapter;
-class IDocumentMetaStoreContext;
-class IDocumentRetriever;
-class IAttributeManager;
-class IDocumentDBReferent;
+class ISummaryManager;
+class ReconfigParams;
/**
* Interface for a document sub database that handles a subset of the documents that belong to a
@@ -85,8 +86,11 @@ public:
virtual void initViews(const DocumentDBConfig &configSnapshot, const std::shared_ptr<matching::SessionManager> &sessionManager) = 0;
virtual IReprocessingTask::List
- applyConfig(const DocumentDBConfig &newConfigSnapshot, const DocumentDBConfig &oldConfigSnapshot,
- SerialNum serialNum, const ReconfigParams & params) = 0;
+ applyConfig(const DocumentDBConfig &newConfigSnapshot,
+ const DocumentDBConfig &oldConfigSnapshot,
+ SerialNum serialNum,
+ const ReconfigParams &params,
+ IDocumentDBReferenceResolver &resolver) = 0;
virtual std::shared_ptr<ISearchHandler> getSearchView() const = 0;
virtual std::shared_ptr<IFeedView> getFeedView() const = 0;
diff --git a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp
index c720b94c9e0..e77094b8b62 100644
--- a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp
@@ -168,8 +168,10 @@ IReprocessingTask::List
SearchableDocSubDB::applyConfig(const DocumentDBConfig &newConfigSnapshot,
const DocumentDBConfig &oldConfigSnapshot,
SerialNum serialNum,
- const ReconfigParams & params)
+ const ReconfigParams &params,
+ IDocumentDBReferenceResolver &resolver)
{
+ (void) resolver;
IReprocessingTask::List tasks;
updateLidReuseDelayer(&newConfigSnapshot);
if (params.shouldMatchersChange() && _addMetrics) {
diff --git a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h
index f4286a4c54c..02b6108480e 100644
--- a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h
+++ b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.h
@@ -1,35 +1,35 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
-#include "searchable_doc_subdb_configurer.h"
#include "executorthreadingservice.h"
#include "fast_access_doc_subdb.h"
#include "feedhandler.h"
+#include "searchable_doc_subdb_configurer.h"
#include "searchable_feed_view.h"
#include "searchview.h"
#include "summaryadapter.h"
-#include <memory>
-#include <vector>
+#include <vespa/eval/eval/value_cache/constant_tensor_loader.h>
+#include <vespa/eval/eval/value_cache/constant_value_cache.h>
+#include <vespa/searchcore/config/config-proton.h>
#include <vespa/searchcore/proton/attribute/attributemanager.h>
#include <vespa/searchcore/proton/common/doctypename.h>
#include <vespa/searchcore/proton/docsummary/summarymanager.h>
#include <vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h>
-#include <vespa/searchcorespi/index/iindexmanager.h>
#include <vespa/searchcore/proton/index/i_index_writer.h>
#include <vespa/searchcore/proton/index/indexmanager.h>
#include <vespa/searchcore/proton/matching/constant_value_repo.h>
-#include <vespa/searchcore/config/config-proton.h>
-#include <vespa/eval/eval/value_cache/constant_tensor_loader.h>
-#include <vespa/eval/eval/value_cache/constant_value_cache.h>
+#include <vespa/searchcorespi/index/iindexmanager.h>
#include <vespa/vespalib/util/blockingthreadstackexecutor.h>
#include <vespa/vespalib/util/varholder.h>
-
+#include <memory>
+#include <vector>
namespace proton {
-class MetricsWireService;
-class DocumentDBMetrics;
class DocumentDBConfig;
+class DocumentDBMetrics;
+class IDocumentDBReferenceResolver;
+class MetricsWireService;
/**
* The searchable sub database supports searching and keeps all attribute fields in memory and
@@ -130,7 +130,8 @@ public:
applyConfig(const DocumentDBConfig &newConfigSnapshot,
const DocumentDBConfig &oldConfigSnapshot,
SerialNum serialNum,
- const ReconfigParams & params) override;
+ const ReconfigParams &params,
+ IDocumentDBReferenceResolver &resolver) override;
void clearViews() override
{
diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp
index f6d52ca9ce7..37d3283f22e 100644
--- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp
@@ -381,17 +381,18 @@ StoreOnlyDocSubDB::updateLidReuseDelayer(const LidReuseDelayerConfig &config)
_commitTimeTracker.setVisibilityDelay(config.visibilityDelay());
}
-
IReprocessingTask::List
StoreOnlyDocSubDB::applyConfig(const DocumentDBConfig &newConfigSnapshot,
const DocumentDBConfig &oldConfigSnapshot,
SerialNum serialNum,
- const ReconfigParams & params)
+ const ReconfigParams &params,
+ IDocumentDBReferenceResolver &resolver)
{
(void) oldConfigSnapshot;
- assert(_writeService.master().isCurrentThread());
(void) serialNum;
(void) params;
+ (void) resolver;
+ assert(_writeService.master().isCurrentThread());
initFeedView(newConfigSnapshot);
updateLidReuseDelayer(&newConfigSnapshot);
_owner.syncFeedView();
diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h
index 3845f255aaa..b00137b3ad6 100644
--- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h
+++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h
@@ -247,7 +247,8 @@ public:
applyConfig(const DocumentDBConfig &newConfigSnapshot,
const DocumentDBConfig &oldConfigSnapshot,
SerialNum serialNum,
- const ReconfigParams & params) override;
+ const ReconfigParams &params,
+ IDocumentDBReferenceResolver &resolver) override;
ISearchHandler::SP getSearchView() const override { return _iSearchView.get(); }
IFeedView::SP getFeedView() const override { return _iFeedView.get(); }
diff --git a/searchcore/src/vespa/searchcore/proton/test/dummy_document_sub_db.h b/searchcore/src/vespa/searchcore/proton/test/dummy_document_sub_db.h
index 099d65b9166..8a9803515db 100644
--- a/searchcore/src/vespa/searchcore/proton/test/dummy_document_sub_db.h
+++ b/searchcore/src/vespa/searchcore/proton/test/dummy_document_sub_db.h
@@ -15,8 +15,6 @@
#include <vespa/searchcore/proton/persistenceengine/i_document_retriever.h>
#include <vespa/searchcore/proton/server/reconfig_params.h>
-
-
namespace proton {
namespace test {
@@ -61,7 +59,7 @@ struct DummyDocumentSubDb : public IDocumentSubDB
void initViews(const DocumentDBConfig &,
const proton::matching::SessionManager::SP &) override {}
IReprocessingTask::List applyConfig(const DocumentDBConfig &, const DocumentDBConfig &,
- SerialNum, const ReconfigParams &) override
+ SerialNum, const ReconfigParams &, IDocumentDBReferenceResolver &) override
{
return IReprocessingTask::List();
}