diff options
author | Henning Baldersheim <balder@oath.com> | 2018-01-29 19:37:39 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@oath.com> | 2018-01-29 19:37:39 +0000 |
commit | f6169d507a61fec1fea428c5e315dac4b4cf3398 (patch) | |
tree | b97f3621927eec291db140abcaa770fc0249bd4e /searchcore | |
parent | 5cb5a8aaf304d5d1dc19ad994b92b644d204bae4 (diff) |
Remove the support for extra config, that is a leftover from rise integration that is long gone.
Diffstat (limited to 'searchcore')
9 files changed, 28 insertions, 120 deletions
diff --git a/searchcore/src/tests/proton/documentdb/fileconfigmanager/fileconfigmanager_test.cpp b/searchcore/src/tests/proton/documentdb/fileconfigmanager/fileconfigmanager_test.cpp index a781085769c..6b1031fe558 100644 --- a/searchcore/src/tests/proton/documentdb/fileconfigmanager/fileconfigmanager_test.cpp +++ b/searchcore/src/tests/proton/documentdb/fileconfigmanager/fileconfigmanager_test.cpp @@ -37,9 +37,8 @@ DocumentDBConfig::SP makeBaseConfigSnapshot() { config::DirSpec spec(TEST_PATH("cfg")); - ConfigKeySet extraKeySet; - extraKeySet.add<MycfgConfig>(""); - DBCM dbcm(spec, "test", extraKeySet); + + DBCM dbcm(spec, "test"); DocumenttypesConfigSP dtcfg(config::ConfigGetter<DocumenttypesConfig>::getConfig("", spec).release()); BootstrapConfig::SP b(new BootstrapConfig(1, dtcfg, @@ -73,19 +72,6 @@ makeEmptyConfigSnapshot() void incInt(int *i, const DocumentType&) { ++*i; } void -assertEqualExtraConfigs(const DocumentDBConfig &expSnap, const DocumentDBConfig &actSnap) -{ - const ConfigSnapshot &exp = expSnap.getExtraConfigs(); - const ConfigSnapshot &act = actSnap.getExtraConfigs(); - EXPECT_EQUAL(1u, exp.size()); - EXPECT_EQUAL(1u, act.size()); - std::unique_ptr<MycfgConfig> expCfg = exp.getConfig<MycfgConfig>(""); - std::unique_ptr<MycfgConfig> actCfg = act.getConfig<MycfgConfig>(""); - EXPECT_EQUAL("foo", expCfg->myField); - EXPECT_EQUAL("foo", actCfg->myField); -} - -void assertEqualSnapshot(const DocumentDBConfig &exp, const DocumentDBConfig &act) { EXPECT_TRUE(exp.getRankProfilesConfig() == act.getRankProfilesConfig()); @@ -109,7 +95,6 @@ assertEqualSnapshot(const DocumentDBConfig &exp, const DocumentDBConfig &act) EXPECT_TRUE(*exp.getSchemaSP() == *act.getSchemaSP()); EXPECT_EQUAL(expTypeCount, actTypeCount); EXPECT_EQUAL(exp.getConfigId(), act.getConfigId()); - assertEqualExtraConfigs(exp, act); } DocumentDBConfig::SP @@ -163,13 +148,12 @@ TEST_F("requireThatConfigCanBeSerializedAndDeserialized", DocumentDBConfig::SP(m TEST_F("requireThatConfigCanBeLoadedWithoutExtraConfigsDataFile", DocumentDBConfig::SP(makeBaseConfigSnapshot())) { saveBaseConfigSnapshot(*f, 70); - EXPECT_TRUE(vespalib::unlink("out/config-70/extraconfigs.dat")); + EXPECT_FALSE(vespalib::unlink("out/config-70/extraconfigs.dat")); DocumentDBConfig::SP esnap(makeEmptyConfigSnapshot()); { FileConfigManager cm("out", myId, "dummy"); cm.loadConfig(*esnap, 70, esnap); } - EXPECT_EQUAL(0u, esnap->getExtraConfigs().size()); } @@ -187,11 +171,9 @@ TEST_F("requireThatVisibilityDelayIsPropagated", protonConfigBuilder.maxvisibilitydelay = 100.0; FileConfigManager cm("out", myId, "dummy"); using ProtonConfigSP = BootstrapConfig::ProtonConfigSP; - cm.setProtonConfig( - ProtonConfigSP(new ProtonConfig(protonConfigBuilder))); + cm.setProtonConfig(ProtonConfigSP(new ProtonConfig(protonConfigBuilder))); cm.loadConfig(*esnap, 70, esnap); } - EXPECT_EQUAL(0u, esnap->getExtraConfigs().size()); EXPECT_EQUAL(61.0, esnap->getMaintenanceConfigSP()->getVisibilityDelay().sec()); } 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 f2e1b9d7805..a8336e29f9f 100644 --- a/searchcore/src/tests/proton/proton_configurer/proton_configurer_test.cpp +++ b/searchcore/src/tests/proton/proton_configurer/proton_configurer_test.cpp @@ -91,8 +91,7 @@ struct DBConfigFixture { std::make_shared<DocumentDBMaintenanceConfig>(), search::LogDocumentStore::Config(), configId, - docTypeName, - config::ConfigSnapshot()); + docTypeName); } }; diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.cpp index b83040b04ff..db73e9f38b8 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.cpp @@ -63,8 +63,7 @@ DocumentDBConfig::DocumentDBConfig( const DocumentDBMaintenanceConfig::SP &maintenance, const search::LogDocumentStore::Config & storeConfig, const vespalib::string &configId, - const vespalib::string &docTypeName, - const config::ConfigSnapshot & extraConfigs) + const vespalib::string &docTypeName) : _configId(configId), _docTypeName(docTypeName), _generation(generation), @@ -82,7 +81,6 @@ DocumentDBConfig::DocumentDBConfig( _schema(schema), _maintenance(maintenance), _storeConfig(storeConfig), - _extraConfigs(extraConfigs), _orig(), _delayedAttributeAspects(false) { } @@ -107,7 +105,6 @@ DocumentDBConfig(const DocumentDBConfig &cfg) _schema(cfg._schema), _maintenance(cfg._maintenance), _storeConfig(cfg._storeConfig), - _extraConfigs(cfg._extraConfigs), _orig(cfg._orig), _delayedAttributeAspects(false) { } @@ -216,8 +213,7 @@ DocumentDBConfig::makeReplayConfig(const SP & orig) o._maintenance, o._storeConfig, o._configId, - o._docTypeName, - o._extraConfigs); + o._docTypeName); ret->_orig = orig; return ret; } @@ -257,8 +253,7 @@ DocumentDBConfig::newFromAttributesConfig(const AttributesConfigSP &attributes) _maintenance, _storeConfig, _configId, - _docTypeName, - _extraConfigs); + _docTypeName); } DocumentDBConfig::SP @@ -293,8 +288,7 @@ DocumentDBConfig::makeDelayedAttributeAspectConfig(const SP &newCfg, const Docum n._maintenance, n._storeConfig, n._configId, - n._docTypeName, - n._extraConfigs); + n._docTypeName); result->_delayedAttributeAspects = true; return result; } diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.h b/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.h index cfca754a3d6..df023028123 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.h @@ -118,7 +118,6 @@ private: search::index::Schema::SP _schema; MaintenanceConfigSP _maintenance; search::LogDocumentStore::Config _storeConfig; - config::ConfigSnapshot _extraConfigs; SP _orig; bool _delayedAttributeAspects; @@ -156,8 +155,7 @@ public: const DocumentDBMaintenanceConfig::SP &maintenance, const search::LogDocumentStore::Config & storeConfig, const vespalib::string &configId, - const vespalib::string &docTypeName, - const config::ConfigSnapshot &extraConfig = config::ConfigSnapshot()); + const vespalib::string &docTypeName); DocumentDBConfig(const DocumentDBConfig &cfg); ~DocumentDBConfig(); @@ -203,9 +201,6 @@ public: bool valid() const; - const config::ConfigSnapshot &getExtraConfigs() const { return _extraConfigs; } - void setExtraConfigs(const config::ConfigSnapshot &extraConfigs) { _extraConfigs = extraConfigs; } - /** * Only keep configs needed for replay of transaction log. */ diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp index ef43839f313..fe1ce77c5a9 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp @@ -32,6 +32,8 @@ using search::LogDocumentStore; using search::LogDataStore; using search::DocumentStore; using search::WriteableFileChunk; +using std::make_shared; +using std::make_unique; namespace proton { @@ -47,7 +49,6 @@ DocumentDBConfigManager::createConfigKeySet() const SummarymapConfig, JuniperrcConfig, ImportedFieldsConfig>(_configId); - set.add(_extraConfigKeys); return set; } @@ -318,7 +319,6 @@ DocumentDBConfigManager::update(const ConfigSnapshot &snapshot) if (newMaintenanceConfig && oldMaintenanceConfig && *newMaintenanceConfig == *oldMaintenanceConfig) { newMaintenanceConfig = oldMaintenanceConfig; } - ConfigSnapshot extraConfigs(snapshot.subset(_extraConfigKeys)); DocumentDBConfig::SP newSnapshot( new DocumentDBConfig(generation, newRankProfilesConfig, @@ -336,8 +336,7 @@ DocumentDBConfigManager::update(const ConfigSnapshot &snapshot) newMaintenanceConfig, storeConfig, _configId, - _docTypeName, - extraConfigs)); + _docTypeName)); assert(newSnapshot->valid()); { std::lock_guard<std::mutex> lock(_pendingConfigMutex); @@ -353,8 +352,7 @@ DocumentDBConfigManager(const vespalib::string &configId, const vespalib::string _bootstrapConfig(), _pendingConfigSnapshot(), _ignoreForwardedConfig(true), - _pendingConfigMutex(), - _extraConfigKeys() + _pendingConfigMutex() { } DocumentDBConfigManager::~DocumentDBConfigManager() { } @@ -378,26 +376,17 @@ forwardConfig(const BootstrapConfig::SP & config) } } -DocumentDBConfigHelper::DocumentDBConfigHelper(const config::DirSpec &spec, const vespalib::string &docTypeName) - : DocumentDBConfigHelper(spec, docTypeName, config::ConfigKeySet()) +DocumentDBConfigHelper::DocumentDBConfigHelper(const DirSpec &spec, const vespalib::string &docTypeName) + : _mgr("", docTypeName), + _retriever(make_unique<ConfigRetriever>(_mgr.createConfigKeySet(), make_shared<ConfigContext>(spec))) { } -DocumentDBConfigHelper::DocumentDBConfigHelper(const config::DirSpec &spec, const vespalib::string &docTypeName, - const config::ConfigKeySet &extraConfigKeys) - : _mgr("", docTypeName), - _retriever() -{ - _mgr.setExtraConfigKeys(extraConfigKeys); - _retriever.reset(new config::ConfigRetriever(_mgr.createConfigKeySet(), - config::IConfigContext::SP(new config::ConfigContext(spec)))); -} - -DocumentDBConfigHelper::~DocumentDBConfigHelper() { } +DocumentDBConfigHelper::~DocumentDBConfigHelper() = default; bool DocumentDBConfigHelper::nextGeneration(int timeoutInMillis) { - config::ConfigSnapshot snapshot(_retriever->getBootstrapConfigs(timeoutInMillis)); + ConfigSnapshot snapshot(_retriever->getBootstrapConfigs(timeoutInMillis)); if (snapshot.empty()) return false; _mgr.update(snapshot); diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.h b/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.h index ebab75da1b0..80654c7588b 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.h @@ -26,7 +26,6 @@ private: DocumentDBConfig::SP _pendingConfigSnapshot; bool _ignoreForwardedConfig; mutable std::mutex _pendingConfigMutex; - config::ConfigKeySet _extraConfigKeys; search::index::Schema::SP buildSchema(const DocumentDBConfig::AttributesConfig & newAttributesConfig, @@ -42,8 +41,6 @@ public: void forwardConfig(const BootstrapConfigSP & config); const config::ConfigKeySet createConfigKeySet() const; - void setExtraConfigKeys(const config::ConfigKeySet & extraConfigKeys) { _extraConfigKeys = extraConfigKeys; } - const config::ConfigKeySet & getExtraConfigKeys() const { return _extraConfigKeys; } const vespalib::string & getConfigId() const { return _configId; } }; @@ -54,10 +51,8 @@ class DocumentDBConfigHelper { public: DocumentDBConfigHelper(const config::DirSpec &spec, const vespalib::string &docTypeName); - DocumentDBConfigHelper(const config::DirSpec &spec, const vespalib::string &docTypeName, - const config::ConfigKeySet &extraConfigKeys); - ~DocumentDBConfigHelper(); + bool nextGeneration(int timeoutInMillis); DocumentDBConfig::SP getConfig() const; void forwardConfig(const std::shared_ptr<BootstrapConfig> & config); diff --git a/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp b/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp index f7bec951bbd..cfb96172800 100644 --- a/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/fileconfigmanager.cpp @@ -50,12 +50,6 @@ makeSnapDirBaseName(SerialNum serialNum) return os.str(); } -vespalib::string -makeExtraConfigsFileName(const vespalib::string &snapDir) -{ - return snapDir + "/extraconfigs.dat"; -} - void fsyncFile(const vespalib::string &fileName) @@ -88,37 +82,11 @@ saveHelper(const vespalib::string &snapDir, template <class Config> void -save(const vespalib::string &snapDir, - const Config &config) +save(const vespalib::string &snapDir, const Config &config) { saveHelper(snapDir, config.defName(), config); } -void writeExtraConfigs(const vespalib::string &snapDir, - const DocumentDBConfig &snapshot) -{ - vespalib::string extraName(makeExtraConfigsFileName(snapDir)); - config::FileConfigSnapshotWriter writer(extraName); - bool extraConfigsWriterResult = writer.write(snapshot.getExtraConfigs()); - assert(extraConfigsWriterResult); - (void) extraConfigsWriterResult; - fsyncFile(extraName); -} - -config::ConfigSnapshot -readExtraConfigs(const vespalib::string &snapDir) -{ - vespalib::string fileName = makeExtraConfigsFileName(snapDir); - if (vespalib::fileExists(fileName)) { - config::FileConfigSnapshotReader reader(fileName); - return reader.read(); - } else { - LOG(warning, "Did not find data file for extra configs '%s' during loading of config snapshot. " - "Using empty extra configs set.", fileName.c_str()); - } - return config::ConfigSnapshot(); -} - class ConfigFile { @@ -329,7 +297,6 @@ FileConfigManager::saveConfig(const DocumentDBConfig &snapshot, assert(saveHistorySchemaRes); (void) saveHistorySchemaRes; - writeExtraConfigs(snapDir, snapshot); _info.validateSnapshot(serialNum); bool saveValidSnap = _info.save(); @@ -393,20 +360,13 @@ FileConfigManager::loadConfig(const DocumentDBConfig ¤tSnapshot, * of default values here instead of the current values from the config * server. */ - BootstrapConfig::SP bootstrap( - new BootstrapConfig(1, - docTypesCfg, - repo, - _protonConfig, - filedistRpcConf, - bucketspaces, - currentSnapshot.getTuneFileDocumentDBSP())); + auto bootstrap = std::make_shared<BootstrapConfig>(1, docTypesCfg, repo, _protonConfig, filedistRpcConf, + bucketspaces,currentSnapshot.getTuneFileDocumentDBSP()); dbc.forwardConfig(bootstrap); dbc.nextGeneration(0); loadedSnapshot = dbc.getConfig(); loadedSnapshot->setConfigId(_configId); - loadedSnapshot->setExtraConfigs(readExtraConfigs(snapDir)); } diff --git a/searchcore/src/vespa/searchcore/proton/test/documentdb_config_builder.cpp b/searchcore/src/vespa/searchcore/proton/test/documentdb_config_builder.cpp index e085d1c52f8..2bfbbf97001 100644 --- a/searchcore/src/vespa/searchcore/proton/test/documentdb_config_builder.cpp +++ b/searchcore/src/vespa/searchcore/proton/test/documentdb_config_builder.cpp @@ -43,10 +43,8 @@ DocumentDBConfigBuilder::DocumentDBConfigBuilder(int64_t generation, _maintenance(std::make_shared<DocumentDBMaintenanceConfig>()), _store(), _configId(configId), - _docTypeName(docTypeName), - _extraConfig() -{ -} + _docTypeName(docTypeName) +{ } DocumentDBConfigBuilder::DocumentDBConfigBuilder(const DocumentDBConfig &cfg) @@ -66,10 +64,8 @@ DocumentDBConfigBuilder::DocumentDBConfigBuilder(const DocumentDBConfig &cfg) _maintenance(cfg.getMaintenanceConfigSP()), _store(cfg.getStoreConfig()), _configId(cfg.getConfigId()), - _docTypeName(cfg.getDocTypeName()), - _extraConfig(cfg.getExtraConfigs()) -{ -} + _docTypeName(cfg.getDocTypeName()) +{} DocumentDBConfigBuilder::~DocumentDBConfigBuilder() {} @@ -93,8 +89,7 @@ DocumentDBConfigBuilder::build() _maintenance, _store, _configId, - _docTypeName, - _extraConfig); + _docTypeName); } } diff --git a/searchcore/src/vespa/searchcore/proton/test/documentdb_config_builder.h b/searchcore/src/vespa/searchcore/proton/test/documentdb_config_builder.h index 87369dab123..0dd812c354c 100644 --- a/searchcore/src/vespa/searchcore/proton/test/documentdb_config_builder.h +++ b/searchcore/src/vespa/searchcore/proton/test/documentdb_config_builder.h @@ -28,7 +28,6 @@ private: search::LogDocumentStore::Config _store; vespalib::string _configId; vespalib::string _docTypeName; - config::ConfigSnapshot _extraConfig; public: DocumentDBConfigBuilder(int64_t generation, |