summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-11-08 14:57:40 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2020-11-08 15:00:32 +0000
commit7aa695db569e2821b50f1af373bc589c734ee1e7 (patch)
treedd98abc7aca57e9074821661a3a98dbdbe051010
parent81f33dd36a90bcef7be8a88021a820526b093c06 (diff)
- Move utility methods from proton::attribute to search::attribute.
- Compute isUpdateableInmemoryOnly once.
-rw-r--r--searchcommon/src/vespa/searchcommon/attribute/CMakeLists.txt1
-rw-r--r--searchcommon/src/vespa/searchcommon/attribute/attribute_utils.cpp (renamed from searchcore/src/vespa/searchcore/proton/attribute/attribute_utils.cpp)9
-rw-r--r--searchcommon/src/vespa/searchcommon/attribute/attribute_utils.h (renamed from searchcore/src/vespa/searchcore/proton/attribute/attribute_utils.h)7
-rw-r--r--searchcommon/src/vespa/searchcommon/attribute/iattributevector.h2
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/CMakeLists.txt1
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/attribute_aspect_delayer.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/reprocessing/attribute_reprocessing_initializer.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp4
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attributevector.cpp6
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attributevector.h4
11 files changed, 22 insertions, 24 deletions
diff --git a/searchcommon/src/vespa/searchcommon/attribute/CMakeLists.txt b/searchcommon/src/vespa/searchcommon/attribute/CMakeLists.txt
index 8ceb3c76438..0ab126147a6 100644
--- a/searchcommon/src/vespa/searchcommon/attribute/CMakeLists.txt
+++ b/searchcommon/src/vespa/searchcommon/attribute/CMakeLists.txt
@@ -1,6 +1,7 @@
# Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
vespa_add_library(searchcommon_searchcommon_attribute OBJECT
SOURCES
+ attribute_utils.cpp
basictype.cpp
collectiontype.cpp
config.cpp
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_utils.cpp b/searchcommon/src/vespa/searchcommon/attribute/attribute_utils.cpp
index bb4ee1da781..7c15d7bbc14 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_utils.cpp
+++ b/searchcommon/src/vespa/searchcommon/attribute/attribute_utils.cpp
@@ -3,15 +3,14 @@
#include "attribute_utils.h"
#include <vespa/searchcommon/attribute/config.h>
-namespace proton::attribute {
+namespace search::attribute {
bool
-isUpdateableInMemoryOnly(const vespalib::string &attrName,
- const search::attribute::Config &cfg)
+isUpdateableInMemoryOnly(const vespalib::string &attrName, const Config &cfg)
{
auto basicType = cfg.basicType().type();
- return ((basicType != search::attribute::BasicType::Type::PREDICATE) &&
- (basicType != search::attribute::BasicType::Type::REFERENCE)) &&
+ return ((basicType != BasicType::Type::PREDICATE) &&
+ (basicType != BasicType::Type::REFERENCE)) &&
!isStructFieldAttribute(attrName);
}
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_utils.h b/searchcommon/src/vespa/searchcommon/attribute/attribute_utils.h
index 49f6aba8775..f87da30942d 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_utils.h
+++ b/searchcommon/src/vespa/searchcommon/attribute/attribute_utils.h
@@ -4,9 +4,9 @@
#include <vespa/vespalib/stllike/string.h>
-namespace search::attribute { class Config; }
+namespace search::attribute {
-namespace proton::attribute {
+class Config;
/**
* Returns whether the given attribute vector is updateable only in-memory.
@@ -23,8 +23,7 @@ namespace proton::attribute {
* During update the complex field is first updated in the document,
* then the struct field attribute is updated based on the new content of the complex field.
*/
-bool isUpdateableInMemoryOnly(const vespalib::string &attrName,
- const search::attribute::Config &cfg);
+bool isUpdateableInMemoryOnly(const vespalib::string &attrName, const Config &cfg);
bool isStructFieldAttribute(const vespalib::string &attrName);
diff --git a/searchcommon/src/vespa/searchcommon/attribute/iattributevector.h b/searchcommon/src/vespa/searchcommon/attribute/iattributevector.h
index c26906ac7c0..cc01d1d95e1 100644
--- a/searchcommon/src/vespa/searchcommon/attribute/iattributevector.h
+++ b/searchcommon/src/vespa/searchcommon/attribute/iattributevector.h
@@ -431,7 +431,7 @@ public:
/**
* Virtual destructor to allow safe subclassing.
**/
- virtual ~IAttributeVector() {}
+ virtual ~IAttributeVector() = default;
/**
* This method is used to simulate sparseness in the single value attributes.
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/CMakeLists.txt b/searchcore/src/vespa/searchcore/proton/attribute/CMakeLists.txt
index c20f279503f..fe9798b5841 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/CMakeLists.txt
+++ b/searchcore/src/vespa/searchcore/proton/attribute/CMakeLists.txt
@@ -20,7 +20,6 @@ vespa_add_library(searchcore_attribute STATIC
attribute_usage_sampler_context.cpp
attribute_usage_sampler_functor.cpp
attribute_usage_stats.cpp
- attribute_utils.cpp
attribute_vector_explorer.cpp
attribute_writer.cpp
attributes_initializer_base.cpp
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 a8eed94aab2..55962696492 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_aspect_delayer.cpp
+++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_aspect_delayer.cpp
@@ -4,14 +4,14 @@
#include <vespa/config-attributes.h>
#include <vespa/config-summary.h>
#include <vespa/config-summarymap.h>
-#include <vespa/searchcore/proton/attribute/attribute_utils.h>
+#include <vespa/searchcommon/attribute/attribute_utils.h>
#include <vespa/searchcore/proton/common/config_hash.hpp>
#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/vespalib/stllike/hash_set.hpp>
-using proton::attribute::isUpdateableInMemoryOnly;
+using search::attribute::isUpdateableInMemoryOnly;
using search::attribute::BasicType;
using search::attribute::ConfigConverter;
using vespa::config::search::AttributesConfig;
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp
index 2b859c17931..53a9ea64de8 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp
+++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp
@@ -7,12 +7,12 @@
#include <vespa/document/base/exceptions.h>
#include <vespa/document/datatype/documenttype.h>
#include <vespa/document/fieldvalue/document.h>
-#include <vespa/searchcore/proton/attribute/attribute_utils.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>
#include <vespa/searchlib/common/idestructorcallback.h>
#include <vespa/searchlib/tensor/prepare_result.h>
+#include <vespa/searchcommon/attribute/attribute_utils.h>
#include <vespa/vespalib/stllike/hash_map.hpp>
#include <vespa/vespalib/util/threadexecutor.h>
#include <future>
@@ -56,7 +56,7 @@ AttributeWriter::WriteField::WriteField(AttributeVector &attribute)
_use_two_phase_put(use_two_phase_put_for_attribute(attribute))
{
const vespalib::string &name = attribute.getName();
- _structFieldAttribute = attribute::isStructFieldAttribute(name);
+ _structFieldAttribute = search::attribute::isStructFieldAttribute(name);
}
AttributeWriter::WriteField::~WriteField() = default;
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 e939b07c26b..1a273306c07 100644
--- a/searchcore/src/vespa/searchcore/proton/reprocessing/attribute_reprocessing_initializer.cpp
+++ b/searchcore/src/vespa/searchcore/proton/reprocessing/attribute_reprocessing_initializer.cpp
@@ -2,7 +2,7 @@
#include "attribute_reprocessing_initializer.h"
#include <vespa/searchcore/proton/attribute/attribute_populator.h>
-#include <vespa/searchcore/proton/attribute/attribute_utils.h>
+#include <vespa/searchcommon/attribute/attribute_utils.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>
@@ -12,7 +12,7 @@
LOG_SETUP(".proton.reprocessing.attribute_reprocessing_initializer");
using namespace search::index;
-using proton::attribute::isUpdateableInMemoryOnly;
+using search::attribute::isUpdateableInMemoryOnly;
using search::AttributeGuard;
using search::AttributeVector;
using search::SerialNum;
diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp b/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp
index 72eed56415e..bf357188766 100644
--- a/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/storeonlyfeedview.cpp
@@ -11,7 +11,6 @@
#include <vespa/document/datatype/documenttype.h>
#include <vespa/document/fieldvalue/document.h>
#include <vespa/document/repo/documenttyperepo.h>
-#include <vespa/searchcore/proton/attribute/attribute_utils.h>
#include <vespa/searchcore/proton/attribute/ifieldupdatecallback.h>
#include <vespa/searchcore/proton/common/feedtoken.h>
#include <vespa/searchcore/proton/feedoperation/operations.h>
@@ -29,7 +28,6 @@ using document::DocumentId;
using document::GlobalId;
using document::DocumentTypeRepo;
using document::DocumentUpdate;
-using proton::attribute::isUpdateableInMemoryOnly;
using search::IDestructorCallback;
using search::SerialNum;
using search::index::Schema;
@@ -418,7 +416,7 @@ StoreOnlyFeedView::UpdateScope::UpdateScope(const search::index::Schema & schema
void
StoreOnlyFeedView::UpdateScope::onUpdateField(vespalib::stringref fieldName, const search::AttributeVector * attr) {
- if (!_nonAttributeFields && (attr == nullptr || !isUpdateableInMemoryOnly(attr->getName(), attr->getConfig()))) {
+ if (!_nonAttributeFields && (attr == nullptr || !attr->isUpdateableInMemoryOnly())) {
_nonAttributeFields = true;
}
if (!_indexedFields && _schema->isIndexField(fieldName)) {
diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.cpp b/searchlib/src/vespa/searchlib/attribute/attributevector.cpp
index dbd5690093b..2bcdbc8ecbf 100644
--- a/searchlib/src/vespa/searchlib/attribute/attributevector.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/attributevector.cpp
@@ -16,12 +16,11 @@
#include <vespa/fastlib/io/bufferedfile.h>
#include <vespa/searchlib/common/tunefileinfo.h>
#include <vespa/searchlib/index/dummyfileheadercontext.h>
-#include <vespa/searchlib/parsequery/stackdumpiterator.h>
-#include <vespa/searchlib/query/query_term_simple.h>
#include <vespa/searchlib/query/query_term_decoder.h>
#include <vespa/searchlib/queryeval/emptysearch.h>
#include <vespa/vespalib/util/exceptions.h>
#include <vespa/searchlib/util/logutil.h>
+#include <vespa/searchcommon/attribute/attribute_utils.h>
#include <vespa/log/log.h>
LOG_SETUP(".searchlib.attribute.attributevector");
@@ -129,7 +128,8 @@ AttributeVector::AttributeVector(vespalib::stringref baseFileName, const Config
_createSerialNum(0u),
_compactLidSpaceGeneration(0u),
_hasEnum(false),
- _loaded(false)
+ _loaded(false),
+ _isUpdateableInMemoryOnly(attribute::isUpdateableInMemoryOnly(getName(), getConfig()))
{
}
diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.h b/searchlib/src/vespa/searchlib/attribute/attributevector.h
index d8bdda911fd..4fc6589850e 100644
--- a/searchlib/src/vespa/searchlib/attribute/attributevector.h
+++ b/searchlib/src/vespa/searchlib/attribute/attributevector.h
@@ -397,6 +397,7 @@ public:
CollectionType getInternalCollectionType() const { return _config.collectionType(); }
const BaseName & getBaseFileName() const { return _baseFileName; }
void setBaseFileName(vespalib::stringref name) { _baseFileName = name; }
+ bool isUpdateableInMemoryOnly() const { return _isUpdateableInMemoryOnly; }
const vespalib::string & getName() const override final { return _baseFileName.getAttributeName(); }
@@ -575,7 +576,7 @@ private:
BaseName _baseFileName;
Config _config;
std::shared_ptr<attribute::Interlock> _interlock;
- mutable std::shared_mutex _enumLock;
+ mutable std::shared_mutex _enumLock;
GenerationHandler _genHandler;
GenerationHolder _genHolder;
Status _status;
@@ -587,6 +588,7 @@ private:
uint64_t _compactLidSpaceGeneration;
bool _hasEnum;
bool _loaded;
+ bool _isUpdateableInMemoryOnly;
vespalib::steady_time _nextStatUpdateTime;
////// Locking strategy interface. only available from the Guards.