aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--searchcore/src/apps/tests/persistenceconformance_test.cpp3
-rw-r--r--searchcore/src/tests/proton/docsummary/docsummary.cpp3
-rw-r--r--searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp3
-rw-r--r--searchcore/src/tests/proton/documentdb/documentdb_test.cpp3
-rw-r--r--searchcore/src/tests/proton/documentdb/fileconfigmanager/fileconfigmanager_test.cpp3
-rw-r--r--searchcore/src/tests/proton/proton_config_fetcher/proton_config_fetcher_test.cpp11
-rw-r--r--searchcore/src/tests/proton/proton_configurer/proton_configurer_test.cpp6
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/bootstrapconfig.cpp9
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/bootstrapconfig.h11
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/bootstrapconfigmanager.cpp16
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/proton_configurer.cpp29
12 files changed, 94 insertions, 7 deletions
diff --git a/searchcore/src/apps/tests/persistenceconformance_test.cpp b/searchcore/src/apps/tests/persistenceconformance_test.cpp
index 8bb1911e595..5c59b3376ba 100644
--- a/searchcore/src/apps/tests/persistenceconformance_test.cpp
+++ b/searchcore/src/apps/tests/persistenceconformance_test.cpp
@@ -26,6 +26,7 @@
#include <vespa/searchlib/index/dummyfileheadercontext.h>
#include <vespa/searchlib/transactionlog/translogserver.h>
#include <vespa/searchsummary/config/config-juniperrc.h>
+#include <vespa/config-bucketspaces.h>
#include <vespa/vespalib/io/fileutil.h>
#include <vespa/log/log.h>
@@ -37,6 +38,7 @@ using namespace cloud::config::filedistribution;
using namespace vespa::config::search::core;
using namespace vespa::config::search::summary;
using namespace vespa::config::search;
+using vespa::config::content::core::BucketspacesConfig;
using std::shared_ptr;
using document::BucketSpace;
@@ -180,6 +182,7 @@ public:
factory.getTypeRepo(),
std::make_shared<ProtonConfig>(),
std::make_shared<FiledistributorrpcConfig>(),
+ std::make_shared<BucketspacesConfig>(),
tuneFileDocDB));
mgr.forwardConfig(b);
mgr.nextGeneration(0);
diff --git a/searchcore/src/tests/proton/docsummary/docsummary.cpp b/searchcore/src/tests/proton/docsummary/docsummary.cpp
index 6705527dfa9..dae50fcc860 100644
--- a/searchcore/src/tests/proton/docsummary/docsummary.cpp
+++ b/searchcore/src/tests/proton/docsummary/docsummary.cpp
@@ -31,6 +31,7 @@
#include <vespa/searchlib/transactionlog/translogserver.h>
#include <vespa/vespalib/data/slime/slime.h>
#include <vespa/vespalib/encoding/base64.h>
+#include <vespa/config-bucketspaces.h>
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/log/log.h>
@@ -51,6 +52,7 @@ using search::index::DummyFileHeaderContext;
using search::index::schema::CollectionType;
using storage::spi::Timestamp;
using vespa::config::search::core::ProtonConfig;
+using vespa::config::content::core::BucketspacesConfig;
using vespalib::tensor::Tensor;
using vespalib::tensor::TensorCells;
using vespalib::tensor::TensorDimensions;
@@ -205,6 +207,7 @@ public:
auto b = std::make_shared<BootstrapConfig>(1, _documenttypesConfig, _repo,
std::make_shared<ProtonConfig>(),
std::make_shared<FiledistributorrpcConfig>(),
+ std::make_shared<BucketspacesConfig>(),
_tuneFileDocumentDB);
_configMgr.forwardConfig(b);
_configMgr.nextGeneration(0);
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 1b94ba36dad..e655ae0d739 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
@@ -30,6 +30,7 @@
#include <vespa/vespalib/io/fileutil.h>
#include <vespa/vespalib/test/insertion_operators.h>
#include <vespa/vespalib/testkit/test_kit.h>
+#include <vespa/config-bucketspaces.h>
#include <iostream>
@@ -54,6 +55,7 @@ using searchcorespi::IFlushTarget;
using searchcorespi::index::IThreadingService;
using storage::spi::Timestamp;
using vespa::config::search::core::ProtonConfig;
+using vespa::config::content::core::BucketspacesConfig;
using vespalib::mkdir;
typedef StoreOnlyDocSubDB::Config StoreOnlyConfig;
@@ -281,6 +283,7 @@ struct MyConfigSnapshot
_builder.getDocumentTypeRepo(),
std::make_shared<ProtonConfig>(),
std::make_shared<FiledistributorrpcConfig>(),
+ std::make_shared<BucketspacesConfig>(),
tuneFileDocumentDB);
config::DirSpec spec(cfgDir);
DocumentDBConfigHelper mgr(spec, "searchdocument");
diff --git a/searchcore/src/tests/proton/documentdb/documentdb_test.cpp b/searchcore/src/tests/proton/documentdb/documentdb_test.cpp
index 58372c59193..f93930d189b 100644
--- a/searchcore/src/tests/proton/documentdb/documentdb_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/documentdb_test.cpp
@@ -23,6 +23,7 @@
#include <vespa/searchlib/index/dummyfileheadercontext.h>
#include <vespa/searchlib/transactionlog/translogserver.h>
#include <vespa/vespalib/data/slime/slime.h>
+#include <vespa/config-bucketspaces.h>
#include <vespa/vespalib/testkit/test_kit.h>
using namespace cloud::config::filedistribution;
@@ -40,6 +41,7 @@ using search::transactionlog::TransLogServer;
using searchcorespi::IFlushTarget;
using searchcorespi::index::IndexFlushTarget;
using vespa::config::search::core::ProtonConfig;
+using vespa::config::content::core::BucketspacesConfig;
using vespalib::Slime;
namespace {
@@ -96,6 +98,7 @@ Fixture::Fixture()
b(new BootstrapConfig(1, documenttypesConfig, repo,
std::make_shared<ProtonConfig>(),
std::make_shared<FiledistributorrpcConfig>(),
+ std::make_shared<BucketspacesConfig>(),
tuneFileDocumentDB));
mgr.forwardConfig(b);
mgr.nextGeneration(0);
diff --git a/searchcore/src/tests/proton/documentdb/fileconfigmanager/fileconfigmanager_test.cpp b/searchcore/src/tests/proton/documentdb/fileconfigmanager/fileconfigmanager_test.cpp
index 9bb9766024a..a781085769c 100644
--- a/searchcore/src/tests/proton/documentdb/fileconfigmanager/fileconfigmanager_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/fileconfigmanager/fileconfigmanager_test.cpp
@@ -13,6 +13,7 @@
#include <vespa/searchcore/proton/test/documentdb_config_builder.h>
#include <vespa/searchsummary/config/config-juniperrc.h>
#include <vespa/vespalib/io/fileutil.h>
+#include <vespa/config-bucketspaces.h>
#include <vespa/vespalib/testkit/test_kit.h>
using namespace cloud::config::filedistribution;
@@ -23,6 +24,7 @@ using namespace search::index;
using namespace search;
using namespace vespa::config::search::core;
using namespace vespa::config::search;
+using vespa::config::content::core::BucketspacesConfig;
using proton::matching::RankingConstants;
typedef DocumentDBConfigHelper DBCM;
@@ -44,6 +46,7 @@ makeBaseConfigSnapshot()
DocumentTypeRepo::SP(new DocumentTypeRepo(*dtcfg)),
std::make_shared<ProtonConfig>(),
std::make_shared<FiledistributorrpcConfig>(),
+ std::make_shared<BucketspacesConfig>(),
std::make_shared<TuneFileDocumentDB>()));
dbcm.forwardConfig(b);
dbcm.nextGeneration(0);
diff --git a/searchcore/src/tests/proton/proton_config_fetcher/proton_config_fetcher_test.cpp b/searchcore/src/tests/proton/proton_config_fetcher/proton_config_fetcher_test.cpp
index b9059338f27..37e4dfc486d 100644
--- a/searchcore/src/tests/proton/proton_config_fetcher/proton_config_fetcher_test.cpp
+++ b/searchcore/src/tests/proton/proton_config_fetcher/proton_config_fetcher_test.cpp
@@ -18,6 +18,7 @@
#include <vespa/searchcore/config/config-ranking-constants.h>
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/vespalib/util/varholder.h>
+#include <vespa/config-bucketspaces.h>
#include <mutex>
using namespace config;
@@ -26,6 +27,8 @@ using namespace vespa::config::search::core;
using namespace vespa::config::search::summary;
using namespace vespa::config::search;
using namespace cloud::config::filedistribution;
+using vespa::config::content::core::BucketspacesConfig;
+using vespa::config::content::core::BucketspacesConfigBuilder;
using config::ConfigUri;
using document::DocumentTypeRepo;
@@ -52,6 +55,7 @@ struct ConfigTestFixture {
ProtonConfigBuilder protonBuilder;
DocumenttypesConfigBuilder documenttypesBuilder;
FiledistributorrpcConfigBuilder filedistBuilder;
+ BucketspacesConfigBuilder bucketspacesBuilder;
map<std::string, DoctypeFixture::UP> dbConfig;
ConfigSet set;
IConfigContext::SP context;
@@ -62,6 +66,7 @@ struct ConfigTestFixture {
protonBuilder(),
documenttypesBuilder(),
filedistBuilder(),
+ bucketspacesBuilder(),
dbConfig(),
set(),
context(new ConfigContext(set)),
@@ -70,6 +75,7 @@ struct ConfigTestFixture {
set.addBuilder(configId, &protonBuilder);
set.addBuilder(configId, &documenttypesBuilder);
set.addBuilder(configId, &filedistBuilder);
+ set.addBuilder(configId, &bucketspacesBuilder);
addDocType("_alwaysthere_");
}
@@ -146,6 +152,7 @@ struct ConfigTestFixture {
DocumentTypeRepo::SP(new DocumentTypeRepo(documenttypesBuilder)),
BootstrapConfig::ProtonConfigSP(new ProtonConfig(protonBuilder)),
std::make_shared<FiledistributorrpcConfig>(),
+ std::make_shared<BucketspacesConfig>(bucketspacesBuilder),
std::make_shared<TuneFileDocumentDB>()));
}
@@ -197,11 +204,13 @@ struct ProtonConfigOwner : public proton::IProtonConfigurer
TEST_F("require that bootstrap config manager creats correct key set", BootstrapConfigManager("foo")) {
const ConfigKeySet set(f1.createConfigKeySet());
- ASSERT_EQUAL(3u, set.size());
+ ASSERT_EQUAL(4u, set.size());
ConfigKey protonKey(ConfigKey::create<ProtonConfig>("foo"));
ConfigKey dtKey(ConfigKey::create<DocumenttypesConfig>("foo"));
+ ConfigKey bsKey(ConfigKey::create<BucketspacesConfig>("foo"));
ASSERT_TRUE(set.find(protonKey) != set.end());
ASSERT_TRUE(set.find(dtKey) != set.end());
+ ASSERT_TRUE(set.find(bsKey) != set.end());
}
TEST_FFF("require that bootstrap config manager updates config", ConfigTestFixture("search"),
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 a99eaa0daf6..f2e1b9d7805 100644
--- a/searchcore/src/tests/proton/proton_configurer/proton_configurer_test.cpp
+++ b/searchcore/src/tests/proton/proton_configurer/proton_configurer_test.cpp
@@ -21,6 +21,7 @@
#include <vespa/searchcommon/common/schemaconfigurer.h>
#include <vespa/vespalib/util/threadstackexecutor.h>
#include <vespa/vespalib/test/insertion_operators.h>
+#include <vespa/config-bucketspaces.h>
using namespace config;
using namespace proton;
@@ -28,6 +29,8 @@ using namespace vespa::config::search::core;
using namespace vespa::config::search::summary;
using namespace vespa::config::search;
using namespace cloud::config::filedistribution;
+using vespa::config::content::core::BucketspacesConfig;
+using vespa::config::content::core::BucketspacesConfigBuilder;
using InitializeThreads = std::shared_ptr<vespalib::ThreadStackExecutorBase>;
using config::ConfigUri;
@@ -98,6 +101,7 @@ struct ConfigFixture {
ProtonConfigBuilder _protonBuilder;
DocumenttypesConfigBuilder _documenttypesBuilder;
FiledistributorrpcConfigBuilder _filedistBuilder;
+ BucketspacesConfigBuilder _bucketspacesBuilder;
map<std::string, DBConfigFixture::UP> _dbConfig;
int _idcounter;
int64_t _generation;
@@ -108,6 +112,7 @@ struct ConfigFixture {
_protonBuilder(),
_documenttypesBuilder(),
_filedistBuilder(),
+ _bucketspacesBuilder(),
_dbConfig(),
_idcounter(-1),
_generation(1),
@@ -166,6 +171,7 @@ struct ConfigFixture {
DocumentTypeRepo::SP(new DocumentTypeRepo(_documenttypesBuilder)),
BootstrapConfig::ProtonConfigSP(new ProtonConfig(_protonBuilder)),
std::make_shared<FiledistributorrpcConfig>(),
+ std::make_shared<BucketspacesConfig>(_bucketspacesBuilder),
std::make_shared<TuneFileDocumentDB>()));
}
diff --git a/searchcore/src/vespa/searchcore/proton/server/bootstrapconfig.cpp b/searchcore/src/vespa/searchcore/proton/server/bootstrapconfig.cpp
index f35258a5a89..5eb1200dc74 100644
--- a/searchcore/src/vespa/searchcore/proton/server/bootstrapconfig.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/bootstrapconfig.cpp
@@ -1,6 +1,7 @@
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "bootstrapconfig.h"
+#include <vespa/config-bucketspaces.h>
using namespace vespa::config::search;
using namespace config;
@@ -27,11 +28,13 @@ BootstrapConfig::BootstrapConfig(
const DocumentTypeRepo::SP &repo,
const ProtonConfigSP &protonConfig,
const FiledistributorrpcConfigSP &filedistRpcConfSP,
+ const BucketspacesConfigSP &bucketspaces,
const search::TuneFileDocumentDB::SP &tuneFileDocumentDB)
: _documenttypes(documenttypes),
_repo(repo),
_proton(protonConfig),
_fileDistributorRpc(filedistRpcConfSP),
+ _bucketspaces(bucketspaces),
_tuneFileDocumentDB(tuneFileDocumentDB),
_generation(generation)
{ }
@@ -45,6 +48,8 @@ BootstrapConfig::operator==(const BootstrapConfig &rhs) const
rhs._documenttypes.get()) &&
_repo.get() == rhs._repo.get() &&
equals<ProtonConfig>(_proton.get(), rhs._proton.get()) &&
+ equals<FiledistributorrpcConfig>(_fileDistributorRpc.get(), rhs._fileDistributorRpc.get()) &&
+ equals<BucketspacesConfig>(_bucketspaces.get(), rhs._bucketspaces.get()) &&
equals<TuneFileDocumentDB>(_tuneFileDocumentDB.get(),
rhs._tuneFileDocumentDB.get());
}
@@ -56,7 +61,9 @@ BootstrapConfig::valid() const
return _documenttypes.get() != NULL &&
_repo.get() != NULL &&
_proton.get() != NULL &&
- _tuneFileDocumentDB.get() != NULL;
+ _fileDistributorRpc.get() != NULL &&
+ _bucketspaces.get() != NULL &&
+ _tuneFileDocumentDB.get() != NULL;
}
diff --git a/searchcore/src/vespa/searchcore/proton/server/bootstrapconfig.h b/searchcore/src/vespa/searchcore/proton/server/bootstrapconfig.h
index f0252bb694f..1f888ac1739 100644
--- a/searchcore/src/vespa/searchcore/proton/server/bootstrapconfig.h
+++ b/searchcore/src/vespa/searchcore/proton/server/bootstrapconfig.h
@@ -11,6 +11,8 @@
#include <vespa/config/retriever/configsnapshot.h>
#include <vespa/fileacquirer/config-filedistributorrpc.h>
+namespace vespa::config::content::core::internal { class InternalBucketspacesType; }
+
namespace proton {
/**
@@ -21,15 +23,19 @@ class BootstrapConfig
public:
typedef std::shared_ptr<BootstrapConfig> SP;
typedef std::shared_ptr<vespa::config::search::core::ProtonConfig> ProtonConfigSP;
- typedef std::shared_ptr<cloud::config::filedistribution::FiledistributorrpcConfig> FiledistributorrpcConfigSP;
+ using FiledistributorrpcConfig = const cloud::config::filedistribution::FiledistributorrpcConfig;
+ using FiledistributorrpcConfigSP = std::shared_ptr<FiledistributorrpcConfig>;
typedef DocumentDBConfig::DocumenttypesConfigSP DocumenttypesConfigSP;
+ using BucketspacesConfig = const vespa::config::content::core::internal::InternalBucketspacesType;
+ using BucketspacesConfigSP = std::shared_ptr<BucketspacesConfig>;
private:
DocumenttypesConfigSP _documenttypes;
document::DocumentTypeRepo::SP _repo;
ProtonConfigSP _proton;
FiledistributorrpcConfigSP _fileDistributorRpc;
+ BucketspacesConfigSP _bucketspaces;
search::TuneFileDocumentDB::SP _tuneFileDocumentDB;
int64_t _generation;
@@ -39,6 +45,7 @@ public:
const document::DocumentTypeRepo::SP &repo,
const ProtonConfigSP &protonConfig,
const FiledistributorrpcConfigSP &filedistRpcConfSP,
+ const BucketspacesConfigSP &bucketspaces,
const search::TuneFileDocumentDB::SP &
_tuneFileDocumentDB);
~BootstrapConfig();
@@ -64,6 +71,8 @@ public:
const ProtonConfigSP &
getProtonConfigSP() const { return _proton; }
+ const BucketspacesConfigSP &getBucketspacesConfigSP() const { return _bucketspaces; }
+
const search::TuneFileDocumentDB::SP &
getTuneFileDocumentDBSP() const { return _tuneFileDocumentDB; }
diff --git a/searchcore/src/vespa/searchcore/proton/server/bootstrapconfigmanager.cpp b/searchcore/src/vespa/searchcore/proton/server/bootstrapconfigmanager.cpp
index cc399727460..2ce10e347ea 100644
--- a/searchcore/src/vespa/searchcore/proton/server/bootstrapconfigmanager.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/bootstrapconfigmanager.cpp
@@ -2,6 +2,7 @@
#include "bootstrapconfigmanager.h"
#include "bootstrapconfig.h"
+#include <vespa/config-bucketspaces.h>
#include <vespa/searchlib/common/tunefileinfo.hpp>
#include <vespa/log/log.h>
@@ -13,7 +14,9 @@ using document::DocumentTypeRepo;
using search::TuneFileDocumentDB;
using vespa::config::search::core::ProtonConfig;
using cloud::config::filedistribution::FiledistributorrpcConfig;
+using vespa::config::content::core::BucketspacesConfig;
using document::DocumenttypesConfig;
+using BucketspacesConfigSP = std::shared_ptr<BucketspacesConfig>;
namespace proton {
@@ -31,7 +34,8 @@ BootstrapConfigManager::createConfigKeySet() const
{
return ConfigKeySet().add<ProtonConfig>(_configId)
.add<DocumenttypesConfig>(_configId)
- .add<FiledistributorrpcConfig>(_configId);
+ .add<FiledistributorrpcConfig>(_configId)
+ .add<BucketspacesConfig>(_configId);
}
void
@@ -45,6 +49,7 @@ BootstrapConfigManager::update(const ConfigSnapshot & snapshot)
TuneFileDocumentDB::SP newTuneFileDocumentDB;
DocumenttypesConfigSP newDocumenttypesConfig;
DocumentTypeRepo::SP newRepo;
+ BucketspacesConfigSP newBucketspacesConfig;
int64_t currentGen = -1;
BootstrapConfig::SP current = _pendingConfigSnapshot;
@@ -54,6 +59,7 @@ BootstrapConfigManager::update(const ConfigSnapshot & snapshot)
newTuneFileDocumentDB = current->getTuneFileDocumentDBSP();
newDocumenttypesConfig = current->getDocumenttypesConfigSP();
newRepo = current->getDocumentTypeRepoSP();
+ newBucketspacesConfig = current->getBucketspacesConfigSP();
currentGen = current->getGeneration();
}
@@ -88,14 +94,20 @@ BootstrapConfigManager::update(const ConfigSnapshot & snapshot)
newDocumenttypesConfig = DocumenttypesConfigSP(documenttypesConfig.release());
newRepo = repo;
}
+ if (snapshot.isChanged<BucketspacesConfig>(_configId, currentGen)) {
+ LOG(spam, "Bucketspaces config is changed");
+ std::unique_ptr<BucketspacesConfig> bucketspacesConfig = snapshot.getConfig<BucketspacesConfig>(_configId);
+ newBucketspacesConfig = std::move(bucketspacesConfig);
+ }
assert(newProtonConfig.get() != nullptr);
assert(newFiledistRpcConfSP.get() != nullptr);
+ assert(newBucketspacesConfig);
assert(newTuneFileDocumentDB.get() != nullptr);
assert(newDocumenttypesConfig.get() != nullptr);
assert(newRepo.get() != nullptr);
auto newSnapshot(std::make_shared<BootstrapConfig>(snapshot.getGeneration(), newDocumenttypesConfig, newRepo,
- newProtonConfig, newFiledistRpcConfSP, newTuneFileDocumentDB));
+ newProtonConfig, newFiledistRpcConfSP, newBucketspacesConfig, newTuneFileDocumentDB));
assert(newSnapshot->valid());
{
diff --git a/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp b/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp
index 4d8bfe38271..4790f4336a3 100644
--- a/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp
@@ -5,6 +5,7 @@
#include <vespa/config/print/fileconfigwriter.h>
#include <vespa/config/print/fileconfigsnapshotreader.h>
#include <vespa/config/print/fileconfigsnapshotwriter.h>
+#include <vespa/config-bucketspaces.h>
#include <vespa/searchcommon/common/schemaconfigurer.h>
#include <vespa/vespalib/io/fileutil.h>
#include <vespa/config-summarymap.h>
@@ -32,6 +33,7 @@ using vespa::config::search::SummaryConfig;
using vespa::config::search::SummarymapConfig;
using vespa::config::search::core::ProtonConfig;
using vespa::config::search::summary::JuniperrcConfig;
+using vespa::config::content::core::BucketspacesConfig;
using vespalib::nbostream;
typedef IndexMetaInfo::SnapshotList SnapshotList;
@@ -383,6 +385,7 @@ FileConfigManager::loadConfig(const DocumentDBConfig &currentSnapshot,
}
auto filedistRpcConf = std::make_shared<FiledistributorrpcConfig>();
+ auto bucketspaces = std::make_shared<BucketspacesConfig>();
/*
* XXX: If non-default maintenance config is used then an extra config
@@ -396,6 +399,7 @@ FileConfigManager::loadConfig(const DocumentDBConfig &currentSnapshot,
repo,
_protonConfig,
filedistRpcConf,
+ bucketspaces,
currentSnapshot.getTuneFileDocumentDBSP()));
dbc.forwardConfig(bootstrap);
dbc.nextGeneration(0);
diff --git a/searchcore/src/vespa/searchcore/proton/server/proton_configurer.cpp b/searchcore/src/vespa/searchcore/proton/server/proton_configurer.cpp
index 00360a9c405..9d2db5504d9 100644
--- a/searchcore/src/vespa/searchcore/proton/server/proton_configurer.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/proton_configurer.cpp
@@ -7,6 +7,10 @@
#include "i_document_db_config_owner.h"
#include <vespa/vespalib/util/lambdatask.h>
#include <vespa/vespalib/util/threadstackexecutorbase.h>
+#include <vespa/persistence/spi/fixed_bucket_spaces.h>
+#include <vespa/config-bucketspaces.h>
+#include <vespa/vespalib/util/exceptions.h>
+#include <vespa/vespalib/stllike/asciistream.h>
#include <future>
using vespalib::makeLambdaTask;
@@ -14,6 +18,28 @@ using vespa::config::search::core::ProtonConfig;
namespace proton {
+namespace {
+
+document::BucketSpace
+getBucketSpace(const BootstrapConfig &bootstrapConfig, const DocTypeName &name)
+{
+ const auto &bucketspaces = *bootstrapConfig.getBucketspacesConfigSP();
+ if (bucketspaces.enableMultipleBucketSpaces) {
+ for (const auto &entry : bucketspaces.documenttype) {
+ if (entry.name == name.getName()) {
+ return storage::spi::FixedBucketSpaces::from_string(entry.bucketspace);
+ }
+ }
+ vespalib::asciistream ost;
+ ost << "Could not map from document type name '" << name.getName() << "' to bucket space name";
+ throw vespalib::IllegalStateException(ost.str(), VESPA_STRLOC);
+ }
+ return document::BucketSpace::placeHolder();
+}
+
+}
+
+
ProtonConfigurer::ProtonConfigurer(vespalib::ThreadStackExecutorBase &executor,
IProtonConfigurerOwner &owner)
: IProtonConfigurer(),
@@ -114,8 +140,7 @@ ProtonConfigurer::applyConfig(std::shared_ptr<ProtonConfigSnapshot> configSnapsh
_owner.applyConfig(bootstrapConfig);
for (const auto &ddbConfig : protonConfig.documentdb) {
DocTypeName docTypeName(ddbConfig.inputdoctypename);
- // TODO: set bucket space based on config when available
- document::BucketSpace bucketSpace = document::BucketSpace::placeHolder();
+ document::BucketSpace bucketSpace = getBucketSpace(*bootstrapConfig, docTypeName);
configureDocumentDB(*configSnapshot, docTypeName, bucketSpace, ddbConfig.configid, initializeThreads);
}
pruneDocumentDBs(*configSnapshot);