aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@broadpark.no>2018-04-19 23:10:00 +0200
committerTor Egge <Tor.Egge@oath.com>2018-04-20 08:48:49 +0000
commitb438d5ef09ae94d0280e824e93196ae57ab97819 (patch)
tree14188629210c8e0d483fde2a04d7bd38984c0134 /searchcore/src
parent834ea7c148b0595a11189bc7450ebb63483cbef6 (diff)
Change AttributeContext to use makeReadGuard method on attribute vectors.
Diffstat (limited to 'searchcore/src')
-rw-r--r--searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp8
-rw-r--r--searchcore/src/tests/proton/common/cachedselect_test.cpp1
-rw-r--r--searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp1
-rw-r--r--searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp13
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/attributemanager.h3
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.cpp14
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.h2
8 files changed, 26 insertions, 18 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 6da1ff890c9..59393ac0a26 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
@@ -23,12 +23,12 @@ LOG_SETUP("attribute_manager_test");
#include <vespa/searchcore/proton/test/attribute_vectors.h>
#include <vespa/searchlib/attribute/attributefactory.h>
#include <vespa/searchlib/attribute/attributevector.hpp>
+#include <vespa/searchlib/attribute/attribute_read_guard.h>
#include <vespa/searchlib/attribute/imported_attribute_vector.h>
#include <vespa/searchlib/attribute/imported_attribute_vector_factory.h>
#include <vespa/searchlib/attribute/integerbase.h>
#include <vespa/searchlib/attribute/predicate_attribute.h>
#include <vespa/searchlib/attribute/reference_attribute.h>
-#include <vespa/searchlib/attribute/reference_attribute.h>
#include <vespa/searchlib/attribute/singlenumericattribute.hpp>
#include <vespa/searchlib/common/foregroundtaskexecutor.h>
#include <vespa/searchlib/common/indexmetainfo.h>
@@ -268,9 +268,9 @@ TEST_F("require that attributes are added", Fixture)
EXPECT_TRUE(f.addAttribute("a1").get() != NULL);
EXPECT_TRUE(f.addAttribute("a2").get() != NULL);
EXPECT_EQUAL("a1", (*f._m.getAttribute("a1"))->getName());
- EXPECT_EQUAL("a1", (*f._m.getAttributeStableEnum("a1"))->getName());
+ EXPECT_EQUAL("a1", (*f._m.getAttributeReadGuard("a1", true))->getName());
EXPECT_EQUAL("a2", (*f._m.getAttribute("a2"))->getName());
- EXPECT_EQUAL("a2", (*f._m.getAttributeStableEnum("a2"))->getName());
+ EXPECT_EQUAL("a2", (*f._m.getAttributeReadGuard("a2", true))->getName());
EXPECT_TRUE(!f._m.getAttribute("not")->valid());
}
@@ -279,7 +279,7 @@ TEST_F("require that predicate attributes are added", Fixture)
EXPECT_TRUE(f._m.addAttribute({"p1", AttributeUtils::getPredicateConfig()},
createSerialNum).get() != NULL);
EXPECT_EQUAL("p1", (*f._m.getAttribute("p1"))->getName());
- EXPECT_EQUAL("p1", (*f._m.getAttributeStableEnum("p1"))->getName());
+ EXPECT_EQUAL("p1", (*f._m.getAttributeReadGuard("p1", true))->getName());
}
TEST_F("require that attributes are flushed and loaded", BaseFixture)
diff --git a/searchcore/src/tests/proton/common/cachedselect_test.cpp b/searchcore/src/tests/proton/common/cachedselect_test.cpp
index 7c295486110..a955bd60cf8 100644
--- a/searchcore/src/tests/proton/common/cachedselect_test.cpp
+++ b/searchcore/src/tests/proton/common/cachedselect_test.cpp
@@ -48,7 +48,6 @@ using document::select::ResultSet;
using proton::CachedSelect;
using proton::SelectContext;
using search::AttributeContext;
-using search::AttributeEnumGuard;
using search::AttributeFactory;
using search::AttributeGuard;
using search::AttributePosting;
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 57bddd6aede..a7512b41f30 100644
--- a/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp
+++ b/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp
@@ -27,7 +27,6 @@ using document::Field;
using document::IntFieldValue;
using document::StringFieldValue;
using search::AttributeContext;
-using search::AttributeEnumGuard;
using search::AttributeGuard;
using search::AttributeVector;
using search::DocumentIdT;
diff --git a/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp b/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp
index 0f17577e789..9c8e2d63385 100644
--- a/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp
@@ -339,7 +339,7 @@ struct MyAttributeManager : public proton::IAttributeManager
virtual AttributeGuard::UP getAttribute(const string &) const override {
abort();
}
- virtual AttributeGuard::UP getAttributeStableEnum(const string &) const override {
+ virtual std::unique_ptr<search::attribute::AttributeReadGuard> getAttributeReadGuard(const string &, bool) const override {
abort();
}
virtual void getAttributeList(std::vector<AttributeGuard> &) const override {
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp
index f1c078bb598..b4f087c65c0 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp
+++ b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp
@@ -11,6 +11,7 @@
#include "flushableattribute.h"
#include <vespa/searchcore/proton/flushengine/shrink_lid_space_flush_target.h>
#include <vespa/searchlib/attribute/attributecontext.h>
+#include <vespa/searchlib/attribute/attribute_read_guard.h>
#include <vespa/searchlib/attribute/interlock.h>
#include <vespa/searchlib/common/isequencedtaskexecutor.h>
#include <vespa/searchlib/common/threaded_compactable_lid_space.h>
@@ -23,7 +24,6 @@
LOG_SETUP(".proton.attribute.attributemanager");
using search::AttributeContext;
-using search::AttributeEnumGuard;
using search::AttributeGuard;
using search::AttributeVector;
using search::common::ThreadedCompactableLidSpace;
@@ -402,10 +402,15 @@ AttributeManager::getAttribute(const vespalib::string &name) const
return AttributeGuard::UP(new AttributeGuard(findAttribute(name)));
}
-AttributeGuard::UP
-AttributeManager::getAttributeStableEnum(const vespalib::string &name) const
+std::unique_ptr<search::attribute::AttributeReadGuard>
+AttributeManager::getAttributeReadGuard(const string &name, bool stableEnumGuard) const
{
- return AttributeGuard::UP(new AttributeEnumGuard(findAttribute(name)));
+ auto attribute = findAttribute(name);
+ if (attribute) {
+ return attribute->makeReadGuard(stableEnumGuard);
+ } else {
+ return std::unique_ptr<search::attribute::AttributeReadGuard>();
+ }
}
void
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.h b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.h
index 7148815ca9e..b8f245d9c68 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.h
+++ b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.h
@@ -158,8 +158,7 @@ public:
// Implements search::IAttributeManager
virtual search::AttributeGuard::UP getAttribute(const vespalib::string &name) const override;
-
- virtual search::AttributeGuard::UP getAttributeStableEnum(const vespalib::string &name) const override;
+ virtual std::unique_ptr<search::attribute::AttributeReadGuard> getAttributeReadGuard(const string &name, bool stableEnumGuard) const override;
/**
* Fills all regular registered attributes (not extra attributes)
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.cpp b/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.cpp
index af64f47fc0a..d3a74bb9a98 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.cpp
+++ b/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.cpp
@@ -5,6 +5,7 @@
#include <vespa/searchlib/common/isequencedtaskexecutor.h>
#include <vespa/vespalib/util/exceptions.h>
#include <vespa/searchlib/attribute/attributevector.h>
+#include <vespa/searchlib/attribute/attribute_read_guard.h>
using search::AttributeGuard;
using searchcorespi::IFlushTarget;
@@ -70,10 +71,6 @@ FilterAttributeManager::FilterAttributeManager(const AttributeSet &acceptedAttri
FilterAttributeManager::~FilterAttributeManager() { }
-search::AttributeGuard::UP
-FilterAttributeManager::getAttributeStableEnum(const vespalib::string &) const {
- throw vespalib::IllegalArgumentException("Not implemented");
-}
search::attribute::IAttributeContext::UP
FilterAttributeManager::createContext() const {
throw vespalib::IllegalArgumentException("Not implemented");
@@ -133,6 +130,15 @@ FilterAttributeManager::getAttribute(const vespalib::string &name) const
return AttributeGuard::UP();
}
+std::unique_ptr<search::attribute::AttributeReadGuard>
+FilterAttributeManager::getAttributeReadGuard(const vespalib::string &name, bool stableEnumGuard) const
+{
+ if (acceptAttribute(name)) {
+ return _mgr->getAttributeReadGuard(name, stableEnumGuard);
+ }
+ return std::unique_ptr<search::attribute::AttributeReadGuard>();
+}
+
void
FilterAttributeManager::getAttributeList(std::vector<AttributeGuard> &list) const
{
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.h b/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.h
index 81fafa477ee..82f8107f92f 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.h
+++ b/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.h
@@ -35,8 +35,8 @@ public:
virtual search::AttributeGuard::UP getAttribute(const vespalib::string &name) const override;
virtual void getAttributeList(std::vector<search::AttributeGuard> &list) const override;
virtual search::SerialNum getFlushedSerialNum(const vespalib::string &name) const override;
- virtual search::AttributeGuard::UP getAttributeStableEnum(const vespalib::string &) const override;
virtual search::attribute::IAttributeContext::UP createContext() const override;
+ virtual std::unique_ptr<search::attribute::AttributeReadGuard> getAttributeReadGuard(const vespalib::string &name, bool stableEnumGuard) const override;
// Implements proton::IAttributeManager
virtual IAttributeManager::SP create(const AttributeCollectionSpec &) const override;