aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/tests
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2017-10-03 22:31:03 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2017-10-05 23:07:08 +0200
commitdff6169faab318931c8c3ca4d0dc7df4ea763594 (patch)
tree094ff5bd2fdcab25999a863987131a8bf7a8c84c /searchcore/src/tests
parent6fe9751702a2ccbe431944d36dc6fae339e093ab (diff)
Wire in for live reconfiguration of DocumentStore.
Diffstat (limited to 'searchcore/src/tests')
-rw-r--r--searchcore/src/tests/proton/docsummary/docsummary.cpp12
-rw-r--r--searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp23
-rw-r--r--searchcore/src/tests/proton/documentdb/documentdb_test.cpp2
-rw-r--r--searchcore/src/tests/proton/proton_configurer/proton_configurer_test.cpp6
4 files changed, 18 insertions, 25 deletions
diff --git a/searchcore/src/tests/proton/docsummary/docsummary.cpp b/searchcore/src/tests/proton/docsummary/docsummary.cpp
index aff27959ec9..db15093e8b5 100644
--- a/searchcore/src/tests/proton/docsummary/docsummary.cpp
+++ b/searchcore/src/tests/proton/docsummary/docsummary.cpp
@@ -209,7 +209,7 @@ public:
_configMgr.nextGeneration(0);
if (! FastOS_File::MakeDirectory((std::string("tmpdb/") + docTypeName).c_str())) { abort(); }
_ddb.reset(new DocumentDB("tmpdb", _configMgr.getConfig(), "tcp/localhost:9013", _queryLimiter, _clock,
- DocTypeName(docTypeName), ProtonConfig(), *this, _summaryExecutor, _summaryExecutor,
+ DocTypeName(docTypeName), std::make_shared<ProtonConfig>(), *this, _summaryExecutor, _summaryExecutor,
_tls, _dummy, _fileHeaderContext, ConfigStore::UP(new MemoryConfigStore),
std::make_shared<vespalib::ThreadStackExecutor>(16, 128 * 1024), _hwInfo)),
_ddb->start();
@@ -233,11 +233,8 @@ public:
typedef DocumentMetaStore::Result PutRes;
IDocumentMetaStore &dms = _ddb->getReadySubDB()->getDocumentMetaStoreContext().get();
uint32_t docSize = 1;
- PutRes putRes(dms.put(docId.getGlobalId(),
- BucketFactory::getBucketId(docId),
- Timestamp(0u),
- docSize,
- lid));
+ PutRes putRes(dms.put(docId.getGlobalId(), BucketFactory::getBucketId(docId),
+ Timestamp(0u), docSize, lid));
LOG_ASSERT(putRes.ok());
uint64_t serialNum = _ddb->getFeedHandler().incSerialNum();
_aw->put(serialNum, doc, lid, true, std::shared_ptr<IDestructorCallback>());
@@ -255,8 +252,7 @@ public:
op.setDbDocumentId(dbdId);
op.setPrevDbDocumentId(prevDbdId);
_ddb->getFeedHandler().storeOperation(op);
- SearchView *sv(dynamic_cast<SearchView *>
- (_ddb->getReadySubDB()->getSearchView().get()));
+ SearchView *sv(dynamic_cast<SearchView *>(_ddb->getReadySubDB()->getSearchView().get()));
if (sv != NULL) {
// cf. FeedView::putAttributes()
DocIdLimit &docIdLimit = sv->getDocIdLimit();
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 b14eb9051d0..cd88666662e 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
@@ -262,25 +262,26 @@ struct MyConfigSnapshot
Schema _schema;
DocBuilder _builder;
DocumentDBConfig::SP _cfg;
+ BootstrapConfig::SP _bootstrap;
MyConfigSnapshot(const Schema &schema,
const vespalib::string &cfgDir)
: _schema(schema),
_builder(_schema),
- _cfg()
+ _cfg(),
+ _bootstrap()
{
DocumentDBConfig::DocumenttypesConfigSP documenttypesConfig
(new DocumenttypesConfig(_builder.getDocumenttypesConfig()));
TuneFileDocumentDB::SP tuneFileDocumentDB(new TuneFileDocumentDB());
- BootstrapConfig::SP bootstrap
- (new BootstrapConfig(1,
+ _bootstrap = std::make_shared<BootstrapConfig>(1,
documenttypesConfig,
_builder.getDocumentTypeRepo(),
std::make_shared<ProtonConfig>(),
std::make_shared<FiledistributorrpcConfig>(),
- tuneFileDocumentDB));
+ tuneFileDocumentDB);
config::DirSpec spec(cfgDir);
DocumentDBConfigHelper mgr(spec, "searchdocument");
- mgr.forwardConfig(bootstrap);
+ mgr.forwardConfig(_bootstrap);
mgr.nextGeneration(1);
_cfg = mgr.getConfig();
}
@@ -292,8 +293,8 @@ struct FixtureBase
ExecutorThreadingService _writeService;
ThreadStackExecutor _summaryExecutor;
typename Traits::Config _cfg;
- std::shared_ptr<BucketDBOwner> _bucketDB;
- BucketDBHandler _bucketDBHandler;
+ std::shared_ptr<BucketDBOwner> _bucketDB;
+ BucketDBHandler _bucketDBHandler;
typename Traits::Context _ctx;
typename Traits::Schema _baseSchema;
MyConfigSnapshot::UP _snapshot;
@@ -354,12 +355,8 @@ struct FixtureBase
cmpResult.documenttypesChanged = true;
cmpResult.documentTypeRepoChanged = true;
MyDocumentDBReferenceResolver resolver;
- IReprocessingTask::List tasks =
- _subDb.applyConfig(*newCfg->_cfg,
- *_snapshot->_cfg,
- serialNum,
- ReconfigParams(cmpResult),
- resolver);
+ auto tasks = _subDb.applyConfig(newCfg->_bootstrap->getProtonConfig(), *newCfg->_cfg, *_snapshot->_cfg,
+ serialNum, ReconfigParams(cmpResult), resolver);
_snapshot = std::move(newCfg);
if (!tasks.empty()) {
ReprocessingRunner runner;
diff --git a/searchcore/src/tests/proton/documentdb/documentdb_test.cpp b/searchcore/src/tests/proton/documentdb/documentdb_test.cpp
index 157e964ad83..e15a44ff962 100644
--- a/searchcore/src/tests/proton/documentdb/documentdb_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/documentdb_test.cpp
@@ -114,7 +114,7 @@ Fixture::Fixture()
mgr.forwardConfig(b);
mgr.nextGeneration(0);
_db.reset(new DocumentDB(".", mgr.getConfig(), "tcp/localhost:9014", _queryLimiter, _clock, DocTypeName("typea"),
- ProtonConfig(), _myDBOwner, _summaryExecutor, _summaryExecutor, _tls, _dummy,
+ b->getProtonConfigSP(), _myDBOwner, _summaryExecutor, _summaryExecutor, _tls, _dummy,
_fileHeaderContext, ConfigStore::UP(new MemoryConfigStore),
std::make_shared<vespalib::ThreadStackExecutor>(16, 128 * 1024), _hwInfo));
_db->start();
diff --git a/searchcore/src/tests/proton/proton_configurer/proton_configurer_test.cpp b/searchcore/src/tests/proton/proton_configurer/proton_configurer_test.cpp
index 757a9c19f29..ec14f7de818 100644
--- a/searchcore/src/tests/proton/proton_configurer/proton_configurer_test.cpp
+++ b/searchcore/src/tests/proton/proton_configurer/proton_configurer_test.cpp
@@ -207,9 +207,9 @@ struct MyDocumentDBConfigOwner : public IDocumentDBConfigOwner
_owner(owner)
{
}
- virtual ~MyDocumentDBConfigOwner() { }
+ ~MyDocumentDBConfigOwner() { }
- virtual void reconfigure(const DocumentDBConfig::SP & config) override;
+ void reconfigure(const std::shared_ptr<ProtonConfig> & protonConfig, const DocumentDBConfig::SP & config) override;
};
struct MyProtonConfigurerOwner : public IProtonConfigurerOwner
@@ -267,7 +267,7 @@ struct MyProtonConfigurerOwner : public IProtonConfigurerOwner
};
void
-MyDocumentDBConfigOwner::reconfigure(const DocumentDBConfig::SP & config)
+MyDocumentDBConfigOwner::reconfigure(const std::shared_ptr<ProtonConfig> &,const DocumentDBConfig::SP & config)
{
_owner.reconfigureDocumentDB(_name, config);
}