diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-10-05 15:59:54 +0200 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2017-10-05 23:07:08 +0200 |
commit | fee8f7f7aef4602da89d5bf43620a064d0de7172 (patch) | |
tree | b5cce81e1d23fc536f8a692d429ca3fc224eda9b /searchcore/src | |
parent | 1273bfa7c489c8b6861fca1777833b068336944b (diff) |
Wire in LogDocumentStore::Config in snapshot.
Diffstat (limited to 'searchcore/src')
7 files changed, 97 insertions, 111 deletions
diff --git a/searchcore/src/apps/tests/persistenceconformance_test.cpp b/searchcore/src/apps/tests/persistenceconformance_test.cpp index 86ab574f7d3..de0acf643fc 100644 --- a/searchcore/src/apps/tests/persistenceconformance_test.cpp +++ b/searchcore/src/apps/tests/persistenceconformance_test.cpp @@ -128,6 +128,7 @@ public: std::make_shared<TuneFileDocumentDB>(), schema, std::make_shared<DocumentDBMaintenanceConfig>(), + search::LogDocumentStore::Config(), "client", docTypeName.getName())); } 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 79a97ece098..08aa4430fde 100644 --- a/searchcore/src/tests/proton/proton_configurer/proton_configurer_test.cpp +++ b/searchcore/src/tests/proton/proton_configurer/proton_configurer_test.cpp @@ -86,6 +86,7 @@ struct DBConfigFixture { std::make_shared<TuneFileDocumentDB>(), buildSchema(), std::make_shared<DocumentDBMaintenanceConfig>(), + search::LogDocumentStore::Config(), configId, docTypeName, config::ConfigSnapshot()); diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.cpp index 86d43517d00..d4feda889e3 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.cpp @@ -41,6 +41,7 @@ DocumentDBConfig::ComparisonResult::ComparisonResult() tuneFileDocumentDBChanged(false), schemaChanged(false), maintenanceChanged(false), + storeChanged(false), visibilityDelayChanged(false) { } @@ -59,6 +60,7 @@ DocumentDBConfig::DocumentDBConfig( const search::TuneFileDocumentDB::SP &tuneFileDocumentDB, const Schema::SP &schema, const DocumentDBMaintenanceConfig::SP &maintenance, + const search::LogDocumentStore::Config & storeConfig, const vespalib::string &configId, const vespalib::string &docTypeName, const config::ConfigSnapshot & extraConfigs) @@ -78,6 +80,7 @@ DocumentDBConfig::DocumentDBConfig( _tuneFileDocumentDB(tuneFileDocumentDB), _schema(schema), _maintenance(maintenance), + _storeConfig(storeConfig), _extraConfigs(extraConfigs), _orig(), _delayedAttributeAspects(false) @@ -102,6 +105,7 @@ DocumentDBConfig(const DocumentDBConfig &cfg) _tuneFileDocumentDB(cfg._tuneFileDocumentDB), _schema(cfg._schema), _maintenance(cfg._maintenance), + _storeConfig(cfg._storeConfig), _extraConfigs(cfg._extraConfigs), _orig(cfg._orig), _delayedAttributeAspects(false) @@ -112,31 +116,20 @@ DocumentDBConfig::~DocumentDBConfig() { } bool DocumentDBConfig::operator==(const DocumentDBConfig & rhs) const { - return equals<RankProfilesConfig>(_rankProfiles.get(), - rhs._rankProfiles.get()) && - equals<RankingConstants>(_rankingConstants.get(), - rhs._rankingConstants.get()) && - equals<IndexschemaConfig>(_indexschema.get(), - rhs._indexschema.get()) && - equals<AttributesConfig>(_attributes.get(), - rhs._attributes.get()) && - equals<SummaryConfig>(_summary.get(), - rhs._summary.get()) && - equals<SummarymapConfig>(_summarymap.get(), - rhs._summarymap.get()) && - equals<JuniperrcConfig>(_juniperrc.get(), - rhs._juniperrc.get()) && - equals<DocumenttypesConfig>(_documenttypes.get(), - rhs._documenttypes.get()) && + return equals<RankProfilesConfig>(_rankProfiles.get(), rhs._rankProfiles.get()) && + equals<RankingConstants>(_rankingConstants.get(), rhs._rankingConstants.get()) && + equals<IndexschemaConfig>(_indexschema.get(), rhs._indexschema.get()) && + equals<AttributesConfig>(_attributes.get(), rhs._attributes.get()) && + equals<SummaryConfig>(_summary.get(), rhs._summary.get()) && + equals<SummarymapConfig>(_summarymap.get(), rhs._summarymap.get()) && + equals<JuniperrcConfig>(_juniperrc.get(), rhs._juniperrc.get()) && + equals<DocumenttypesConfig>(_documenttypes.get(), rhs._documenttypes.get()) && _repo.get() == rhs._repo.get() && - equals<ImportedFieldsConfig >(_importedFields.get(), - rhs._importedFields.get()) && - equals<TuneFileDocumentDB>(_tuneFileDocumentDB.get(), - rhs._tuneFileDocumentDB.get()) && - equals<Schema>(_schema.get(), - rhs._schema.get()) && - equals<DocumentDBMaintenanceConfig>(_maintenance.get(), - rhs._maintenance.get()); + equals<ImportedFieldsConfig >(_importedFields.get(), rhs._importedFields.get()) && + equals<TuneFileDocumentDB>(_tuneFileDocumentDB.get(), rhs._tuneFileDocumentDB.get()) && + equals<Schema>(_schema.get(), rhs._schema.get()) && + equals<DocumentDBMaintenanceConfig>(_maintenance.get(), rhs._maintenance.get()) && + _storeConfig == rhs._storeConfig; } @@ -144,36 +137,21 @@ DocumentDBConfig::ComparisonResult DocumentDBConfig::compare(const DocumentDBConfig &rhs) const { ComparisonResult retval; - retval.rankProfilesChanged = - !equals<RankProfilesConfig>(_rankProfiles.get(), rhs._rankProfiles.get()); - retval.rankingConstantsChanged = - !equals<RankingConstants>(_rankingConstants.get(), rhs._rankingConstants.get()); - retval.indexschemaChanged = - !equals<IndexschemaConfig>(_indexschema.get(), rhs._indexschema.get()); - retval.attributesChanged = - !equals<AttributesConfig>(_attributes.get(), rhs._attributes.get()); - retval.summaryChanged = - !equals<SummaryConfig>(_summary.get(), rhs._summary.get()); - retval.summarymapChanged = - !equals<SummarymapConfig>(_summarymap.get(), rhs._summarymap.get()); - retval.juniperrcChanged = - !equals<JuniperrcConfig>(_juniperrc.get(), rhs._juniperrc.get()); - retval.documenttypesChanged = - !equals<DocumenttypesConfig>(_documenttypes.get(), - rhs._documenttypes.get()); + retval.rankProfilesChanged = !equals<RankProfilesConfig>(_rankProfiles.get(), rhs._rankProfiles.get()); + retval.rankingConstantsChanged = !equals<RankingConstants>(_rankingConstants.get(), rhs._rankingConstants.get()); + retval.indexschemaChanged = !equals<IndexschemaConfig>(_indexschema.get(), rhs._indexschema.get()); + retval.attributesChanged = !equals<AttributesConfig>(_attributes.get(), rhs._attributes.get()); + retval.summaryChanged = !equals<SummaryConfig>(_summary.get(), rhs._summary.get()); + retval.summarymapChanged = !equals<SummarymapConfig>(_summarymap.get(), rhs._summarymap.get()); + retval.juniperrcChanged = !equals<JuniperrcConfig>(_juniperrc.get(), rhs._juniperrc.get()); + retval.documenttypesChanged = !equals<DocumenttypesConfig>(_documenttypes.get(), rhs._documenttypes.get()); retval.documentTypeRepoChanged = _repo.get() != rhs._repo.get(); - retval.importedFieldsChanged = - !equals<ImportedFieldsConfig >(_importedFields.get(), rhs._importedFields.get()); - retval.tuneFileDocumentDBChanged = - !equals<TuneFileDocumentDB>(_tuneFileDocumentDB.get(), - rhs._tuneFileDocumentDB.get()); - retval.schemaChanged = - !equals<Schema>(_schema.get(), rhs._schema.get()); - retval.maintenanceChanged = - !equals<DocumentDBMaintenanceConfig>(_maintenance.get(), - rhs._maintenance.get()); - retval.visibilityDelayChanged = - (_maintenance->getVisibilityDelay() != rhs._maintenance->getVisibilityDelay()); + retval.importedFieldsChanged = !equals<ImportedFieldsConfig >(_importedFields.get(), rhs._importedFields.get()); + retval.tuneFileDocumentDBChanged = !equals<TuneFileDocumentDB>(_tuneFileDocumentDB.get(), rhs._tuneFileDocumentDB.get()); + retval.schemaChanged = !equals<Schema>(_schema.get(), rhs._schema.get()); + retval.maintenanceChanged = !equals<DocumentDBMaintenanceConfig>(_maintenance.get(), rhs._maintenance.get()); + retval.storeChanged = _storeConfig != rhs._storeConfig; + retval.visibilityDelayChanged = (_maintenance->getVisibilityDelay() != rhs._maintenance->getVisibilityDelay()); return retval; } @@ -181,19 +159,19 @@ DocumentDBConfig::compare(const DocumentDBConfig &rhs) const bool DocumentDBConfig::valid() const { - return (_rankProfiles.get() != NULL) && - (_rankingConstants.get() != NULL) && - (_indexschema.get() != NULL) && - (_attributes.get() != NULL) && - (_summary.get() != NULL) && - (_summarymap.get() != NULL) && - (_juniperrc.get() != NULL) && - (_documenttypes.get() != NULL) && - (_repo.get() != NULL) && - (_importedFields.get() != NULL) && - (_tuneFileDocumentDB.get() != NULL) && - (_schema.get() != NULL) && - (_maintenance.get() != NULL); + return _rankProfiles && + _rankingConstants && + _indexschema && + _attributes && + _summary && + _summarymap && + _juniperrc && + _documenttypes && + _repo && + _importedFields && + _tuneFileDocumentDB && + _schema && + _maintenance; } namespace @@ -234,6 +212,7 @@ DocumentDBConfig::makeReplayConfig(const SP & orig) o._tuneFileDocumentDB, o._schema, o._maintenance, + o._storeConfig, o._configId, o._docTypeName, o._extraConfigs); @@ -274,6 +253,7 @@ DocumentDBConfig::newFromAttributesConfig(const AttributesConfigSP &attributes) _tuneFileDocumentDB, _schema, _maintenance, + _storeConfig, _configId, _docTypeName, _extraConfigs); @@ -309,6 +289,7 @@ DocumentDBConfig::makeDelayedAttributeAspectConfig(const SP &newCfg, const Docum n._tuneFileDocumentDB, n._schema, n._maintenance, + n._storeConfig, n._configId, n._docTypeName, n._extraConfigs); diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.h b/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.h index 015da3a30f9..4250ce61175 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentdbconfig.h @@ -9,6 +9,7 @@ #include <vespa/searchcore/proton/matching/ranking_constants.h> #include <vespa/config/retriever/configkeyset.h> #include <vespa/config/retriever/configsnapshot.h> +#include <vespa/searchlib/docstore/logdocumentstore.h> namespace vespa::config::search::internal { class InternalSummaryType; @@ -20,7 +21,6 @@ namespace vespa::config::search::internal { } namespace vespa::config::search::summary { namespace internal { class InternalJuniperrcType; } } - namespace document { namespace internal { class InternalDocumenttypesType; } } namespace proton { @@ -44,6 +44,7 @@ public: bool tuneFileDocumentDBChanged; bool schemaChanged; bool maintenanceChanged; + bool storeChanged; bool visibilityDelayChanged; ComparisonResult(); @@ -60,6 +61,8 @@ public: ComparisonResult &setTuneFileDocumentDBChanged(bool val) { tuneFileDocumentDBChanged = val; return *this; } ComparisonResult &setSchemaChanged(bool val) { schemaChanged = val; return *this; } ComparisonResult &setMaintenanceChanged(bool val) { maintenanceChanged = val; return *this; } + ComparisonResult &setStoreChanged(bool val) { storeChanged = val; return *this; } + ComparisonResult &setVisibilityDelayChanged(bool val) { visibilityDelayChanged = val; return *this; } }; @@ -84,25 +87,26 @@ public: using ImportedFieldsConfigSP = std::shared_ptr<ImportedFieldsConfig>; private: - vespalib::string _configId; - vespalib::string _docTypeName; - int64_t _generation; - RankProfilesConfigSP _rankProfiles; - RankingConstants::SP _rankingConstants; - IndexschemaConfigSP _indexschema; - AttributesConfigSP _attributes; - SummaryConfigSP _summary; - SummarymapConfigSP _summarymap; - JuniperrcConfigSP _juniperrc; - DocumenttypesConfigSP _documenttypes; - document::DocumentTypeRepo::SP _repo; - ImportedFieldsConfigSP _importedFields; - search::TuneFileDocumentDB::SP _tuneFileDocumentDB; - search::index::Schema::SP _schema; - MaintenanceConfigSP _maintenance; - config::ConfigSnapshot _extraConfigs; - SP _orig; - bool _delayedAttributeAspects; + vespalib::string _configId; + vespalib::string _docTypeName; + int64_t _generation; + RankProfilesConfigSP _rankProfiles; + RankingConstants::SP _rankingConstants; + IndexschemaConfigSP _indexschema; + AttributesConfigSP _attributes; + SummaryConfigSP _summary; + SummarymapConfigSP _summarymap; + JuniperrcConfigSP _juniperrc; + DocumenttypesConfigSP _documenttypes; + document::DocumentTypeRepo::SP _repo; + ImportedFieldsConfigSP _importedFields; + search::TuneFileDocumentDB::SP _tuneFileDocumentDB; + search::index::Schema::SP _schema; + MaintenanceConfigSP _maintenance; + search::LogDocumentStore::Config _storeConfig; + config::ConfigSnapshot _extraConfigs; + SP _orig; + bool _delayedAttributeAspects; template <typename T> @@ -128,6 +132,7 @@ public: const search::TuneFileDocumentDB::SP &tuneFileDocumentDB, const search::index::Schema::SP &schema, const DocumentDBMaintenanceConfig::SP &maintenance, + const search::LogDocumentStore::Config & storeConfig, const vespalib::string &configId, const vespalib::string &docTypeName, const config::ConfigSnapshot &extraConfig = config::ConfigSnapshot()); @@ -201,6 +206,8 @@ public: */ SP newFromAttributesConfig(const AttributesConfigSP &attributes) const; + const search::LogDocumentStore::Config & getStoreConfig() const { return _storeConfig; } + /** * Create config with delayed attribute aspect changes if they require * reprocessing. diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp index cae45d50d6d..4449fc6f3b3 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdbconfigmanager.cpp @@ -135,6 +135,12 @@ buildMaintenanceConfig(const BootstrapConfig::SP &bootstrapConfig, namespace { +search::LogDocumentStore::Config buildStoreConfig(const ProtonConfig & proton) { + (void) proton; + search::LogDocumentStore::Config config; + return config; +} + using AttributesConfigSP = DocumentDBConfig::AttributesConfigSP; using AttributesConfigBuilder = vespa::config::search::AttributesConfigBuilder; using AttributesConfigBuilderSP = std::shared_ptr<AttributesConfigBuilder>; @@ -189,18 +195,13 @@ DocumentDBConfigManager::update(const ConfigSnapshot &snapshot) } int64_t generation = snapshot.getGeneration(); - LOG(debug, - "Forwarded generation %" - PRId64 - ", generation %" - PRId64, - _bootstrapConfig->getGeneration(), generation); + LOG(debug, "Forwarded generation %" PRId64 ", generation %" PRId64, _bootstrapConfig->getGeneration(), generation); if (!_ignoreForwardedConfig && _bootstrapConfig->getGeneration() != generation) { return; } int64_t currentGeneration = -1; - if (current.get() != NULL) { + if (current) { newRankProfilesConfig = current->getRankProfilesConfigSP(); newRankingConstants = current->getRankingConstantsSP(); newIndexschemaConfig = current->getIndexschemaConfigSP(); @@ -245,13 +246,11 @@ DocumentDBConfigManager::update(const ConfigSnapshot &snapshot) newRankingConstants = std::make_shared<RankingConstants>(constants); } if (snapshot.isChanged<IndexschemaConfig>(_configId, currentGeneration)) { - std::unique_ptr<IndexschemaConfig> indexschemaConfig = - snapshot.getConfig<IndexschemaConfig>(_configId); + std::unique_ptr<IndexschemaConfig> indexschemaConfig = snapshot.getConfig<IndexschemaConfig>(_configId); search::index::Schema schema; search::index::SchemaBuilder::build(*indexschemaConfig, schema); if (!search::index::SchemaUtil::validateSchema(schema)) { - LOG(error, - "Cannot use bad index schema, validation failed"); + LOG(error, "Cannot use bad index schema, validation failed"); abort(); } newIndexschemaConfig = IndexschemaConfigSP(indexschemaConfig.release()); @@ -272,14 +271,10 @@ DocumentDBConfigManager::update(const ConfigSnapshot &snapshot) newImportedFieldsConfig = ImportedFieldsConfigSP(snapshot.getConfig<ImportedFieldsConfig>(_configId).release()); } - Schema::SP schema(buildSchema(*newAttributesConfig, - *newSummaryConfig, - *newIndexschemaConfig)); - newMaintenanceConfig = buildMaintenanceConfig(_bootstrapConfig, - _docTypeName); - if (newMaintenanceConfig.get() != NULL && - oldMaintenanceConfig.get() != NULL && - *newMaintenanceConfig == *oldMaintenanceConfig) { + Schema::SP schema(buildSchema(*newAttributesConfig, *newSummaryConfig, *newIndexschemaConfig)); + newMaintenanceConfig = buildMaintenanceConfig(_bootstrapConfig, _docTypeName); + search::LogDocumentStore::Config storeConfig = buildStoreConfig(_bootstrapConfig->getProtonConfig()); + if (newMaintenanceConfig && oldMaintenanceConfig && *newMaintenanceConfig == *oldMaintenanceConfig) { newMaintenanceConfig = oldMaintenanceConfig; } ConfigSnapshot extraConfigs(snapshot.subset(_extraConfigKeys)); @@ -298,6 +293,7 @@ DocumentDBConfigManager::update(const ConfigSnapshot &snapshot) _bootstrapConfig->getTuneFileDocumentDBSP(), schema, newMaintenanceConfig, + storeConfig, _configId, _docTypeName, extraConfigs)); 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 22b9d828cac..e085d1c52f8 100644 --- a/searchcore/src/vespa/searchcore/proton/test/documentdb_config_builder.cpp +++ b/searchcore/src/vespa/searchcore/proton/test/documentdb_config_builder.cpp @@ -21,8 +21,7 @@ using vespa::config::search::SummarymapConfig; using vespa::config::search::summary::JuniperrcConfig; using vespa::config::search::ImportedFieldsConfig; -namespace proton { -namespace test { +namespace proton::test { DocumentDBConfigBuilder::DocumentDBConfigBuilder(int64_t generation, const search::index::Schema::SP &schema, @@ -42,6 +41,7 @@ DocumentDBConfigBuilder::DocumentDBConfigBuilder(int64_t generation, _tuneFileDocumentDB(std::make_shared<TuneFileDocumentDB>()), _schema(schema), _maintenance(std::make_shared<DocumentDBMaintenanceConfig>()), + _store(), _configId(configId), _docTypeName(docTypeName), _extraConfig() @@ -64,6 +64,7 @@ DocumentDBConfigBuilder::DocumentDBConfigBuilder(const DocumentDBConfig &cfg) _tuneFileDocumentDB(cfg.getTuneFileDocumentDBSP()), _schema(cfg.getSchemaSP()), _maintenance(cfg.getMaintenanceConfigSP()), + _store(cfg.getStoreConfig()), _configId(cfg.getConfigId()), _docTypeName(cfg.getDocTypeName()), _extraConfig(cfg.getExtraConfigs()) @@ -90,10 +91,10 @@ DocumentDBConfigBuilder::build() _tuneFileDocumentDB, _schema, _maintenance, + _store, _configId, _docTypeName, _extraConfig); } } -} 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 cf20cf08481..87369dab123 100644 --- a/searchcore/src/vespa/searchcore/proton/test/documentdb_config_builder.h +++ b/searchcore/src/vespa/searchcore/proton/test/documentdb_config_builder.h @@ -4,8 +4,7 @@ #include <vespa/searchcore/proton/server/documentdbconfig.h> -namespace proton { -namespace test { +namespace proton::test { /** * Builder for instances of DocumentDBConfig used in unit tests. @@ -26,6 +25,7 @@ private: search::TuneFileDocumentDB::SP _tuneFileDocumentDB; search::index::Schema::SP _schema; DocumentDBConfig::MaintenanceConfigSP _maintenance; + search::LogDocumentStore::Config _store; vespalib::string _configId; vespalib::string _docTypeName; config::ConfigSnapshot _extraConfig; @@ -67,4 +67,3 @@ public: }; } -} |