diff options
24 files changed, 81 insertions, 107 deletions
diff --git a/container-disc/src/main/sh/vespa-start-container-daemon.sh b/container-disc/src/main/sh/vespa-start-container-daemon.sh index da7e270890d..8c122d3170e 100755 --- a/container-disc/src/main/sh/vespa-start-container-daemon.sh +++ b/container-disc/src/main/sh/vespa-start-container-daemon.sh @@ -128,7 +128,15 @@ configure_memory() { if ((jvm_heapSizeAsPercentageOfPhysicalMemory > 0)); then available=`free -m | grep Mem | tr -s ' ' | cut -f2 -d' '` if hash cgget 2>/dev/null; then + # TODO: Create vespa_cgget for this and remove dependency on libcgroup-tools available_cgroup_bytes=$(cgget -nv -r memory.limit_in_bytes /) + if [ $? -ne 0 ]; then + available_cgroup_bytes=$(vespa_cg2get memory.max) + # If command failed or returned value is 'max' assign a big value (default in CGroup v1) + if ! [[ "$available_cgroup_bytes" =~ ^[0-9]+$ ]]; then + available_cgroup_bytes=$(((1 << 63) -1)) + fi + fi available_cgroup=$((available_cgroup_bytes >> 20)) available=$((available > available_cgroup ? available_cgroup : available)) fi diff --git a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/MetricsReporter.java b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/MetricsReporter.java index 725e3fccec5..874e9cbe2c5 100644 --- a/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/MetricsReporter.java +++ b/node-repository/src/main/java/com/yahoo/vespa/hosted/provision/maintenance/MetricsReporter.java @@ -369,6 +369,8 @@ public class MetricsReporter extends NodeRepositoryMaintainer { static Map<String, String> dimensions(ApplicationId application, ClusterSpec.Id cluster) { Map<String, String> dimensions = new HashMap<>(dimensions(application)); + //TODO: Remove "clusterId" once internal aggregation uses "clusterid" + dimensions.put("clusterid", cluster.value()); dimensions.put("clusterId", cluster.value()); return dimensions; } diff --git a/searchcommon/src/vespa/searchcommon/common/undefinedvalues.h b/searchcommon/src/vespa/searchcommon/common/undefinedvalues.h index 3d545eeb603..bbe3198a8dc 100644 --- a/searchcommon/src/vespa/searchcommon/common/undefinedvalues.h +++ b/searchcommon/src/vespa/searchcommon/common/undefinedvalues.h @@ -6,8 +6,7 @@ #include <limits> #include <vespa/vespalib/stllike/string.h> -namespace search { -namespace attribute { +namespace search::attribute { // for all integers template <typename T> @@ -68,5 +67,3 @@ inline bool isUndefined<vespalib::string>(const vespalib::string & value) { } } -} - diff --git a/searchcore/src/vespa/searchcore/proton/test/bucketstatecalculator.h b/searchcore/src/vespa/searchcore/proton/test/bucketstatecalculator.h index 92230aac8d6..a5a0185d787 100644 --- a/searchcore/src/vespa/searchcore/proton/test/bucketstatecalculator.h +++ b/searchcore/src/vespa/searchcore/proton/test/bucketstatecalculator.h @@ -4,6 +4,7 @@ #include <vespa/searchcore/proton/server/ibucketstatecalculator.h> #include <vespa/document/bucket/bucketidlist.h> #include <vespa/document/bucket/bucket.h> +#include <set> namespace proton::test { diff --git a/searchlib/src/tests/attribute/attribute_operation/attribute_operation_test.cpp b/searchlib/src/tests/attribute/attribute_operation/attribute_operation_test.cpp index a57469e2bd1..baecb54fbec 100644 --- a/searchlib/src/tests/attribute/attribute_operation/attribute_operation_test.cpp +++ b/searchlib/src/tests/attribute/attribute_operation/attribute_operation_test.cpp @@ -47,15 +47,18 @@ TEST("test illegal operations on float attribute") { AttributeVector::SP createAttribute(BasicType basicType, const vespalib::string &fieldName, bool fastSearch = false, bool immutable = false) { + constexpr size_t NUM_DOCS = 20; Config cfg(basicType, CollectionType::SINGLE); cfg.setMutable(!immutable) .setFastSearch(fastSearch); auto av = search::AttributeFactory::createAttribute(fieldName, cfg); - while (20 >= av->getNumDocs()) { + while (NUM_DOCS >= av->getNumDocs()) { AttributeVector::DocId checkDocId(0u); ASSERT_TRUE(av->addDoc(checkDocId)); + ASSERT_EQUAL(immutable, av->isUndefined(checkDocId)); } av->commit(); + ASSERT_EQUAL(immutable, av->isUndefined(NUM_DOCS/2)); return av; } diff --git a/searchlib/src/tests/attribute/attribute_test.cpp b/searchlib/src/tests/attribute/attribute_test.cpp index 6ee97595b79..bd84a6ca419 100644 --- a/searchlib/src/tests/attribute/attribute_test.cpp +++ b/searchlib/src/tests/attribute/attribute_test.cpp @@ -2061,12 +2061,12 @@ AttributeTest::testCompactLidSpace() namespace { uint32_t -get_default_value_ref_count(AttributeVector &attr) +get_default_value_ref_count(AttributeVector &attr, int32_t defaultValue) { auto *enum_store_base = attr.getEnumStoreBase(); auto &enum_store = dynamic_cast<EnumStoreT<int32_t> &>(*enum_store_base); IAttributeVector::EnumHandle default_value_handle(0); - if (enum_store.find_enum(attr.getDefaultValue(), default_value_handle)) { + if (enum_store.find_enum(defaultValue, default_value_handle)) { vespalib::datastore::EntryRef default_value_ref(default_value_handle); assert(default_value_ref.valid()); return enum_store.get_ref_count(default_value_ref); @@ -2085,14 +2085,15 @@ AttributeTest::test_default_value_ref_count_is_updated_after_shrink_lid_space() cfg.setFastSearch(true); vespalib::string name = "shrink"; AttributePtr attr = AttributeFactory::createAttribute(name, cfg); + const auto & iattr = dynamic_cast<const search::IntegerAttributeTemplate<int32_t> &>(*attr); attr->addReservedDoc(); attr->addDocs(10); - EXPECT_EQUAL(11u, get_default_value_ref_count(*attr)); + EXPECT_EQUAL(11u, get_default_value_ref_count(*attr, iattr.defaultValue())); attr->compactLidSpace(6); - EXPECT_EQUAL(11u, get_default_value_ref_count(*attr)); + EXPECT_EQUAL(11u, get_default_value_ref_count(*attr, iattr.defaultValue())); attr->shrinkLidSpace(); EXPECT_EQUAL(6u, attr->getNumDocs()); - EXPECT_EQUAL(6u, get_default_value_ref_count(*attr)); + EXPECT_EQUAL(6u, get_default_value_ref_count(*attr, iattr.defaultValue())); } template <typename AttributeType> diff --git a/searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp b/searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp index 4240d68a0f0..4076194542a 100644 --- a/searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp +++ b/searchlib/src/tests/attribute/searchcontext/searchcontext_test.cpp @@ -19,6 +19,7 @@ #include <vespa/vespalib/testkit/testapp.h> #include <vespa/vespalib/util/compress.h> #include <vespa/vespalib/util/stringfmt.h> +#include <set> #include <vespa/log/log.h> LOG_SETUP("searchcontext_test"); diff --git a/searchlib/src/vespa/searchlib/attribute/attributemanager.cpp b/searchlib/src/vespa/searchlib/attribute/attributemanager.cpp index ce841fefd99..5aabad6fa02 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributemanager.cpp +++ b/searchlib/src/vespa/searchlib/attribute/attributemanager.cpp @@ -9,6 +9,7 @@ #include <vespa/vespalib/stllike/hash_map.hpp> #include <vespa/vespalib/util/exceptions.h> #include <condition_variable> +#include <set> #include <vespa/log/log.h> LOG_SETUP(".searchlib.attributemanager"); diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.h b/searchlib/src/vespa/searchlib/attribute/attributevector.h index f5a79c3637e..90d08fa681c 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributevector.h +++ b/searchlib/src/vespa/searchlib/attribute/attributevector.h @@ -460,7 +460,6 @@ public: */ virtual uint32_t clearDoc(DocId doc) = 0; - virtual largeint_t getDefaultValue() const = 0; // Implements IAttributeVector virtual uint32_t get(DocId doc, EnumHandle *v, uint32_t sz) const override = 0; diff --git a/searchlib/src/vespa/searchlib/attribute/enumattribute.h b/searchlib/src/vespa/searchlib/attribute/enumattribute.h index 82577e7a301..8136e654152 100644 --- a/searchlib/src/vespa/searchlib/attribute/enumattribute.h +++ b/searchlib/src/vespa/searchlib/attribute/enumattribute.h @@ -9,17 +9,9 @@ namespace search { -namespace attribute { - -template <typename, typename, typename > class PostingSearchContext; - -} - template <typename B> class EnumAttribute : public B { - template <typename, typename, typename> - friend class attribute::PostingSearchContext; // getEnumStore() protected: using BaseClass = B; using Change = typename B::Change; @@ -36,7 +28,6 @@ public: protected: using generation_t = typename B::generation_t; using B::getGenerationHolder; - using B::getStatus; public: using EnumStore = EnumStoreT<EnumEntryType>; @@ -55,7 +46,7 @@ protected: void load_enum_store(LoadedVector& loaded) override; uint64_t getUniqueValueCount() const override; - static EnumEntryType getDefaultEnumTypeValue() { return B::defaultValue(); } + EnumEntryType getDefaultEnumTypeValue() { return B::defaultValue(); } /* * Iterate through the change vector and find new unique values. @@ -71,7 +62,6 @@ public: bool findEnum(EnumEntryType v, EnumHandle & e) const override { return _enumStore.find_enum(v, e); } const EnumStore & getEnumStore() const { return _enumStore; } EnumStore & getEnumStore() { return _enumStore; } - }; } // namespace search diff --git a/searchlib/src/vespa/searchlib/attribute/floatbase.h b/searchlib/src/vespa/searchlib/attribute/floatbase.h index 968e7b87f6b..8db89535ebf 100644 --- a/searchlib/src/vespa/searchlib/attribute/floatbase.h +++ b/searchlib/src/vespa/searchlib/attribute/floatbase.h @@ -43,7 +43,6 @@ private: uint32_t get(DocId doc, const char ** v, uint32_t sz) const override; uint32_t get(DocId doc, WeightedString * v, uint32_t sz) const override; uint32_t get(DocId doc, WeightedConstChar * v, uint32_t sz) const override; - virtual double getFloatFromEnum(EnumHandle e) const = 0; }; template<typename T> @@ -65,24 +64,22 @@ public: virtual uint32_t getRawValues(DocId doc, const multivalue::WeightedValue<T> * & values) const; virtual T get(DocId doc) const = 0; virtual T getFromEnum(EnumHandle e) const = 0; + T defaultValue() const { return getConfig().isMutable() ? 0.0 : attribute::getUndefined<T>(); } protected: FloatingPointAttributeTemplate(const vespalib::string & name); FloatingPointAttributeTemplate(const vespalib::string & name, const Config & c); - ~FloatingPointAttributeTemplate(); - static T defaultValue() { return attribute::getUndefined<T>(); } + ~FloatingPointAttributeTemplate() override; virtual bool findEnum(T v, EnumHandle & e) const = 0; virtual void load_enum_store(LoadedVector&) {} virtual void fillValues(LoadedVector &) {} virtual void load_posting_lists(LoadedVector&) {} - largeint_t getDefaultValue() const override { return static_cast<largeint_t>(-std::numeric_limits<T>::max()); } - Change _defaultValue; + const Change _defaultValue; private: bool findEnum(const char *value, EnumHandle &e) const override; std::vector<EnumHandle> findFoldedEnums(const char *value) const override; bool isUndefined(DocId doc) const override; - double getFloatFromEnum(EnumHandle e) const override; long onSerializeForAscendingSort(DocId doc, void * serTo, long available, const common::BlobConverter * bc) const override; long onSerializeForDescendingSort(DocId doc, void * serTo, long available, const common::BlobConverter * bc) const override; }; diff --git a/searchlib/src/vespa/searchlib/attribute/floatbase.hpp b/searchlib/src/vespa/searchlib/attribute/floatbase.hpp index 2d878f38464..d3cf291849b 100644 --- a/searchlib/src/vespa/searchlib/attribute/floatbase.hpp +++ b/searchlib/src/vespa/searchlib/attribute/floatbase.hpp @@ -19,21 +19,20 @@ FloatingPointAttributeTemplate<T>::getRawValues(DocId, const multivalue::Weighte } template<typename T> -FloatingPointAttributeTemplate<T>::FloatingPointAttributeTemplate(const vespalib::string & name) : - FloatingPointAttribute(name, BasicType::fromType(T())), - _defaultValue(ChangeBase::UPDATE, 0, attribute::getUndefined<T>()) +FloatingPointAttributeTemplate<T>::FloatingPointAttributeTemplate(const vespalib::string & name) + : FloatingPointAttributeTemplate(name, BasicType::fromType(T())) { } template<typename T> -FloatingPointAttributeTemplate<T>::FloatingPointAttributeTemplate(const vespalib::string & name, const Config & c) : - FloatingPointAttribute(name, c), - _defaultValue(ChangeBase::UPDATE, 0, attribute::getUndefined<T>()) +FloatingPointAttributeTemplate<T>::FloatingPointAttributeTemplate(const vespalib::string & name, const Config & c) + : FloatingPointAttribute(name, c), + _defaultValue(ChangeBase::UPDATE, 0, defaultValue()) { assert(c.basicType() == BasicType::fromType(T())); } template<typename T> -FloatingPointAttributeTemplate<T>::~FloatingPointAttributeTemplate() { } +FloatingPointAttributeTemplate<T>::~FloatingPointAttributeTemplate() = default; template<typename T> bool @@ -66,12 +65,6 @@ FloatingPointAttributeTemplate<T>::isUndefined(DocId doc) const { } template<typename T> -double -FloatingPointAttributeTemplate<T>::getFloatFromEnum(EnumHandle e) const { - return getFromEnum(e); -} - -template<typename T> long FloatingPointAttributeTemplate<T>::onSerializeForAscendingSort(DocId doc, void * serTo, long available, const common::BlobConverter * bc) const { (void) bc; diff --git a/searchlib/src/vespa/searchlib/attribute/i_enum_store.h b/searchlib/src/vespa/searchlib/attribute/i_enum_store.h index 958e61f6370..1f3165828bc 100644 --- a/searchlib/src/vespa/searchlib/attribute/i_enum_store.h +++ b/searchlib/src/vespa/searchlib/attribute/i_enum_store.h @@ -4,14 +4,9 @@ #include "enum_store_loaders.h" #include "enum_store_types.h" -#include <vespa/searchcommon/attribute/iattributevector.h> #include <vespa/vespalib/datastore/entryref.h> #include <vespa/vespalib/datastore/unique_store_enumerator.h> -#include <vespa/vespalib/stllike/hash_map.h> -#include <vespa/vespalib/util/array.h> #include <vespa/vespalib/util/memoryusage.h> -#include <cassert> -#include <set> namespace vespalib::datastore { diff --git a/searchlib/src/vespa/searchlib/attribute/integerbase.h b/searchlib/src/vespa/searchlib/attribute/integerbase.h index c4a2035b200..50a3f314795 100644 --- a/searchlib/src/vespa/searchlib/attribute/integerbase.h +++ b/searchlib/src/vespa/searchlib/attribute/integerbase.h @@ -42,7 +42,6 @@ private: uint32_t get(DocId doc, const char ** v, uint32_t sz) const override; uint32_t get(DocId doc, WeightedString * v, uint32_t sz) const override; uint32_t get(DocId doc, WeightedConstChar * v, uint32_t sz) const override; - virtual largeint_t getIntFromEnum(EnumHandle e) const = 0; }; template<typename T> @@ -63,39 +62,23 @@ public: virtual uint32_t getRawValues(DocId doc, const multivalue::WeightedValue<T> * & values) const; virtual T get(DocId doc) const = 0; virtual T getFromEnum(EnumHandle e) const = 0; + T defaultValue() const { return getConfig().isMutable() ? 0 : attribute::getUndefined<T>(); } protected: - IntegerAttributeTemplate(const vespalib::string & name) : - IntegerAttribute(name, BasicType::fromType(T())), - _defaultValue(ChangeBase::UPDATE, 0, defaultValue()) - { } - IntegerAttributeTemplate(const vespalib::string & name, const Config & c) : - IntegerAttribute(name, c), - _defaultValue(ChangeBase::UPDATE, 0, defaultValue()) - { - assert(c.basicType() == BasicType::fromType(T())); - } - IntegerAttributeTemplate(const vespalib::string & name, const Config & c, const BasicType &realType) - : IntegerAttribute(name, c), - _defaultValue(ChangeBase::UPDATE, 0, 0u) - { - assert(c.basicType() == realType); - (void) realType; - assert(BasicType::fromType(T()) == BasicType::INT8); - } - static T defaultValue() { return attribute::getUndefined<T>(); } + IntegerAttributeTemplate(const vespalib::string & name); + IntegerAttributeTemplate(const vespalib::string & name, const Config & c); + IntegerAttributeTemplate(const vespalib::string & name, const Config & c, const BasicType &realType); + ~IntegerAttributeTemplate() override; virtual bool findEnum(T v, EnumHandle & e) const = 0; virtual void load_enum_store(LoadedVector&) {} virtual void fillValues(LoadedVector &) {} virtual void load_posting_lists(LoadedVector&) {} - largeint_t getDefaultValue() const override { return defaultValue(); } - bool isUndefined(DocId doc) const override { return get(doc) == defaultValue(); } - Change _defaultValue; + bool isUndefined(DocId doc) const override { return get(doc) == attribute::getUndefined<T>(); } + const Change _defaultValue; private: bool findEnum(const char *value, EnumHandle &e) const override; std::vector<EnumHandle> findFoldedEnums(const char *value) const override; - largeint_t getIntFromEnum(EnumHandle e) const override; long onSerializeForAscendingSort(DocId doc, void * serTo, long available, const common::BlobConverter * bc) const override; long onSerializeForDescendingSort(DocId doc, void * serTo, long available, const common::BlobConverter * bc) const override; }; diff --git a/searchlib/src/vespa/searchlib/attribute/integerbase.hpp b/searchlib/src/vespa/searchlib/attribute/integerbase.hpp index 207af8efa5e..5efca03e435 100644 --- a/searchlib/src/vespa/searchlib/attribute/integerbase.hpp +++ b/searchlib/src/vespa/searchlib/attribute/integerbase.hpp @@ -9,6 +9,32 @@ namespace search { using largeint_t = attribute::IAttributeVector::largeint_t; template<typename T> +IntegerAttributeTemplate<T>::IntegerAttributeTemplate(const vespalib::string & name) + : IntegerAttributeTemplate(name, BasicType::fromType(T())) +{ } + +template<typename T> +IntegerAttributeTemplate<T>::IntegerAttributeTemplate(const vespalib::string & name, const Config & c) + : IntegerAttribute(name, c), + _defaultValue(ChangeBase::UPDATE, 0, defaultValue()) +{ + assert(c.basicType() == BasicType::fromType(T())); +} + +template<typename T> +IntegerAttributeTemplate<T>::IntegerAttributeTemplate(const vespalib::string & name, const Config & c, const BasicType &realType) + : IntegerAttribute(name, c), + _defaultValue(ChangeBase::UPDATE, 0, 0u) +{ + assert(c.basicType() == realType); + (void) realType; + assert(BasicType::fromType(T()) == BasicType::INT8); +} + +template<typename T> +IntegerAttributeTemplate<T>::~IntegerAttributeTemplate() = default; + +template<typename T> uint32_t IntegerAttributeTemplate<T>::getRawValues(DocId, const multivalue::Value<T> * &) const { throw std::runtime_error(getNativeClassName() + "::getRawValues() not implemented."); @@ -46,16 +72,6 @@ IntegerAttributeTemplate<T>::findFoldedEnums(const char *value) const } template<typename T> -largeint_t -IntegerAttributeTemplate<T>::getIntFromEnum(EnumHandle e) const { - T v(getFromEnum(e)); - if (attribute::isUndefined<T>(v)) { - return attribute::getUndefined<largeint_t>(); - } - return v; -} - -template<typename T> long IntegerAttributeTemplate<T>::onSerializeForAscendingSort(DocId doc, void * serTo, long available, const common::BlobConverter * bc) const { (void) bc; diff --git a/searchlib/src/vespa/searchlib/attribute/loadedenumvalue.h b/searchlib/src/vespa/searchlib/attribute/loadedenumvalue.h index 44144a76aaf..b31e726b103 100644 --- a/searchlib/src/vespa/searchlib/attribute/loadedenumvalue.h +++ b/searchlib/src/vespa/searchlib/attribute/loadedenumvalue.h @@ -8,11 +8,7 @@ #include <cassert> #include <limits> -namespace search -{ - -namespace attribute -{ +namespace search::attribute { /** * Temporary representation of enumerated attribute loaded from enumerated @@ -144,10 +140,6 @@ public: } }; -void -sortLoadedByEnum(LoadedEnumAttributeVector &loaded); - -} // namespace attribute - -} // namespace search +void sortLoadedByEnum(LoadedEnumAttributeVector &loaded); +} diff --git a/searchlib/src/vespa/searchlib/attribute/not_implemented_attribute.cpp b/searchlib/src/vespa/searchlib/attribute/not_implemented_attribute.cpp index f0043818367..521b6f8c825 100644 --- a/searchlib/src/vespa/searchlib/attribute/not_implemented_attribute.cpp +++ b/searchlib/src/vespa/searchlib/attribute/not_implemented_attribute.cpp @@ -129,12 +129,6 @@ NotImplementedAttribute::clearDoc(DocId) { return 0; } -int64_t -NotImplementedAttribute::getDefaultValue() const { - notImplemented(); - return 0; -} - uint32_t NotImplementedAttribute::getEnum(DocId) const { notImplemented(); diff --git a/searchlib/src/vespa/searchlib/attribute/not_implemented_attribute.h b/searchlib/src/vespa/searchlib/attribute/not_implemented_attribute.h index 995efc9a2f7..f3af6cdd1ae 100644 --- a/searchlib/src/vespa/searchlib/attribute/not_implemented_attribute.h +++ b/searchlib/src/vespa/searchlib/attribute/not_implemented_attribute.h @@ -31,7 +31,6 @@ struct NotImplementedAttribute : AttributeVector { long onSerializeForAscendingSort(DocId, void *, long, const common::BlobConverter *) const override; long onSerializeForDescendingSort(DocId, void *, long, const common::BlobConverter *) const override; uint32_t clearDoc(DocId) override; - int64_t getDefaultValue() const override; uint32_t getEnum(DocId) const override; bool addDoc(DocId &) override; void onAddDocs(DocId lidLimit) override; diff --git a/searchlib/src/vespa/searchlib/attribute/numericbase.h b/searchlib/src/vespa/searchlib/attribute/numericbase.h index 24ed00f2ce4..bd3a68fdc60 100644 --- a/searchlib/src/vespa/searchlib/attribute/numericbase.h +++ b/searchlib/src/vespa/searchlib/attribute/numericbase.h @@ -6,7 +6,6 @@ #include "i_enum_store.h" #include "loadedenumvalue.h" #include "enum_store_loaders.h" -#include <vespa/searchlib/common/sort.h> namespace search { diff --git a/searchlib/src/vespa/searchlib/attribute/singleenumattribute.hpp b/searchlib/src/vespa/searchlib/attribute/singleenumattribute.hpp index 3be159b4847..398625891b6 100644 --- a/searchlib/src/vespa/searchlib/attribute/singleenumattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/singleenumattribute.hpp @@ -155,8 +155,9 @@ SingleValueEnumAttribute<B>::considerAttributeChange(const Change & c, EnumStore } else if (c._type >= ChangeBase::ADD && c._type <= ChangeBase::DIV) { considerArithmeticAttributeChange(c, inserter); // for numeric } else if (c._type == ChangeBase::CLEARDOC) { - this->_defaultValue._doc = c._doc; - considerUpdateAttributeChange(this->_defaultValue, inserter); + Change clearDoc(this->_defaultValue); + clearDoc._doc = c._doc; + considerUpdateAttributeChange(clearDoc, inserter); } } @@ -185,8 +186,9 @@ SingleValueEnumAttribute<B>::applyValueChanges(EnumStoreBatchUpdater& updater) } else if (change._type >= ChangeBase::ADD && change._type <= ChangeBase::DIV) { applyArithmeticValueChange(change, updater); } else if (change._type == ChangeBase::CLEARDOC) { - this->_defaultValue._doc = change._doc; - applyUpdateValueChange(this->_defaultValue, updater); + Change clearDoc(this->_defaultValue); + clearDoc._doc = change._doc; + applyUpdateValueChange(clearDoc, updater); } } } diff --git a/searchlib/src/vespa/searchlib/attribute/singlenumericattribute.hpp b/searchlib/src/vespa/searchlib/attribute/singlenumericattribute.hpp index 4a2bc68e0bc..89c2a21231b 100644 --- a/searchlib/src/vespa/searchlib/attribute/singlenumericattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/singlenumericattribute.hpp @@ -78,7 +78,7 @@ template <typename B> bool SingleValueNumericAttribute<B>::addDoc(DocId & doc) { bool incGen = _data.isFull(); - _data.push_back(attribute::getUndefined<T>()); + _data.push_back(B::defaultValue()); std::atomic_thread_fence(std::memory_order_release); B::incNumDocs(); doc = B::getNumDocs() - 1; diff --git a/searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.hpp b/searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.hpp index b3e88917cca..e56bd5aacb1 100644 --- a/searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.hpp +++ b/searchlib/src/vespa/searchlib/attribute/singlenumericpostattribute.hpp @@ -108,8 +108,9 @@ SingleValueNumericPostingAttribute<B>::applyValueChanges(EnumStoreBatchUpdater& currEnumIndices[change._doc] = newIdx; } } else if(change._type == ChangeBase::CLEARDOC) { - this->_defaultValue._doc = change._doc; - applyUpdateValueChange(this->_defaultValue, enumStore, currEnumIndices); + Change clearDoc(this->_defaultValue); + clearDoc._doc = change._doc; + applyUpdateValueChange(clearDoc, enumStore, currEnumIndices); } } diff --git a/searchlib/src/vespa/searchlib/attribute/stringbase.h b/searchlib/src/vespa/searchlib/attribute/stringbase.h index d5a407d412e..3d3a2bc0b3d 100644 --- a/searchlib/src/vespa/searchlib/attribute/stringbase.h +++ b/searchlib/src/vespa/searchlib/attribute/stringbase.h @@ -78,7 +78,6 @@ public: uint32_t get(DocId doc, WeightedInt * v, uint32_t sz) const override; uint32_t get(DocId doc, WeightedFloat * v, uint32_t sz) const override; uint32_t clearDoc(DocId doc) override; - largeint_t getDefaultValue() const override { return 0; } static size_t countZero(const char * bt, size_t sz); static void generateOffsets(const char * bt, size_t sz, OffsetVector & offsets); virtual const char * getFromEnum(EnumHandle e) const = 0; diff --git a/searchlib/src/vespa/searchlib/test/searchiteratorverifier.cpp b/searchlib/src/vespa/searchlib/test/searchiteratorverifier.cpp index ad9a6c92eab..3b58620a526 100644 --- a/searchlib/src/vespa/searchlib/test/searchiteratorverifier.cpp +++ b/searchlib/src/vespa/searchlib/test/searchiteratorverifier.cpp @@ -17,6 +17,7 @@ #include <vespa/searchlib/queryeval/andnotsearch.h> #include <vespa/searchlib/queryeval/orsearch.h> #include <vespa/searchlib/common/bitvectoriterator.h> +#include <set> namespace search::test { |