diff options
author | Tor Egge <Tor.Egge@online.no> | 2023-03-28 15:02:01 +0200 |
---|---|---|
committer | Tor Egge <Tor.Egge@online.no> | 2023-03-28 15:02:01 +0200 |
commit | 58af4b0ec491b0afb0f607af2966a1f93ae8c411 (patch) | |
tree | 4d606c06d5ef53eed8a228a0a967c300051f626d /searchcore/src/tests | |
parent | c2634969650aec3c3f3744fd2069a4b5b58945ca (diff) |
Explore attribute vector in writer thread.
Diffstat (limited to 'searchcore/src/tests')
5 files changed, 2 insertions, 77 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 c9f3a1c1de8..140012624c2 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 @@ -5,7 +5,6 @@ #include <vespa/searchcore/proton/attribute/attribute_manager_reconfig.h> #include <vespa/searchcore/proton/attribute/attribute_writer.h> #include <vespa/searchcore/proton/attribute/attributemanager.h> -#include <vespa/searchcore/proton/attribute/exclusive_attribute_read_accessor.h> #include <vespa/searchcore/proton/attribute/imported_attributes_repo.h> #include <vespa/searchcore/proton/attribute/sequential_attributes_initializer.h> #include <vespa/searchcore/proton/bucketdb/bucket_db_owner.h> @@ -755,15 +754,6 @@ TEST_F("require that we can call functions on all attributes via functor", EXPECT_EQUAL("a1,a2,a3", functor->getSortedNames()); } -TEST_F("require that we can acquire exclusive read access to attribute", Fixture) -{ - f.addAttribute("attr"); - ExclusiveAttributeReadAccessor::UP attrAccessor = f._m.getExclusiveReadAccessor("attr"); - ExclusiveAttributeReadAccessor::UP noneAccessor = f._m.getExclusiveReadAccessor("none"); - EXPECT_TRUE(attrAccessor.get() != nullptr); - EXPECT_TRUE(noneAccessor.get() == nullptr); -} - TEST_F("require that imported attributes are exposed via attribute context together with regular attributes", Fixture) { f.addAttribute("attr"); diff --git a/searchcore/src/tests/proton/attribute/attributes_state_explorer/attributes_state_explorer_test.cpp b/searchcore/src/tests/proton/attribute/attributes_state_explorer/attributes_state_explorer_test.cpp index bcd200cfd2f..aa4871d3a12 100644 --- a/searchcore/src/tests/proton/attribute/attributes_state_explorer/attributes_state_explorer_test.cpp +++ b/searchcore/src/tests/proton/attribute/attributes_state_explorer/attributes_state_explorer_test.cpp @@ -92,13 +92,13 @@ TEST_F(AttributesStateExplorerTest, require_that_attributes_are_exposed_as_child { StringVector children = _explorer.get_children_names(); std::sort(children.begin(), children.end()); - EXPECT_EQ(StringVector({"btree", "extra", "hash", "hybrid", "regular"}), children); + EXPECT_EQ(StringVector({"btree", "hash", "hybrid", "regular"}), children); } TEST_F(AttributesStateExplorerTest, require_that_attributes_are_explorable) { EXPECT_TRUE(_explorer.get_child("regular").get() != nullptr); - EXPECT_TRUE(_explorer.get_child("extra").get() != nullptr); + EXPECT_TRUE(_explorer.get_child("extra").get() == nullptr); EXPECT_TRUE(_explorer.get_child("not").get() == nullptr); } diff --git a/searchcore/src/tests/proton/attribute/exclusive_attribute_read_accessor/.gitignore b/searchcore/src/tests/proton/attribute/exclusive_attribute_read_accessor/.gitignore deleted file mode 100644 index f3666eecb6e..00000000000 --- a/searchcore/src/tests/proton/attribute/exclusive_attribute_read_accessor/.gitignore +++ /dev/null @@ -1 +0,0 @@ -searchcore_exclusive_attribute_read_accessor_test_app diff --git a/searchcore/src/tests/proton/attribute/exclusive_attribute_read_accessor/CMakeLists.txt b/searchcore/src/tests/proton/attribute/exclusive_attribute_read_accessor/CMakeLists.txt deleted file mode 100644 index 981d2acd7c5..00000000000 --- a/searchcore/src/tests/proton/attribute/exclusive_attribute_read_accessor/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -# Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -vespa_add_executable(searchcore_exclusive_attribute_read_accessor_test_app TEST - SOURCES - exclusive_attribute_read_accessor_test.cpp - DEPENDS - searchcore_attribute - searchcore_pcommon -) -vespa_add_test(NAME searchcore_exclusive_attribute_read_accessor_test_app COMMAND searchcore_exclusive_attribute_read_accessor_test_app) diff --git a/searchcore/src/tests/proton/attribute/exclusive_attribute_read_accessor/exclusive_attribute_read_accessor_test.cpp b/searchcore/src/tests/proton/attribute/exclusive_attribute_read_accessor/exclusive_attribute_read_accessor_test.cpp deleted file mode 100644 index 8b093be08b7..00000000000 --- a/searchcore/src/tests/proton/attribute/exclusive_attribute_read_accessor/exclusive_attribute_read_accessor_test.cpp +++ /dev/null @@ -1,55 +0,0 @@ -// 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/exclusive_attribute_read_accessor.h> -#include <vespa/searchcommon/attribute/config.h> -#include <vespa/searchlib/attribute/attributefactory.h> -#include <vespa/searchlib/attribute/attributevector.h> -#include <vespa/vespalib/util/sequencedtaskexecutor.h> -#include <vespa/vespalib/util/gate.h> - -using namespace proton; -using namespace search; -using namespace vespalib; - -using ReadGuard = ExclusiveAttributeReadAccessor::Guard; -VESPA_THREAD_STACK_TAG(test_executor) - -AttributeVector::SP -createAttribute() -{ - attribute::Config cfg(attribute::BasicType::INT32, attribute::CollectionType::SINGLE); - return search::AttributeFactory::createAttribute("myattr", cfg); -} - -struct Fixture -{ - AttributeVector::SP attribute; - std::unique_ptr<ISequencedTaskExecutor> writer; - ExclusiveAttributeReadAccessor accessor; - - Fixture() - : attribute(createAttribute()), - writer(SequencedTaskExecutor::create(test_executor, 1)), - accessor(attribute, *writer) - {} -}; - -TEST_F("require that attribute write thread is blocked while guard is held", Fixture) -{ - ReadGuard::UP guard = f.accessor.takeGuard(); - Gate gate; - f.writer->execute(f.writer->getExecutorIdFromName(f.attribute->getNamePrefix()), [&gate]() { gate.countDown(); }); - bool reachedZero = gate.await(100ms); - EXPECT_FALSE(reachedZero); - EXPECT_EQUAL(1u, gate.getCount()); - - guard.reset(); - gate.await(); - EXPECT_EQUAL(0u, gate.getCount()); -} - -TEST_MAIN() -{ - TEST_RUN_ALL(); -} |