diff options
author | Tor Egge <Tor.Egge@oath.com> | 2017-09-11 13:00:32 +0000 |
---|---|---|
committer | Tor Egge <Tor.Egge@oath.com> | 2017-09-11 13:00:32 +0000 |
commit | 5d131e88460f33a8bd16f39d5d57c1c690fd79f2 (patch) | |
tree | 44415dbc076bb8736ba7d56ee18d653f7b19213a /searchcore | |
parent | 608a89f6e3d0d6832f9854b2fc0d692fee4857f8 (diff) |
Keep a gid to lid mapper live during the lifetime of an imported attribute
read guard, to avoid premature reuse of referenced lid.
Diffstat (limited to 'searchcore')
2 files changed, 8 insertions, 1 deletions
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 5b64fa80d39..07af0d2ace5 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 @@ -35,6 +35,7 @@ LOG_SETUP("attribute_manager_test"); #include <vespa/searchlib/predicate/predicate_index.h> #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/searchlib/util/filekit.h> #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/threadstackexecutor.h> @@ -58,6 +59,7 @@ using search::attribute::IAttributeContext; using search::attribute::IAttributeVector; using search::attribute::ImportedAttributeVector; using search::attribute::ReferenceAttribute; +using search::attribute::test::MockGidToLidMapperFactory; using search::index::DummyFileHeaderContext; using search::predicate::PredicateIndex; using search::predicate::PredicateTreeAnnotations; @@ -132,6 +134,7 @@ struct ImportedAttributesRepoBuilder { ImportedAttributesRepoBuilder() : _repo(std::make_unique<ImportedAttributesRepo>()) {} void add(const vespalib::string &name) { auto refAttr = std::make_shared<ReferenceAttribute>(name + "_ref", AVConfig(BasicType::REFERENCE)); + refAttr->setGidToLidMapperFactory(std::make_shared<MockGidToLidMapperFactory>()); auto targetAttr = search::AttributeFactory::createAttribute(name + "_target", INT32_SINGLE); auto importedAttr = std::make_shared<ImportedAttributeVector>(name, refAttr, targetAttr, false); _repo->add(name, importedAttr); 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 d95d79fbd11..afbaabd9fc3 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 @@ -8,6 +8,7 @@ LOG_SETUP("imported_attributes_context_test"); #include <vespa/searchlib/attribute/attribute.h> #include <vespa/searchlib/attribute/attributefactory.h> #include <vespa/searchlib/attribute/imported_attribute_vector.h> +#include <vespa/searchlib/test/mock_gid_to_lid_mapping.h> #include <future> using namespace proton; @@ -17,12 +18,15 @@ using search::attribute::Config; using search::attribute::IAttributeVector; using search::attribute::ImportedAttributeVector; using search::attribute::ReferenceAttribute; +using search::attribute::test::MockGidToLidMapperFactory; using generation_t = AttributeVector::generation_t; ReferenceAttribute::SP createReferenceAttribute(const vespalib::string &name) { - return std::make_shared<ReferenceAttribute>(name, Config(BasicType::REFERENCE)); + auto refAttr = std::make_shared<ReferenceAttribute>(name, Config(BasicType::REFERENCE)); + refAttr->setGidToLidMapperFactory(std::make_shared<MockGidToLidMapperFactory>()); + return refAttr; } AttributeVector::SP |