diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-05-25 21:46:53 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2022-05-25 22:41:37 +0000 |
commit | 25b997ae63728660e5e0d18f9f3965a392245b8d (patch) | |
tree | 30362450b86c7d63a1bdd28747edc8d732612d07 /searchcore | |
parent | 1aa60e70335ef3397d3a987df7ffcf111fad4f7f (diff) |
Include searchcommon/attribut/config.h yourself and prepare for hiding large implementation.
Add setters to vespalib::GrowStrategy.
Diffstat (limited to 'searchcore')
32 files changed, 130 insertions, 109 deletions
diff --git a/searchcore/src/tests/proton/attribute/attribute_initializer/attribute_initializer_test.cpp b/searchcore/src/tests/proton/attribute/attribute_initializer/attribute_initializer_test.cpp index cbc345f68d8..b16f7810cca 100644 --- a/searchcore/src/tests/proton/attribute/attribute_initializer/attribute_initializer_test.cpp +++ b/searchcore/src/tests/proton/attribute/attribute_initializer/attribute_initializer_test.cpp @@ -93,7 +93,7 @@ struct Fixture vespalib::ThreadStackExecutor _executor; Fixture(); ~Fixture(); - std::unique_ptr<AttributeInitializer> createInitializer(const AttributeSpec &spec, SerialNum serialNum); + std::unique_ptr<AttributeInitializer> createInitializer(AttributeSpec && spec, SerialNum serialNum); }; Fixture::Fixture() @@ -107,9 +107,9 @@ Fixture::Fixture() Fixture::~Fixture() = default; std::unique_ptr<AttributeInitializer> -Fixture::createInitializer(const AttributeSpec &spec, SerialNum serialNum) +Fixture::createInitializer(AttributeSpec &&spec, SerialNum serialNum) { - return std::make_unique<AttributeInitializer>(_diskLayout->createAttributeDir(spec.getName()), "test.subdb", spec, serialNum, _factory, _executor); + return std::make_unique<AttributeInitializer>(_diskLayout->createAttributeDir(spec.getName()), "test.subdb", std::move(spec), serialNum, _factory, _executor); } TEST("require that integer attribute can be initialized") diff --git a/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp b/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp index 7b0451d0f9d..2b3f1c56ae1 100644 --- a/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp +++ b/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp @@ -1,9 +1,5 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/config-attributes.h> -#include <vespa/fastos/file.h> -#include <vespa/searchcommon/attribute/i_attribute_functor.h> -#include <vespa/searchcommon/attribute/iattributevector.h> #include <vespa/searchcore/proton/attribute/attribute_collection_spec_factory.h> #include <vespa/searchcore/proton/attribute/attribute_manager_initializer.h> #include <vespa/searchcore/proton/attribute/attribute_writer.h> @@ -33,11 +29,15 @@ #include <vespa/searchlib/predicate/predicate_tree_annotator.h> #include <vespa/searchlib/test/directory_handler.h> #include <vespa/searchlib/test/mock_gid_to_lid_mapping.h> +#include <vespa/searchcommon/attribute/i_attribute_functor.h> +#include <vespa/searchcommon/attribute/iattributevector.h> #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/foreground_thread_executor.h> #include <vespa/vespalib/util/foregroundtaskexecutor.h> #include <vespa/vespalib/util/size_literals.h> #include <vespa/vespalib/util/threadstackexecutor.h> +#include <vespa/config-attributes.h> +#include <vespa/fastos/file.h> #include <vespa/log/log.h> LOG_SETUP("attribute_manager_test"); @@ -215,10 +215,9 @@ struct SequentialAttributeManager { SequentialAttributesInitializer initializer; proton::AttributeManager mgr; - SequentialAttributeManager(const AttributeManager &currMgr, - const AttrMgrSpec &newSpec) + SequentialAttributeManager(const AttributeManager &currMgr, AttrMgrSpec && newSpec) : initializer(newSpec.getDocIdLimit()), - mgr(currMgr, newSpec, initializer) + mgr(currMgr, std::move(newSpec), initializer) { mgr.addInitializedAttributes(initializer.getInitializedAttributes()); } @@ -447,7 +446,7 @@ TEST_F("require that reconfig can add attributes", Fixture) newSpec.push_back(AttributeSpec("a2", INT32_SINGLE)); newSpec.push_back(AttributeSpec("a3", INT32_SINGLE)); - SequentialAttributeManager sam(f._m, AttrMgrSpec(newSpec, f._m.getNumDocs(), 10)); + SequentialAttributeManager sam(f._m, AttrMgrSpec(std::move(newSpec), f._m.getNumDocs(), 10)); std::vector<AttributeGuard> list; sam.mgr.getAttributeList(list); std::sort(list.begin(), list.end(), [](const AttributeGuard & a, const AttributeGuard & b) { @@ -470,7 +469,7 @@ TEST_F("require that reconfig can remove attributes", Fixture) AttrSpecList newSpec; newSpec.push_back(AttributeSpec("a2", INT32_SINGLE)); - SequentialAttributeManager sam(f._m, AttrMgrSpec(newSpec, 1, 10)); + SequentialAttributeManager sam(f._m, AttrMgrSpec(std::move(newSpec), 1, 10)); std::vector<AttributeGuard> list; sam.mgr.getAttributeList(list); EXPECT_EQUAL(1u, list.size()); @@ -493,7 +492,7 @@ TEST_F("require that new attributes after reconfig are initialized", Fixture) newSpec.push_back(AttributeSpec("a2", INT32_SINGLE)); newSpec.push_back(AttributeSpec("a3", INT32_ARRAY)); - SequentialAttributeManager sam(f._m, AttrMgrSpec(newSpec, 3, 4)); + SequentialAttributeManager sam(f._m, AttrMgrSpec(std::move(newSpec), 3, 4)); AttributeGuard::UP a2ap = sam.mgr.getAttribute("a2"); AttributeGuard &a2(*a2ap); EXPECT_EQUAL(3u, a2->getNumDocs()); @@ -519,13 +518,13 @@ TEST_F("require that removed attributes cannot resurrect", BaseFixture) } AttrSpecList ns1; - SequentialAttributeManager am2(*am1, AttrMgrSpec(ns1, 3, 16)); + SequentialAttributeManager am2(*am1, AttrMgrSpec(std::move(ns1), 3, 16)); am1.reset(); AttrSpecList ns2; ns2.push_back(AttributeSpec("a1", INT32_SINGLE)); // 2 new documents added since a1 was removed - SequentialAttributeManager am3(am2.mgr, AttrMgrSpec(ns2, 5, 20)); + SequentialAttributeManager am3(am2.mgr, AttrMgrSpec(std::move(ns2), 5, 20)); AttributeGuard::UP ag1ap = am3.mgr.getAttribute("a1"); AttributeGuard &ag1(*ag1ap); @@ -545,7 +544,7 @@ TEST_F("require that extra attribute is not treated as removed", Fixture) ex->commit(CommitParam(1)); AttrSpecList ns; - SequentialAttributeManager am2(f._m, AttrMgrSpec(ns, 2, 1)); + SequentialAttributeManager am2(f._m, AttrMgrSpec(std::move(ns), 2, 1)); EXPECT_TRUE(am2.mgr.getAttribute("ex")->operator->() == ex.get()); // reuse } @@ -558,7 +557,7 @@ TEST_F("require that removed fields can be pruned", Fixture) AttrSpecList newSpec; newSpec.push_back(AttributeSpec("a2", INT32_SINGLE)); - SequentialAttributeManager sam(f._m, AttrMgrSpec(newSpec, 1, 11)); + SequentialAttributeManager sam(f._m, AttrMgrSpec(std::move(newSpec), 1, 11)); sam.mgr.pruneRemovedFields(11); FastOS_StatInfo si; @@ -690,7 +689,7 @@ TEST_F("require that attributes can be initialized and loaded in sequence", Base newSpec.push_back(AttributeSpec("a2", INT32_SINGLE)); newSpec.push_back(AttributeSpec("a3", INT32_SINGLE)); - SequentialAttributeManager newMgr(amf._m, AttrMgrSpec(newSpec, 10, createSerialNum + 5)); + SequentialAttributeManager newMgr(amf._m, AttrMgrSpec(std::move(newSpec), 10, createSerialNum + 5)); AttributeGuard::UP a1 = newMgr.mgr.getAttribute("a1"); TEST_DO(validateAttribute(*a1->get())); @@ -819,7 +818,7 @@ TEST_F("require that attribute vector of wrong type is dropped", BaseFixture) newSpec.push_back(AttributeSpec("a4", dense_tensor)); newSpec.push_back(AttributeSpec("a5", predicate)); newSpec.push_back(AttributeSpec("a6", predicate2)); - SequentialAttributeManager am2(*am1, AttrMgrSpec(newSpec, 5, 20)); + SequentialAttributeManager am2(*am1, AttrMgrSpec(std::move(newSpec), 5, 20)); TEST_DO(assertCreateSerialNum(*am1, "a1", 1)); TEST_DO(assertCreateSerialNum(*am1, "a2", 2)); TEST_DO(assertCreateSerialNum(*am1, "a3", 3)); @@ -861,7 +860,7 @@ TEST_F("require that shrink flushtarget is handed over to new attribute manager" am1->addAttribute({"a1", INT32_SINGLE}, 4); AttrSpecList newSpec; newSpec.push_back(AttributeSpec("a1", INT32_SINGLE)); - auto am2 = am1->create(AttrMgrSpec(newSpec, 5, 20)); + auto am2 = am1->create(AttrMgrSpec(std::move(newSpec), 5, 20)); auto am3 = std::dynamic_pointer_cast<AttributeManager>(am2); TEST_DO(assertShrinkTargetSerial(*am3, "a1", 3)); EXPECT_EQUAL(am1->getShrinker("a1"), am3->getShrinker("a1")); diff --git a/searchcore/src/tests/proton/attribute/attribute_test.cpp b/searchcore/src/tests/proton/attribute/attribute_test.cpp index de6b923bdc1..bcce3b8d07a 100644 --- a/searchcore/src/tests/proton/attribute/attribute_test.cpp +++ b/searchcore/src/tests/proton/attribute/attribute_test.cpp @@ -555,8 +555,7 @@ public: attr.fastaccess = fastAccess; _builder.attribute.push_back(attr); } - AttributeCollectionSpec::UP create(uint32_t docIdLimit, - search::SerialNum serialNum) { + std::unique_ptr<AttributeCollectionSpec> create(uint32_t docIdLimit, search::SerialNum serialNum) { return _factory.create(_builder, docIdLimit, serialNum); } }; @@ -573,7 +572,7 @@ struct FastAccessAttributeCollectionSpecTest : public AttributeCollectionSpecTes TEST_F(NormalAttributeCollectionSpecTest, spec_can_be_created) { - AttributeCollectionSpec::UP spec = create(10, 20); + auto spec = create(10, 20); EXPECT_EQ(2u, spec->getAttributes().size()); EXPECT_EQ("a1", spec->getAttributes()[0].getName()); EXPECT_EQ("a2", spec->getAttributes()[1].getName()); @@ -583,7 +582,7 @@ TEST_F(NormalAttributeCollectionSpecTest, spec_can_be_created) TEST_F(FastAccessAttributeCollectionSpecTest, spec_can_be_created) { - AttributeCollectionSpec::UP spec = create(10, 20); + auto spec = create(10, 20); EXPECT_EQ(1u, spec->getAttributes().size()); EXPECT_EQ("a2", spec->getAttributes()[0].getName()); EXPECT_EQ(10u, spec->getDocIdLimit()); @@ -594,13 +593,13 @@ const FilterAttributeManager::AttributeSet ACCEPTED_ATTRIBUTES = {"a2"}; class FilterAttributeManagerTest : public ::testing::Test { public: - DirectoryHandler _dirHandler; - DummyFileHeaderContext _fileHeaderContext; - ForegroundTaskExecutor _attributeFieldWriter; - ForegroundThreadExecutor _shared; - HwInfo _hwInfo; + DirectoryHandler _dirHandler; + DummyFileHeaderContext _fileHeaderContext; + ForegroundTaskExecutor _attributeFieldWriter; + ForegroundThreadExecutor _shared; + HwInfo _hwInfo; proton::AttributeManager::SP _baseMgr; - FilterAttributeManager _filterMgr; + FilterAttributeManager _filterMgr; FilterAttributeManagerTest() : _dirHandler(test_dir), diff --git a/searchcore/src/tests/proton/attribute/attributeflush_test.cpp b/searchcore/src/tests/proton/attribute/attributeflush_test.cpp index 0dab0710209..ab7a0db5e7b 100644 --- a/searchcore/src/tests/proton/attribute/attributeflush_test.cpp +++ b/searchcore/src/tests/proton/attribute/attributeflush_test.cpp @@ -13,6 +13,7 @@ #include <vespa/searchlib/common/indexmetainfo.h> #include <vespa/searchlib/index/dummyfileheadercontext.h> #include <vespa/searchlib/test/directory_handler.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/vespalib/datastore/datastorebase.h> #include <vespa/vespalib/io/fileutil.h> #include <vespa/vespalib/testkit/testapp.h> diff --git a/searchcore/src/tests/proton/attribute/document_field_populator/document_field_populator_test.cpp b/searchcore/src/tests/proton/attribute/document_field_populator/document_field_populator_test.cpp index 2815bd7d88e..b08764289e6 100644 --- a/searchcore/src/tests/proton/attribute/document_field_populator/document_field_populator_test.cpp +++ b/searchcore/src/tests/proton/attribute/document_field_populator/document_field_populator_test.cpp @@ -1,11 +1,12 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include <vespa/vespalib/testkit/testapp.h> -#include <vespa/searchcommon/common/schema.h> #include <vespa/searchcore/proton/attribute/document_field_populator.h> #include <vespa/searchlib/attribute/attributefactory.h> #include <vespa/searchlib/attribute/integerbase.h> #include <vespa/searchlib/index/docbuilder.h> +#include <vespa/searchcommon/common/schema.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/vespalib/util/stringfmt.h> #include <vespa/log/log.h> diff --git a/searchcore/src/tests/proton/attribute/imported_attributes_context/imported_attributes_context_test.cpp b/searchcore/src/tests/proton/attribute/imported_attributes_context/imported_attributes_context_test.cpp index 996ddac2d2a..0a6c38b4209 100644 --- a/searchcore/src/tests/proton/attribute/imported_attributes_context/imported_attributes_context_test.cpp +++ b/searchcore/src/tests/proton/attribute/imported_attributes_context/imported_attributes_context_test.cpp @@ -12,6 +12,7 @@ #include <vespa/searchlib/attribute/imported_attribute_vector_factory.h> #include <vespa/searchlib/attribute/reference_attribute.h> #include <vespa/searchlib/test/mock_gid_to_lid_mapping.h> +#include <vespa/searchcommon/attribute/config.h> #include <future> #include <vespa/log/log.h> diff --git a/searchcore/src/tests/proton/common/attribute_updater/attribute_updater_test.cpp b/searchcore/src/tests/proton/common/attribute_updater/attribute_updater_test.cpp index 8fa5c2994b0..2d7e242b9fb 100644 --- a/searchcore/src/tests/proton/common/attribute_updater/attribute_updater_test.cpp +++ b/searchcore/src/tests/proton/common/attribute_updater/attribute_updater_test.cpp @@ -1,5 +1,12 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#include <vespa/searchcore/proton/common/attribute_updater.h> +#include <vespa/searchlib/attribute/attributefactory.h> +#include <vespa/searchlib/attribute/reference_attribute.h> +#include <vespa/searchlib/tensor/dense_tensor_attribute.h> +#include <vespa/searchlib/tensor/serialized_fast_value_attribute.h> +#include <vespa/searchlib/test/weighted_type_test_utils.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/document/base/testdocrepo.h> #include <vespa/document/datatype/tensor_data_type.h> #include <vespa/document/fieldvalue/arrayfieldvalue.h> @@ -26,12 +33,6 @@ #include <vespa/eval/eval/tensor_spec.h> #include <vespa/eval/eval/value.h> #include <vespa/eval/eval/value_codec.h> -#include <vespa/searchcore/proton/common/attribute_updater.h> -#include <vespa/searchlib/attribute/attributefactory.h> -#include <vespa/searchlib/attribute/reference_attribute.h> -#include <vespa/searchlib/tensor/dense_tensor_attribute.h> -#include <vespa/searchlib/tensor/serialized_fast_value_attribute.h> -#include <vespa/searchlib/test/weighted_type_test_utils.h> #include <vespa/vespalib/stllike/hash_map.hpp> #include <vespa/vespalib/testkit/testapp.h> diff --git a/searchcore/src/tests/proton/common/selectpruner_test.cpp b/searchcore/src/tests/proton/common/selectpruner_test.cpp index c8c474e21bc..3cb8389a4ea 100644 --- a/searchcore/src/tests/proton/common/selectpruner_test.cpp +++ b/searchcore/src/tests/proton/common/selectpruner_test.cpp @@ -1,16 +1,16 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/vespalib/stllike/string.h> -#include <vespa/vespalib/testkit/testapp.h> -#include <vespa/document/config/documenttypes_config_fwd.h> + +#include <vespa/searchcore/proton/common/selectpruner.h> +#include <vespa/searchlib/attribute/attributefactory.h> +#include <vespa/searchlib/test/mock_attribute_manager.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/document/repo/configbuilder.h> #include <vespa/document/repo/documenttyperepo.h> #include <vespa/document/datatype/documenttype.h> -#include <vespa/searchcore/proton/common/selectpruner.h> #include <vespa/document/select/parser.h> #include <vespa/document/select/cloningvisitor.h> #include <vespa/document/fieldvalue/document.h> -#include <vespa/searchlib/attribute/attributefactory.h> -#include <vespa/searchlib/test/mock_attribute_manager.h> +#include <vespa/vespalib/testkit/testapp.h> #include <vespa/log/log.h> LOG_SETUP("selectpruner_test"); diff --git a/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp b/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp index a460c65fbb2..f89af9a11a6 100644 --- a/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp +++ b/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp @@ -1,5 +1,13 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#include <vespa/searchcore/proton/common/attribute_updater.h> +#include <vespa/searchcore/proton/common/pendinglidtracker.h> +#include <vespa/searchcore/proton/persistenceengine/document_iterator.h> +#include <vespa/searchcore/proton/persistenceengine/commit_and_wait_document_retriever.h> +#include <vespa/searchlib/attribute/attributecontext.h> +#include <vespa/searchlib/attribute/attributefactory.h> +#include <vespa/searchlib/test/mock_attribute_manager.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/document/fieldset/fieldsets.h> #include <vespa/document/fieldvalue/fieldvalues.h> #include <vespa/document/datatype/documenttype.h> @@ -8,13 +16,6 @@ #include <vespa/persistence/spi/docentry.h> #include <vespa/persistence/spi/result.h> #include <vespa/persistence/spi/test.h> -#include <vespa/searchcore/proton/common/attribute_updater.h> -#include <vespa/searchcore/proton/common/pendinglidtracker.h> -#include <vespa/searchcore/proton/persistenceengine/document_iterator.h> -#include <vespa/searchcore/proton/persistenceengine/commit_and_wait_document_retriever.h> -#include <vespa/searchlib/attribute/attributecontext.h> -#include <vespa/searchlib/attribute/attributefactory.h> -#include <vespa/searchlib/test/mock_attribute_manager.h> #include <vespa/vespalib/objects/nbostream.h> #include <vespa/vespalib/testkit/test_kit.h> #include <unordered_set> diff --git a/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp b/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp index d4e337f2717..948c9cfe25e 100644 --- a/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp +++ b/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp @@ -455,11 +455,11 @@ asAttributeManager(const proton::IAttributeManager::SP &attrMgr) TEST_F("require that we can reconfigure attribute manager", Fixture) { ViewPtrs o = f._views.getViewPtrs(); - AttributeCollectionSpec::AttributeList specList; - AttributeCollectionSpec spec(specList, 1, 0); ReconfigParams params(CCR().setAttributesChanged(true).setSchemaChanged(true)); // Use new config snapshot == old config snapshot (only relevant for reprocessing) - f._configurer->reconfigure(*createConfig(), *createConfig(), spec, params, f._resolver); + f._configurer->reconfigure(*createConfig(), *createConfig(), + AttributeCollectionSpec(AttributeCollectionSpec::AttributeList(), 1, 0), + params, f._resolver); ViewPtrs n = f._views.getViewPtrs(); { // verify search view @@ -494,11 +494,11 @@ void checkAttributeWriterChangeOnRepoChange(Fixture &f, bool docTypeRepoChanged) { auto oldAttributeWriter = getAttributeWriter(f); - AttributeCollectionSpec::AttributeList specList; - AttributeCollectionSpec spec(specList, 1, 0); ReconfigParams params(CCR().setDocumentTypeRepoChanged(docTypeRepoChanged)); // Use new config snapshot == old config snapshot (only relevant for reprocessing) - f._configurer->reconfigure(*createConfig(), *createConfig(), spec, params, f._resolver); + f._configurer->reconfigure(*createConfig(), *createConfig(), + AttributeCollectionSpec(AttributeCollectionSpec::AttributeList(), 1, 0), + params, f._resolver); auto newAttributeWriter = getAttributeWriter(f); if (docTypeRepoChanged) { EXPECT_NOT_EQUAL(oldAttributeWriter, newAttributeWriter); @@ -515,11 +515,11 @@ TEST_F("require that we get new attribute writer if document type repo changes", TEST_F("require that reconfigure returns reprocessing initializer when changing attributes", Fixture) { - AttributeCollectionSpec::AttributeList specList; - AttributeCollectionSpec spec(specList, 1, 0); ReconfigParams params(CCR().setAttributesChanged(true).setSchemaChanged(true)); IReprocessingInitializer::UP init = - f._configurer->reconfigure(*createConfig(), *createConfig(), spec, params, f._resolver); + f._configurer->reconfigure(*createConfig(), *createConfig(), + AttributeCollectionSpec(AttributeCollectionSpec::AttributeList(), 1, 0), + params, f._resolver); EXPECT_TRUE(init.get() != nullptr); EXPECT_TRUE((dynamic_cast<AttributeReprocessingInitializer *>(init.get())) != nullptr); @@ -528,10 +528,9 @@ TEST_F("require that reconfigure returns reprocessing initializer when changing TEST_F("require that we can reconfigure attribute writer", FastAccessFixture) { - AttributeCollectionSpec::AttributeList specList; - AttributeCollectionSpec spec(specList, 1, 0); FastAccessFeedView::SP o = f._view._feedView.get(); - f._configurer.reconfigure(*createConfig(), *createConfig(), spec); + f._configurer.reconfigure(*createConfig(), *createConfig(), + AttributeCollectionSpec(AttributeCollectionSpec::AttributeList(), 1, 0)); FastAccessFeedView::SP n = f._view._feedView.get(); FastAccessFeedViewComparer cmp(o, n); @@ -543,10 +542,8 @@ TEST_F("require that we can reconfigure attribute writer", FastAccessFixture) TEST_F("require that reconfigure returns reprocessing initializer", FastAccessFixture) { - AttributeCollectionSpec::AttributeList specList; - AttributeCollectionSpec spec(specList, 1, 0); - IReprocessingInitializer::UP init = - f._configurer.reconfigure(*createConfig(), *createConfig(), spec); + IReprocessingInitializer::UP init = f._configurer.reconfigure(*createConfig(), *createConfig(), + AttributeCollectionSpec(AttributeCollectionSpec::AttributeList(), 1, 0)); EXPECT_TRUE(init.get() != nullptr); EXPECT_TRUE((dynamic_cast<AttributeReprocessingInitializer *>(init.get())) != nullptr); diff --git a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp index 5018b203216..adf0dbf4dcf 100644 --- a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp +++ b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp @@ -21,6 +21,7 @@ #include <vespa/searchcore/proton/test/threading_service_observer.h> #include <vespa/searchcore/proton/test/transport_helper.h> #include <vespa/searchlib/attribute/attributefactory.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/document/update/documentupdate.h> #include <vespa/document/datatype/documenttype.h> #include <vespa/vespalib/util/destructor_callbacks.h> diff --git a/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp b/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp index 73311c110a9..9a2655cdd8a 100644 --- a/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp +++ b/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp @@ -11,6 +11,7 @@ #include <vespa/searchcore/proton/flushengine/shrink_lid_space_flush_target.h> #include <vespa/searchcore/proton/server/itlssyncer.h> #include <vespa/searchlib/attribute/attributefilesavetarget.h> +#include <vespa/searchlib/attribute/search_context.h> #include <vespa/searchlib/common/flush_token.h> #include <vespa/searchlib/common/tunefileinfo.h> #include <vespa/searchlib/fef/matchdatalayout.h> diff --git a/searchcore/src/tests/proton/reference/document_db_reference/document_db_reference_test.cpp b/searchcore/src/tests/proton/reference/document_db_reference/document_db_reference_test.cpp index aba27827d56..526b0837212 100644 --- a/searchcore/src/tests/proton/reference/document_db_reference/document_db_reference_test.cpp +++ b/searchcore/src/tests/proton/reference/document_db_reference/document_db_reference_test.cpp @@ -1,11 +1,13 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/vespalib/testkit/testapp.h> + #include <vespa/searchcore/proton/attribute/imported_attributes_repo.h> #include <vespa/searchcore/proton/reference/document_db_reference.h> #include <vespa/searchcore/proton/test/mock_attribute_manager.h> #include <vespa/searchlib/attribute/attributefactory.h> #include <vespa/searchlib/attribute/imported_attribute_vector.h> - +#include <vespa/searchcommon/attribute/config.h> +#include <vespa/vespalib/testkit/testapp.h> +#include <cassert> #include <vespa/log/log.h> LOG_SETUP("document_db_reference_test"); diff --git a/searchcore/src/tests/proton/reference/document_db_reference_resolver/document_db_reference_resolver_test.cpp b/searchcore/src/tests/proton/reference/document_db_reference_resolver/document_db_reference_resolver_test.cpp index 061a3fd4c32..4ee245c697d 100644 --- a/searchcore/src/tests/proton/reference/document_db_reference_resolver/document_db_reference_resolver_test.cpp +++ b/searchcore/src/tests/proton/reference/document_db_reference_resolver/document_db_reference_resolver_test.cpp @@ -1,10 +1,5 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/vespalib/testkit/testapp.h> -#include <vespa/config-imported-fields.h> -#include <vespa/document/datatype/documenttype.h> -#include <vespa/document/datatype/referencedatatype.h> -#include <vespa/log/log.h> #include <vespa/searchcore/proton/attribute/imported_attributes_repo.h> #include <vespa/searchcore/proton/reference/document_db_reference_resolver.h> #include <vespa/searchcore/proton/reference/gid_to_lid_change_listener.h> @@ -18,11 +13,17 @@ #include <vespa/searchlib/attribute/reference_attribute.h> #include <vespa/searchlib/common/i_gid_to_lid_mapper.h> #include <vespa/searchlib/common/i_gid_to_lid_mapper_factory.h> +#include <vespa/searchlib/test/mock_attribute_manager.h> +#include <vespa/searchcommon/attribute/config.h> +#include <vespa/document/datatype/documenttype.h> +#include <vespa/document/datatype/referencedatatype.h> #include <vespa/vespalib/util/monitored_refcount.h> #include <vespa/vespalib/util/sequencedtaskexecutor.h> -#include <vespa/searchlib/test/mock_attribute_manager.h> #include <vespa/vespalib/test/insertion_operators.h> +#include <vespa/vespalib/testkit/testapp.h> +#include <vespa/config-imported-fields.h> +#include <vespa/log/log.h> LOG_SETUP("document_db_reference_resolver_test"); using namespace document; diff --git a/searchcore/src/tests/proton/reference/gid_to_lid_change_listener/gid_to_lid_change_listener_test.cpp b/searchcore/src/tests/proton/reference/gid_to_lid_change_listener/gid_to_lid_change_listener_test.cpp index e3b1fd3aa15..dd33e34efdd 100644 --- a/searchcore/src/tests/proton/reference/gid_to_lid_change_listener/gid_to_lid_change_listener_test.cpp +++ b/searchcore/src/tests/proton/reference/gid_to_lid_change_listener/gid_to_lid_change_listener_test.cpp @@ -57,7 +57,7 @@ struct Fixture std::unique_ptr<GidToLidChangeListener> _listener; Fixture() - : _attr(std::make_shared<ReferenceAttribute>("test", Config(BasicType::REFERENCE))), + : _attr(std::make_shared<ReferenceAttribute>("test")), _writer(vespalib::SequencedTaskExecutor::create(test_executor, 1)), _refCount(), _listener() diff --git a/searchcore/src/tests/proton/server/documentretriever_test.cpp b/searchcore/src/tests/proton/server/documentretriever_test.cpp index f5c163fefb5..bf277f86367 100644 --- a/searchcore/src/tests/proton/server/documentretriever_test.cpp +++ b/searchcore/src/tests/proton/server/documentretriever_test.cpp @@ -1,6 +1,21 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. // Unit tests for documentretriever. +#include <vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h> +#include <vespa/searchcore/proton/server/documentretriever.h> +#include <vespa/searchcore/proton/bucketdb/bucket_db_owner.h> +#include <vespa/searchcore/proton/test/dummy_document_store.h> +#include <vespa/searchlib/attribute/attributefactory.h> +#include <vespa/searchlib/attribute/attributeguard.h> +#include <vespa/searchlib/attribute/attributemanager.h> +#include <vespa/searchlib/attribute/floatbase.h> +#include <vespa/searchlib/attribute/integerbase.h> +#include <vespa/searchlib/attribute/predicate_attribute.h> +#include <vespa/searchlib/attribute/stringbase.h> +#include <vespa/searchlib/predicate/predicate_index.h> +#include <vespa/searchlib/tensor/tensor_attribute.h> +#include <vespa/searchcommon/attribute/config.h> +#include <vespa/searchcommon/common/schema.h> #include <vespa/document/base/documentid.h> #include <vespa/document/bucket/bucketid.h> #include <vespa/document/datatype/datatype.h> @@ -21,29 +36,15 @@ #include <vespa/document/repo/configbuilder.h> #include <vespa/document/repo/documenttyperepo.h> #include <vespa/document/test/fieldvalue_helpers.h> +#include <vespa/vespalib/geo/zcurve.h> +#include <vespa/vespalib/testkit/testapp.h> +#include <vespa/vespalib/util/stringfmt.h> #include <vespa/eval/eval/simple_value.h> #include <vespa/eval/eval/tensor_spec.h> #include <vespa/eval/eval/value.h> #include <vespa/eval/eval/test/value_compare.h> #include <vespa/persistence/spi/bucket.h> #include <vespa/persistence/spi/test.h> -#include <vespa/searchcommon/common/schema.h> -#include <vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h> -#include <vespa/searchcore/proton/server/documentretriever.h> -#include <vespa/searchcore/proton/bucketdb/bucket_db_owner.h> -#include <vespa/searchcore/proton/test/dummy_document_store.h> -#include <vespa/searchlib/attribute/attributefactory.h> -#include <vespa/searchlib/attribute/attributeguard.h> -#include <vespa/searchlib/attribute/attributemanager.h> -#include <vespa/searchlib/attribute/floatbase.h> -#include <vespa/searchlib/attribute/integerbase.h> -#include <vespa/searchlib/attribute/predicate_attribute.h> -#include <vespa/searchlib/attribute/stringbase.h> -#include <vespa/searchlib/predicate/predicate_index.h> -#include <vespa/searchlib/tensor/tensor_attribute.h> -#include <vespa/vespalib/geo/zcurve.h> -#include <vespa/vespalib/testkit/testapp.h> -#include <vespa/vespalib/util/stringfmt.h> #include <vespa/log/log.h> diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_aspect_delayer.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_aspect_delayer.cpp index 78603512d6b..6e935a577fd 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_aspect_delayer.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_aspect_delayer.cpp @@ -9,6 +9,7 @@ #include <vespa/searchcore/proton/common/i_document_type_inspector.h> #include <vespa/searchcore/proton/common/i_indexschema_inspector.h> #include <vespa/searchlib/attribute/configconverter.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/vespalib/stllike/hash_set.hpp> using search::attribute::isUpdateableInMemoryOnly; diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_manager_initializer.h b/searchcore/src/vespa/searchcore/proton/attribute/attribute_manager_initializer.h index cd2e044dee6..99b6b026f8f 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_manager_initializer.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_manager_initializer.h @@ -20,17 +20,17 @@ namespace proton { class AttributeManagerInitializer : public initializer::InitializerTask { private: - search::SerialNum _configSerialNum; - DocumentMetaStore::SP _documentMetaStore; - AttributeManager::SP _attrMgr; + search::SerialNum _configSerialNum; + DocumentMetaStore::SP _documentMetaStore; + AttributeManager::SP _attrMgr; vespa::config::search::AttributesConfig _attrCfg; - AllocStrategy _alloc_strategy; - bool _fastAccessAttributesOnly; - searchcorespi::index::IThreadService &_master; - InitializedAttributesResult _attributesResult; - std::shared_ptr<AttributeManager::SP> _attrMgrResult; + AllocStrategy _alloc_strategy; + bool _fastAccessAttributesOnly; + searchcorespi::index::IThreadService &_master; + InitializedAttributesResult _attributesResult; + std::shared_ptr<AttributeManager::SP> _attrMgrResult; - AttributeCollectionSpec::UP createAttributeSpec() const; + std::unique_ptr<AttributeCollectionSpec> createAttributeSpec() const; public: AttributeManagerInitializer(search::SerialNum configSerialNum, @@ -44,7 +44,7 @@ public: std::shared_ptr<AttributeManager::SP> attrMgrResult); ~AttributeManagerInitializer() override; - virtual void run() override; + void run() override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_populator.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_populator.cpp index 10e8947c38a..d47d2dd2877 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_populator.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_populator.cpp @@ -7,6 +7,7 @@ #include <vespa/vespalib/util/destructor_callbacks.h> #include <vespa/vespalib/util/gate.h> #include <vespa/searchlib/attribute/attributevector.h> +#include <cassert> #include <vespa/log/log.h> LOG_SETUP(".proton.attribute.attribute_populator"); diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp index 5f1a59584e4..bb25b3da7be 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp @@ -9,6 +9,7 @@ #include <vespa/document/fieldvalue/document.h> #include <vespa/document/update/assignvalueupdate.h> #include <vespa/searchcommon/attribute/attribute_utils.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/searchcore/proton/attribute/imported_attributes_repo.h> #include <vespa/searchcore/proton/common/attribute_updater.h> #include <vespa/searchlib/attribute/imported_attribute_vector.h> diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attributes_initializer_base.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attributes_initializer_base.cpp index cc330bc205c..7fcf541fd02 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attributes_initializer_base.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attributes_initializer_base.cpp @@ -3,7 +3,7 @@ #include "attributes_initializer_base.h" #include "attributemanager.h" #include <vespa/searchlib/attribute/attributevector.h> - +#include <cassert> namespace proton { void diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attributes_initializer_base.h b/searchcore/src/vespa/searchcore/proton/attribute/attributes_initializer_base.h index f249cf637dd..9da268fff21 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attributes_initializer_base.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/attributes_initializer_base.h @@ -4,6 +4,7 @@ #include "i_attribute_initializer_registry.h" #include "attribute_initializer_result.h" +#include <vector> namespace proton { diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attributesconfigscout.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attributesconfigscout.cpp index 7439421ea59..e21230a1d58 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attributesconfigscout.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attributesconfigscout.cpp @@ -3,6 +3,7 @@ #include "attributesconfigscout.h" #include "attribute_type_matcher.h" #include <vespa/searchlib/attribute/configconverter.h> +#include <vespa/searchcommon/attribute/config.h> using search::attribute::ConfigConverter; diff --git a/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.cpp b/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.cpp index d074025dc32..b455d8862b5 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.cpp @@ -11,6 +11,7 @@ #include <vespa/searchlib/common/serialnumfileheadercontext.h> #include <vespa/searchlib/attribute/attributememorysavetarget.h> #include <vespa/searchlib/attribute/attributevector.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/vespalib/util/isequencedtaskexecutor.h> #include <vespa/vespalib/util/stringfmt.h> #include <fstream> diff --git a/searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.cpp b/searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.cpp index 8555af7c685..f568e8ed702 100644 --- a/searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.cpp +++ b/searchcore/src/vespa/searchcore/proton/common/attributefieldvaluenode.cpp @@ -6,6 +6,7 @@ #include <vespa/searchlib/attribute/attributevector.h> #include <vespa/searchlib/attribute/attribute_read_guard.h> #include <vespa/vespalib/util/exceptions.h> +#include <cassert> #include <vespa/log/log.h> LOG_SETUP(".proton.common.attribute_field_value_node"); diff --git a/searchcore/src/vespa/searchcore/proton/common/cachedselect.cpp b/searchcore/src/vespa/searchcore/proton/common/cachedselect.cpp index 342975c7e9f..b0244c34a0f 100644 --- a/searchcore/src/vespa/searchcore/proton/common/cachedselect.cpp +++ b/searchcore/src/vespa/searchcore/proton/common/cachedselect.cpp @@ -9,6 +9,7 @@ #include <vespa/searchlib/attribute/attributevector.h> #include <vespa/searchlib/attribute/attribute_read_guard.h> #include <vespa/searchlib/attribute/iattributemanager.h> +#include <cassert> namespace proton { diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreattribute.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreattribute.cpp index 4999c93df8d..57c3159645b 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreattribute.cpp +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreattribute.cpp @@ -1,6 +1,7 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "documentmetastoreattribute.h" +#include <vespa/searchcommon/attribute/config.h> namespace proton { diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.cpp index e27bd8706e9..3be9282987c 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.cpp +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.cpp @@ -10,12 +10,15 @@ DocumentMetaStoreContext::ReadGuard::ReadGuard(const search::AttributeVector::SP { } +DocumentMetaStoreContext::DocumentMetaStoreContext(std::shared_ptr<bucketdb::BucketDBOwner> bucketDB) + : DocumentMetaStoreContext(std::move(bucketDB), DocumentMetaStore::getFixedName(), search::GrowStrategy()) +{} DocumentMetaStoreContext::DocumentMetaStoreContext(std::shared_ptr<bucketdb::BucketDBOwner> bucketDB, const vespalib::string &name, - const search::GrowStrategy &grow) : - _metaStoreAttr(std::make_shared<DocumentMetaStore>(std::move(bucketDB), name, grow)), - _metaStore(std::dynamic_pointer_cast<IDocumentMetaStore>(_metaStoreAttr)) + const search::GrowStrategy &grow) + : _metaStoreAttr(std::make_shared<DocumentMetaStore>(std::move(bucketDB), name, grow)), + _metaStore(std::dynamic_pointer_cast<IDocumentMetaStore>(_metaStoreAttr)) { } diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h index 6a07d6566cd..c4117f0b751 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastorecontext.h @@ -27,13 +27,14 @@ private: IDocumentMetaStore::SP _metaStore; public: + DocumentMetaStoreContext(std::shared_ptr<bucketdb::BucketDBOwner> bucketDB); /** * Create a new context instantiating a document meta store * with the given name, grow strategy, and comparator. */ DocumentMetaStoreContext(std::shared_ptr<bucketdb::BucketDBOwner> bucketDB, - const vespalib::string &name = DocumentMetaStore::getFixedName(), - const search::GrowStrategy &grow = search::GrowStrategy()); + const vespalib::string &name, + const search::GrowStrategy &grow); ~DocumentMetaStoreContext() override; /** * Create a new context with the given document meta store encapsulated diff --git a/searchcore/src/vespa/searchcore/proton/reprocessing/attribute_reprocessing_initializer.cpp b/searchcore/src/vespa/searchcore/proton/reprocessing/attribute_reprocessing_initializer.cpp index 8e5e457b80e..294294194f4 100644 --- a/searchcore/src/vespa/searchcore/proton/reprocessing/attribute_reprocessing_initializer.cpp +++ b/searchcore/src/vespa/searchcore/proton/reprocessing/attribute_reprocessing_initializer.cpp @@ -3,6 +3,7 @@ #include "attribute_reprocessing_initializer.h" #include <vespa/searchcore/proton/attribute/attribute_populator.h> #include <vespa/searchcommon/attribute/attribute_utils.h> +#include <vespa/searchcommon/attribute/config.h> #include <vespa/searchcore/proton/attribute/document_field_populator.h> #include <vespa/searchcore/proton/attribute/filter_attribute_manager.h> #include <vespa/searchcore/proton/common/i_indexschema_inspector.h> 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 51c2378789b..d29c71ea43c 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 @@ -91,7 +91,7 @@ protected: std::shared_ptr<search::attribute::Interlock> _attribute_interlock; DocIdLimit _docIdLimit; - AttributeCollectionSpec::UP createAttributeSpec(const AttributesConfig &attrCfg, const AllocStrategy& alloc_strategy, SerialNum serialNum) const; + std::unique_ptr<AttributeCollectionSpec> createAttributeSpec(const AttributesConfig &attrCfg, const AllocStrategy& alloc_strategy, SerialNum serialNum) const; AttributeManager::SP getAndResetInitAttributeManager(); virtual IFlushTargetList getFlushTargetsInternal() override; void reconfigureAttributeMetrics(const IAttributeManager &newMgr, const IAttributeManager &oldMgr); diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h index d694d92d0ad..178ed73aef5 100644 --- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h +++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.h @@ -15,6 +15,7 @@ #include <vespa/searchcore/proton/persistenceengine/i_document_retriever.h> #include <vespa/searchlib/common/fileheadercontext.h> #include <vespa/vespalib/util/varholder.h> +#include <vespa/vespalib/datastore/compaction_strategy.h> #include <mutex> namespace proton { |