summaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-11-08 23:20:32 +0100
committerGitHub <noreply@github.com>2020-11-08 23:20:32 +0100
commit434567d25d1ccecbabf193ce1692be718ca11ea0 (patch)
tree7d6faaf4e840d726bc0697da4b70cab33d6ac6b1 /searchcore
parent8e7d8d6750cf741ce94592f5b786b5cc68bce7b0 (diff)
parent7aa695db569e2821b50f1af373bc589c734ee1e7 (diff)
Merge pull request #15221 from vespa-engine/balder/compute-updateability-once
- Move utility methods from proton::attribute to search::attribute.
Diffstat (limited to 'searchcore')
-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_utils.cpp24
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/attribute_utils.h31
-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
7 files changed, 7 insertions, 65 deletions
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_utils.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_utils.cpp
deleted file mode 100644
index bb4ee1da781..00000000000
--- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_utils.cpp
+++ /dev/null
@@ -1,24 +0,0 @@
-// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#include "attribute_utils.h"
-#include <vespa/searchcommon/attribute/config.h>
-
-namespace proton::attribute {
-
-bool
-isUpdateableInMemoryOnly(const vespalib::string &attrName,
- const search::attribute::Config &cfg)
-{
- auto basicType = cfg.basicType().type();
- return ((basicType != search::attribute::BasicType::Type::PREDICATE) &&
- (basicType != search::attribute::BasicType::Type::REFERENCE)) &&
- !isStructFieldAttribute(attrName);
-}
-
-bool
-isStructFieldAttribute(const vespalib::string &attrName)
-{
- return attrName.find('.') != vespalib::string::npos;
-}
-
-}
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_utils.h b/searchcore/src/vespa/searchcore/proton/attribute/attribute_utils.h
deleted file mode 100644
index 49f6aba8775..00000000000
--- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_utils.h
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#pragma once
-
-#include <vespa/vespalib/stllike/string.h>
-
-namespace search::attribute { class Config; }
-
-namespace proton::attribute {
-
-/**
- * Returns whether the given attribute vector is updateable only in-memory.
- *
- * For most attributes this is true.
- * The data stored in the attribute is equal to the data stored in the field value in the document.
- *
- * For predicate and reference attributes this is false.
- * The original data is transformed (lossy) before it is stored in the attribute.
- * During update we also need to update the field value in the document.
- *
- * For struct field attributes this is false.
- * A struct field attribute typically represents a sub-field of a more complex field (e.g. map of struct or array of struct).
- * 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 isStructFieldAttribute(const vespalib::string &attrName);
-
-}
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp
index f129afc6347..42971fe3d4c 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)) {