summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config/src/tests/configretriever/configretriever.cpp5
-rw-r--r--config/src/vespa/config/frt/protocol.h7
-rw-r--r--config/src/vespa/config/retriever/configsnapshot.cpp3
-rw-r--r--document/src/vespa/document/datatype/annotationreferencedatatype.cpp2
-rw-r--r--document/src/vespa/document/datatype/annotationreferencedatatype.h1
-rw-r--r--document/src/vespa/document/datatype/arraydatatype.cpp2
-rw-r--r--document/src/vespa/document/datatype/arraydatatype.h7
-rw-r--r--document/src/vespa/document/repo/documenttyperepo.cpp233
-rw-r--r--document/src/vespa/document/update/fieldpathupdate.cpp2
-rw-r--r--document/src/vespa/document/update/fieldpathupdate.h2
-rw-r--r--document/src/vespa/document/update/removefieldpathupdate.cpp6
-rw-r--r--document/src/vespa/document/update/removefieldpathupdate.h3
-rw-r--r--eval/src/vespa/eval/eval/test/gen_spec.cpp20
-rw-r--r--eval/src/vespa/eval/eval/test/gen_spec.h26
-rw-r--r--eval/src/vespa/eval/gp/gp.cpp11
-rw-r--r--eval/src/vespa/eval/gp/gp.h13
-rw-r--r--flags/src/main/java/com/yahoo/vespa/flags/Flags.java2
-rw-r--r--fnet/src/tests/frt/rpc/invoke.cpp126
-rw-r--r--jrt_test/src/tests/rpc-error/test-errors.cpp4
-rw-r--r--logd/src/tests/rpc_forwarder/rpc_forwarder_test.cpp29
-rw-r--r--logd/src/tests/watcher/watcher_test.cpp18
-rw-r--r--metrics/src/tests/metricmanagertest.cpp29
-rw-r--r--searchcore/src/apps/verify_ranksetup/verify_ranksetup.cpp37
-rw-r--r--searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp71
-rw-r--r--searchcore/src/tests/proton/documentdb/buckethandler/buckethandler_test.cpp30
-rw-r--r--searchcore/src/tests/proton/flushengine/prepare_restart_flush_strategy/prepare_restart_flush_strategy_test.cpp26
-rw-r--r--searchcore/src/tests/proton/reference/document_db_reference_resolver/CMakeLists.txt1
-rw-r--r--searchcore/src/tests/proton/reference/gid_to_lid_change_handler/CMakeLists.txt1
-rw-r--r--searchcore/src/tests/proton/reference/gid_to_lid_change_registrator/CMakeLists.txt1
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/onnx_models.h4
-rw-r--r--searchcore/src/vespa/searchcore/proton/matching/querynodes.h27
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/maintenance_controller_explorer.cpp1
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/maintenance_controller_explorer.h3
-rw-r--r--searchcore/src/vespa/searchcore/proton/test/CMakeLists.txt1
-rw-r--r--searchcore/src/vespa/searchcore/proton/test/mock_gid_to_lid_change_handler.cpp17
-rw-r--r--searchcore/src/vespa/searchcore/proton/test/mock_gid_to_lid_change_handler.h12
-rw-r--r--searchlib/src/tests/diskindex/bitvector/bitvector_test.cpp26
-rw-r--r--searchlib/src/tests/docstore/store_by_bucket/store_by_bucket_test.cpp3
-rw-r--r--searchlib/src/tests/features/onnx_feature/onnx_feature_test.cpp3
-rw-r--r--searchlib/src/tests/fef/featureoverride/featureoverride.cpp3
-rw-r--r--searchlib/src/tests/fef/phrasesplitter/benchmark.cpp3
-rw-r--r--searchlib/src/tests/memoryindex/datastore/word_store_test.cpp9
-rw-r--r--searchlib/src/tests/memoryindex/field_index/field_index_test.cpp51
-rw-r--r--searchlib/src/tests/memoryindex/field_index_remover/field_index_remover_test.cpp31
-rw-r--r--searchlib/src/tests/memoryindex/field_inverter/field_inverter_test.cpp41
-rw-r--r--searchlib/src/tests/memoryindex/memory_index/memory_index_test.cpp5
-rw-r--r--searchlib/src/tests/queryeval/weak_and/wand_bench_setup.hpp15
-rw-r--r--searchlib/src/tests/queryeval/weighted_set_term/weighted_set_term_test.cpp70
-rw-r--r--searchlib/src/tests/sort/sortbenchmark.cpp17
-rw-r--r--searchlib/src/vespa/searchlib/aggregation/hitsaggregationresult.cpp11
-rw-r--r--searchlib/src/vespa/searchlib/aggregation/hitsaggregationresult.h6
-rw-r--r--searchlib/src/vespa/searchlib/attribute/multienumattribute.cpp1
-rw-r--r--searchlib/src/vespa/searchlib/attribute/search_context.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/search_context.h2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/string_search_context.cpp3
-rw-r--r--searchlib/src/vespa/searchlib/attribute/string_search_context.h2
-rw-r--r--searchlib/src/vespa/searchlib/expression/functionnodes.cpp6
-rw-r--r--searchlib/src/vespa/searchlib/expression/unarybitfunctionnode.h6
-rw-r--r--searchlib/src/vespa/searchlib/features/element_similarity_feature.cpp22
-rw-r--r--searchlib/src/vespa/searchlib/fef/blueprintresolver.cpp16
-rw-r--r--searchlib/src/vespa/searchlib/fef/blueprintresolver.h15
-rw-r--r--searchlib/src/vespa/searchlib/fef/feature_type.h8
-rw-r--r--searchlib/src/vespa/searchlib/fef/phrase_splitter_query_env.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/fef/simpletermdata.cpp10
-rw-r--r--searchlib/src/vespa/searchlib/fef/simpletermdata.h63
-rw-r--r--searchlib/src/vespa/searchlib/grouping/sketch.h3
-rw-r--r--searchlib/src/vespa/searchlib/memoryindex/field_inverter.cpp17
-rw-r--r--searchlib/src/vespa/searchlib/memoryindex/field_inverter.h2
-rw-r--r--searchlib/src/vespa/searchlib/query/tree/termnodes.cpp21
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.h1
-rw-r--r--searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp38
-rw-r--r--searchlib/src/vespa/searchlib/tensor/hnsw_index.h64
-rw-r--r--searchlib/src/vespa/searchlib/test/weightedchildrenverifiers.h20
-rw-r--r--slobrok/src/tests/local_rpc_monitor_map/local_rpc_monitor_map_test.cpp7
-rw-r--r--slobrok/src/tests/service_map_history/service_map_history_test.cpp10
-rw-r--r--slobrok/src/vespa/slobrok/server/map_diff.cpp1
-rw-r--r--slobrok/src/vespa/slobrok/server/map_diff.h1
-rw-r--r--streamingvisitors/src/vespa/searchvisitor/indexenvironment.cpp2
-rw-r--r--streamingvisitors/src/vespa/searchvisitor/indexenvironment.h4
-rw-r--r--vespalib/src/apps/vespa-tsan-digest/tsan_digest.cpp19
-rw-r--r--vespalib/src/tests/datastore/array_store/array_store_test.cpp6
-rw-r--r--vespalib/src/tests/unwind_message/unwind_message_test.cpp22
-rw-r--r--vespalib/src/vespa/vespalib/datastore/buffer_type.cpp21
-rw-r--r--vespalib/src/vespa/vespalib/datastore/unique_store.hpp1
-rw-r--r--vespalib/src/vespa/vespalib/datastore/unique_store_remapper.h29
-rw-r--r--vespalib/src/vespa/vespalib/datastore/unique_store_remapper.hpp40
-rw-r--r--vespalib/src/vespa/vespalib/util/cpu_usage.cpp2
-rw-r--r--vespalib/src/vespa/vespalib/util/cpu_usage.h1
-rw-r--r--vespalog/src/vespa/log/log_message.cpp3
-rw-r--r--vespalog/src/vespa/log/log_message.h2
-rw-r--r--vespamalloc/src/tests/test1/new_test.cpp36
92 files changed, 940 insertions, 670 deletions
diff --git a/config/src/tests/configretriever/configretriever.cpp b/config/src/tests/configretriever/configretriever.cpp
index cc36614d4c5..3e4cd9bf980 100644
--- a/config/src/tests/configretriever/configretriever.cpp
+++ b/config/src/tests/configretriever/configretriever.cpp
@@ -38,7 +38,7 @@ struct ConfigTestFixture {
std::shared_ptr<IConfigContext> context;
int idcounter;
- ConfigTestFixture(const std::string & id)
+ explicit ConfigTestFixture(const std::string & id)
: configId(id),
bootstrapBuilder(),
componentConfig(),
@@ -141,10 +141,13 @@ public:
Slime & getData() {
return _data;
}
+ ~FixedPayload() override;
private:
Slime _data;
};
+FixedPayload::~FixedPayload() = default;
+
}
ConfigValue createKeyValueV2(const vespalib::string & key, const vespalib::string & value)
diff --git a/config/src/vespa/config/frt/protocol.h b/config/src/vespa/config/frt/protocol.h
index f99a4aee8a3..b8d7a5ff7fc 100644
--- a/config/src/vespa/config/frt/protocol.h
+++ b/config/src/vespa/config/frt/protocol.h
@@ -13,9 +13,7 @@ namespace vespalib {
}
}
-namespace config {
-
-namespace protocol {
+namespace config::protocol {
int readProtocolVersion();
int readTraceLevel();
@@ -87,6 +85,3 @@ DecompressedData decompress(const char * buf, uint32_t len, const CompressionTyp
}
}
-
-}
-
diff --git a/config/src/vespa/config/retriever/configsnapshot.cpp b/config/src/vespa/config/retriever/configsnapshot.cpp
index 293a90ebbba..8c79aec22f4 100644
--- a/config/src/vespa/config/retriever/configsnapshot.cpp
+++ b/config/src/vespa/config/retriever/configsnapshot.cpp
@@ -237,10 +237,13 @@ public:
}
Slime & getData() { return _data; }
+ ~FixedPayload() override;
private:
Slime _data;
};
+FixedPayload::~FixedPayload() = default;
+
}
std::pair<int64_t, ConfigValue>
diff --git a/document/src/vespa/document/datatype/annotationreferencedatatype.cpp b/document/src/vespa/document/datatype/annotationreferencedatatype.cpp
index 6983676a42b..066944a4e77 100644
--- a/document/src/vespa/document/datatype/annotationreferencedatatype.cpp
+++ b/document/src/vespa/document/datatype/annotationreferencedatatype.cpp
@@ -15,6 +15,8 @@ AnnotationReferenceDataType::AnnotationReferenceDataType(const AnnotationType &t
_type(&type) {
}
+AnnotationReferenceDataType::~AnnotationReferenceDataType() = default;
+
const AnnotationType &
AnnotationReferenceDataType::getAnnotationType() const {
assert(_type);
diff --git a/document/src/vespa/document/datatype/annotationreferencedatatype.h b/document/src/vespa/document/datatype/annotationreferencedatatype.h
index bf926253e4c..213e022e036 100644
--- a/document/src/vespa/document/datatype/annotationreferencedatatype.h
+++ b/document/src/vespa/document/datatype/annotationreferencedatatype.h
@@ -16,6 +16,7 @@ public:
AnnotationReferenceDataType(const AnnotationType &type, int id);
AnnotationReferenceDataType(const AnnotationReferenceDataType &) = delete;
AnnotationReferenceDataType & operator=(const AnnotationReferenceDataType &) = delete;
+ ~AnnotationReferenceDataType() override;
const AnnotationType &getAnnotationType() const;
void print(std::ostream &out, bool verbose, const std::string &indent) const override;
std::unique_ptr<FieldValue> createFieldValue() const override;
diff --git a/document/src/vespa/document/datatype/arraydatatype.cpp b/document/src/vespa/document/datatype/arraydatatype.cpp
index 68c4e87ae5e..2097385559e 100644
--- a/document/src/vespa/document/datatype/arraydatatype.cpp
+++ b/document/src/vespa/document/datatype/arraydatatype.cpp
@@ -17,6 +17,8 @@ ArrayDataType::ArrayDataType(const DataType& nestedType)
{
}
+ArrayDataType::~ArrayDataType() = default;
+
FieldValue::UP
ArrayDataType::createFieldValue() const
{
diff --git a/document/src/vespa/document/datatype/arraydatatype.h b/document/src/vespa/document/datatype/arraydatatype.h
index a984fee0c0d..579505432a3 100644
--- a/document/src/vespa/document/datatype/arraydatatype.h
+++ b/document/src/vespa/document/datatype/arraydatatype.h
@@ -16,15 +16,16 @@ public:
explicit ArrayDataType(const DataType &nestedType);
ArrayDataType(const ArrayDataType &o) = delete;
ArrayDataType &operator=(const ArrayDataType &rhs) = delete;
+ ~ArrayDataType() override;
ArrayDataType(const DataType &nestedType, int32_t id);
- std::unique_ptr<FieldValue> createFieldValue() const override;
+ [[nodiscard]] std::unique_ptr<FieldValue> createFieldValue() const override;
void print(std::ostream&, bool verbose, const std::string& indent) const override;
- bool equals(const DataType& other) const noexcept override;
+ [[nodiscard]] bool equals(const DataType& other) const noexcept override;
void onBuildFieldPath(FieldPath & path, vespalib::stringref remainFieldName) const override;
- bool isArray() const noexcept override { return true; }
+ [[nodiscard]] bool isArray() const noexcept override { return true; }
};
} // document
diff --git a/document/src/vespa/document/repo/documenttyperepo.cpp b/document/src/vespa/document/repo/documenttyperepo.cpp
index d7435c979a0..c6d30232654 100644
--- a/document/src/vespa/document/repo/documenttyperepo.cpp
+++ b/document/src/vespa/document/repo/documenttyperepo.cpp
@@ -42,7 +42,7 @@ class DocumentTypeMap : public DocumentTypeMapT
{
public:
using DocumentTypeMapT::DocumentTypeMapT;
- DataTypeRepo * findRepo(int32_t doc_type_id) const {
+ [[nodiscard]] DataTypeRepo * findRepo(int32_t doc_type_id) const {
auto iter = find(doc_type_id);
if (iter == end()) {
return nullptr;
@@ -66,27 +66,33 @@ class Repo {
hash_map<string, const DataType *> _name_map;
public:
- ~Repo() {}
-
- void inherit(const Repo &parent);
- bool addDataType(const DataType &type);
- template <typename T> const DataType * addDataType(unique_ptr<T> type);
-
- const DataType &addTensorType(const string &spec);
- const DataType *lookup(int32_t id) const;
- const DataType *lookup(stringref name) const;
- const DataType &findOrThrow(int32_t id) const;
- const DataType &findOrThrowOrCreate(int32_t id, const string &detailedType);
+ Repo() noexcept;
+ ~Repo();
+
+ void inherit(const Repo &parent) __attribute__((noinline));
+ bool addDataType(const DataType &type) __attribute__((noinline));
+ template <typename T> const DataType * addDataType(unique_ptr<T> type) __attribute__((noinline));
+
+ const DataType &addTensorType(const string &spec) __attribute__((noinline));
+ const DataType *lookup(int32_t id) const __attribute__((noinline));
+ const DataType *lookup(stringref name) const __attribute__((noinline));
+ const DataType &findOrThrow(int32_t id) const __attribute__((noinline));
+ const DataType &findOrThrowOrCreate(int32_t id, const string &detailedType) __attribute__((noinline));
};
-void Repo::inherit(const Repo &parent) {
+Repo::Repo() noexcept = default;
+Repo::~Repo() = default;
+
+void
+Repo::inherit(const Repo &parent) {
_id_map.insert(parent._id_map.begin(), parent._id_map.end());
_tensorTypes.insert(parent._tensorTypes.begin(), parent._tensorTypes.end());
_name_map.insert(parent._name_map.begin(), parent._name_map.end());
}
// Returns true if a reference to type is stored.
-bool Repo::addDataType(const DataType &type) {
+bool
+Repo::addDataType(const DataType &type) {
const DataType *& data_type = _id_map[type.getId()];
if (data_type) {
if (data_type->equals(type) && (data_type->getName() == type.getName())) {
@@ -109,7 +115,8 @@ bool Repo::addDataType(const DataType &type) {
}
template <typename T>
-const DataType* Repo::addDataType(unique_ptr<T> type) {
+const DataType*
+Repo::addDataType(unique_ptr<T> type) {
int id = type->getId();
if (addDataType(*type)) {
_owned_types.emplace_back(std::move(type));
@@ -306,6 +313,7 @@ void addStruct(int32_t id, const Datatype::Sstruct &s, Repo &repo) {
}
}
+void addArray(int32_t id, const Datatype::Array &a, Repo &repo) __attribute__((noinline));
void addArray(int32_t id, const Datatype::Array &a, Repo &repo) {
const DataType &nested = repo.findOrThrow(a.element.id);
repo.addDataType(std::make_unique<ArrayDataType>(nested, id));
@@ -330,6 +338,7 @@ void addAnnotationRef(int32_t id, const Datatype::Annotationref &a, Repo &r, con
r.addDataType(std::make_unique<AnnotationReferenceDataType>(*type, id));
}
+void addDataType(const Datatype &type, Repo &repo, const AnnotationTypeRepo &a_repo) __attribute__((noinline));
void addDataType(const Datatype &type, Repo &repo, const AnnotationTypeRepo &a_repo) {
switch (type.type) {
case Datatype::Type::STRUCT:
@@ -567,38 +576,8 @@ private:
MadeTypes _made_types;
std::set<int> _needed_idx_set;
- void apply() {
- findNeeded();
- for (const CDocType & docT : _input) {
- auto [iter,succ] = _doc_types_in_progress.emplace(docT.idx,
- DocTypeInProgress(docT, _output));
- LOG_ASSERT(succ);
- auto & dtInP = iter->second;
- createSimpleTypes(dtInP);
- createEmptyStructs(dtInP);
- initializeDocTypeAndInheritAnnotations(dtInP);
- createEmptyAnnotationTypes(dtInP);
- }
- for (auto & [id, dtInP] : _doc_types_in_progress) {
- createReferenceTypes(dtInP);
- }
- createComplexTypes();
- fillStructs();
- for (auto & [id, dtInP] : _doc_types_in_progress) {
- fillDocument(dtInP);
- fillAnnotationTypes(dtInP);
- }
- for (const auto & docT : _input) {
- for (const auto & structT : docT.structtype) {
- performStructInherit(structT.idx);
- }
- }
- }
-
- void madeType(const DataType *t, int idx) {
- _made_types[idx] = t;
- _needed_idx_set.erase(idx);
- }
+ void apply() __attribute__((noinline));
+ void madeType(const DataType *t, int idx) __attribute__((noinline));
void createSimpleTypes(DocTypeInProgress & dtInP) {
for (const auto & primT : dtInP.cfg.primitivetype) {
@@ -734,58 +713,8 @@ private:
}
}
- void createComplexTypes() {
- while (_needed_idx_set.size() > 0) {
- size_t missing_cnt = _needed_idx_set.size();
- for (const auto & docT : _input) {
- auto iter = _doc_types_in_progress.find(docT.idx);
- LOG_ASSERT(iter != _doc_types_in_progress.end());
- auto & dtInP = iter->second;
- createComplexTypesForDocType(dtInP.cfg, dtInP.repo());
- }
- if (_needed_idx_set.size() == missing_cnt) {
- for (int idx : _needed_idx_set) {
- LOG(error, "no progress, datatype [idx %d] still missing", idx);
- }
- throw IllegalArgumentException("no progress");
- }
- LOG(debug, "retry complex types, %zd missing", _needed_idx_set.size());
- }
- }
-
- void createComplexTypesForDocType(const CDocType & docT, Repo& repo) {
- for (const auto & arrT : docT.arraytype) {
- if (_made_types[arrT.idx] != nullptr) {
- continue; // OK already
- }
- if (const DataType * nested = _made_types[arrT.elementtype]) {
- auto at = std::make_unique<ArrayDataType>(*nested, arrT.internalid);
- madeType(repo.addDataType(std::move(at)), arrT.idx);
- }
- }
- for (const auto & mapT : docT.maptype) {
- if (_made_types[mapT.idx] != nullptr) {
- continue; // OK already
- }
- const DataType * kt = _made_types[mapT.keytype];
- const DataType * vt = _made_types[mapT.valuetype];
- if (kt && vt) {
- auto mt = std::make_unique<MapDataType>(*kt, *vt, mapT.internalid);
- madeType(repo.addDataType(std::move(mt)), mapT.idx);
- }
- }
- for (const auto & wsetT : docT.wsettype) {
- if (_made_types[wsetT.idx] != nullptr) {
- continue; // OK already
- }
- if (const DataType * nested = _made_types[wsetT.elementtype]) {
- auto wt = std::make_unique<WeightedSetDataType>(*nested,
- wsetT.createifnonexistent, wsetT.removeifzero,
- wsetT.internalid);
- madeType(repo.addDataType(std::move(wt)), wsetT.idx);
- }
- }
- }
+ void createComplexTypes() __attribute__((noinline));
+ void createComplexTypesForDocType(const CDocType & docT, Repo& repo) __attribute__((noinline));
void fillStructs() {
for (auto & [idx, in_progress] : _structs_in_progress) {
@@ -970,17 +899,108 @@ private:
}
public:
- ApplyNewDoctypeConfig(const DocumenttypesConfig::DoctypeVector & input,
- DocumentTypeMap & output)
- : _input(input), _output(output)
- {
- apply();
- }
+ ApplyNewDoctypeConfig(const DocumenttypesConfig::DoctypeVector & input, DocumentTypeMap & output);
~ApplyNewDoctypeConfig();
};
+ApplyNewDoctypeConfig::ApplyNewDoctypeConfig(const DocumenttypesConfig::DoctypeVector & input, DocumentTypeMap & output)
+ : _input(input),
+ _output(output)
+{
+ apply();
+}
ApplyNewDoctypeConfig::~ApplyNewDoctypeConfig() = default;
+void
+ApplyNewDoctypeConfig::madeType(const DataType *t, int idx) {
+ _made_types[idx] = t;
+ _needed_idx_set.erase(idx);
+}
+
+void
+ApplyNewDoctypeConfig::apply() {
+ findNeeded();
+ for (const CDocType & docT : _input) {
+ auto [iter,succ] = _doc_types_in_progress.emplace(docT.idx,
+ DocTypeInProgress(docT, _output));
+ LOG_ASSERT(succ);
+ auto & dtInP = iter->second;
+ createSimpleTypes(dtInP);
+ createEmptyStructs(dtInP);
+ initializeDocTypeAndInheritAnnotations(dtInP);
+ createEmptyAnnotationTypes(dtInP);
+ }
+ for (auto & [id, dtInP] : _doc_types_in_progress) {
+ createReferenceTypes(dtInP);
+ }
+ createComplexTypes();
+ fillStructs();
+ for (auto & [id, dtInP] : _doc_types_in_progress) {
+ fillDocument(dtInP);
+ fillAnnotationTypes(dtInP);
+ }
+ for (const auto & docT : _input) {
+ for (const auto & structT : docT.structtype) {
+ performStructInherit(structT.idx);
+ }
+ }
+}
+
+void
+ApplyNewDoctypeConfig::createComplexTypes() {
+ while (_needed_idx_set.size() > 0) {
+ size_t missing_cnt = _needed_idx_set.size();
+ for (const auto & docT : _input) {
+ auto iter = _doc_types_in_progress.find(docT.idx);
+ LOG_ASSERT(iter != _doc_types_in_progress.end());
+ auto & dtInP = iter->second;
+ createComplexTypesForDocType(dtInP.cfg, dtInP.repo());
+ }
+ if (_needed_idx_set.size() == missing_cnt) {
+ for (int idx : _needed_idx_set) {
+ LOG(error, "no progress, datatype [idx %d] still missing", idx);
+ }
+ throw IllegalArgumentException("no progress");
+ }
+ LOG(debug, "retry complex types, %zd missing", _needed_idx_set.size());
+ }
+}
+
+void
+ApplyNewDoctypeConfig::createComplexTypesForDocType(const CDocType & docT, Repo& repo) {
+ for (const auto & arrT : docT.arraytype) {
+ if (_made_types[arrT.idx] != nullptr) {
+ continue; // OK already
+ }
+ if (const DataType * nested = _made_types[arrT.elementtype]) {
+ auto at = std::make_unique<ArrayDataType>(*nested, arrT.internalid);
+ madeType(repo.addDataType(std::move(at)), arrT.idx);
+ }
+ }
+ for (const auto & mapT : docT.maptype) {
+ if (_made_types[mapT.idx] != nullptr) {
+ continue; // OK already
+ }
+ const DataType * kt = _made_types[mapT.keytype];
+ const DataType * vt = _made_types[mapT.valuetype];
+ if (kt && vt) {
+ auto mt = std::make_unique<MapDataType>(*kt, *vt, mapT.internalid);
+ madeType(repo.addDataType(std::move(mt)), mapT.idx);
+ }
+ }
+ for (const auto & wsetT : docT.wsettype) {
+ if (_made_types[wsetT.idx] != nullptr) {
+ continue; // OK already
+ }
+ if (const DataType * nested = _made_types[wsetT.elementtype]) {
+ auto wt = std::make_unique<WeightedSetDataType>(*nested,
+ wsetT.createifnonexistent, wsetT.removeifzero,
+ wsetT.internalid);
+ madeType(repo.addDataType(std::move(wt)), wsetT.idx);
+ }
+ }
+}
+
void configureDocTypes(const DocumenttypesConfig::DoctypeVector &t, DocumentTypeMap &type_map) {
LOG(debug, "applying new doc type config");
ApplyNewDoctypeConfig(t, type_map);
@@ -1022,8 +1042,7 @@ DocumentTypeRepo::DocumentTypeRepo(const DocumenttypesConfig &config) :
}
}
-DocumentTypeRepo::~DocumentTypeRepo() {
-}
+DocumentTypeRepo::~DocumentTypeRepo() = default;
DataTypeRepo *DocumentTypeRepo::findRepo(int32_t doc_type_id) const {
return _doc_types->findRepo(doc_type_id);
diff --git a/document/src/vespa/document/update/fieldpathupdate.cpp b/document/src/vespa/document/update/fieldpathupdate.cpp
index a8a42f69215..fa4cad5fa8c 100644
--- a/document/src/vespa/document/update/fieldpathupdate.cpp
+++ b/document/src/vespa/document/update/fieldpathupdate.cpp
@@ -38,7 +38,7 @@ parseDocumentSelection(vespalib::stringref query, const DocumentTypeRepo& repo)
} // namespace
-FieldPathUpdate::FieldPathUpdate(FieldPathUpdateType type)
+FieldPathUpdate::FieldPathUpdate(FieldPathUpdateType type) noexcept
: _type(type),
_originalFieldPath(),
_originalWhereClause()
diff --git a/document/src/vespa/document/update/fieldpathupdate.h b/document/src/vespa/document/update/fieldpathupdate.h
index fb205b67a60..7074b9edf4c 100644
--- a/document/src/vespa/document/update/fieldpathupdate.h
+++ b/document/src/vespa/document/update/fieldpathupdate.h
@@ -61,7 +61,7 @@ public:
protected:
/** To be used for deserialization */
- FieldPathUpdate(FieldPathUpdateType type);
+ FieldPathUpdate(FieldPathUpdateType type) noexcept;
FieldPathUpdate(const FieldPathUpdate &);
FieldPathUpdate & operator =(const FieldPathUpdate &);
diff --git a/document/src/vespa/document/update/removefieldpathupdate.cpp b/document/src/vespa/document/update/removefieldpathupdate.cpp
index 1b94039240b..a2909a2a3e1 100644
--- a/document/src/vespa/document/update/removefieldpathupdate.cpp
+++ b/document/src/vespa/document/update/removefieldpathupdate.cpp
@@ -8,11 +8,13 @@ namespace document {
using namespace fieldvalue;
-RemoveFieldPathUpdate::RemoveFieldPathUpdate()
+RemoveFieldPathUpdate::RemoveFieldPathUpdate() noexcept
: FieldPathUpdate(Remove)
{
}
+RemoveFieldPathUpdate::~RemoveFieldPathUpdate() = default;
+
RemoveFieldPathUpdate::RemoveFieldPathUpdate(stringref fieldPath, stringref whereClause)
: FieldPathUpdate(Remove, fieldPath, whereClause)
{
@@ -36,7 +38,7 @@ namespace {
class RemoveIteratorHandler : public IteratorHandler {
public:
- RemoveIteratorHandler() {}
+ RemoveIteratorHandler() = default;
ModificationStatus doModify(FieldValue &) override {
return ModificationStatus::REMOVED;
diff --git a/document/src/vespa/document/update/removefieldpathupdate.h b/document/src/vespa/document/update/removefieldpathupdate.h
index df71fcd717c..888effb029d 100644
--- a/document/src/vespa/document/update/removefieldpathupdate.h
+++ b/document/src/vespa/document/update/removefieldpathupdate.h
@@ -9,12 +9,13 @@ class RemoveFieldPathUpdate final : public FieldPathUpdate
{
public:
/** For deserialization */
- RemoveFieldPathUpdate();
+ RemoveFieldPathUpdate() noexcept;
RemoveFieldPathUpdate(RemoveFieldPathUpdate &&) noexcept = default;
RemoveFieldPathUpdate & operator =(RemoveFieldPathUpdate &&) noexcept = default;
RemoveFieldPathUpdate(const RemoveFieldPathUpdate &) = delete;
RemoveFieldPathUpdate & operator =(const RemoveFieldPathUpdate &) = delete;
RemoveFieldPathUpdate(stringref fieldPath, stringref whereClause = stringref());
+ ~RemoveFieldPathUpdate() override;
void print(std::ostream& out, bool verbose, const std::string& indent) const override;
diff --git a/eval/src/vespa/eval/eval/test/gen_spec.cpp b/eval/src/vespa/eval/eval/test/gen_spec.cpp
index 988ff035bbb..80cf91ed7e9 100644
--- a/eval/src/vespa/eval/eval/test/gen_spec.cpp
+++ b/eval/src/vespa/eval/eval/test/gen_spec.cpp
@@ -47,6 +47,22 @@ Sequence Seq(const std::vector<double> &seq) {
//-----------------------------------------------------------------------------
+DimSpec::DimSpec(const vespalib::string &name, size_t size) noexcept
+ : _name(name), _size(size), _dict()
+{
+ assert(_size);
+}
+DimSpec::DimSpec(const vespalib::string &name, std::vector<vespalib::string> dict) noexcept
+ : _name(name), _size(), _dict(std::move(dict))
+{
+ assert(!_size);
+}
+
+DimSpec::DimSpec(DimSpec &&) noexcept = default;
+DimSpec::DimSpec(const DimSpec &) = default;
+DimSpec & DimSpec::operator=(DimSpec &&) noexcept = default;
+DimSpec & DimSpec::operator=(const DimSpec &) = default;
+
DimSpec::~DimSpec() = default;
std::vector<vespalib::string>
@@ -120,9 +136,9 @@ GenSpec::from_desc(const vespalib::string &desc)
return {std::move(dim_list)};
}
-GenSpec::GenSpec(GenSpec &&other) = default;
+GenSpec::GenSpec(GenSpec &&other) noexcept = default;
GenSpec::GenSpec(const GenSpec &other) = default;
-GenSpec &GenSpec::operator=(GenSpec &&other) = default;
+GenSpec &GenSpec::operator=(GenSpec &&other) noexcept = default;
GenSpec &GenSpec::operator=(const GenSpec &other) = default;
GenSpec::~GenSpec() = default;
diff --git a/eval/src/vespa/eval/eval/test/gen_spec.h b/eval/src/vespa/eval/eval/test/gen_spec.h
index 30893eb90a9..8a2a6ea12ec 100644
--- a/eval/src/vespa/eval/eval/test/gen_spec.h
+++ b/eval/src/vespa/eval/eval/test/gen_spec.h
@@ -56,16 +56,12 @@ private:
size_t _size;
std::vector<vespalib::string> _dict;
public:
- DimSpec(const vespalib::string &name, size_t size) noexcept
- : _name(name), _size(size), _dict()
- {
- assert(_size);
- }
- DimSpec(const vespalib::string &name, std::vector<vespalib::string> dict) noexcept
- : _name(name), _size(), _dict(std::move(dict))
- {
- assert(!_size);
- }
+ DimSpec(const vespalib::string &name, size_t size) noexcept;
+ DimSpec(const vespalib::string &name, std::vector<vespalib::string> dict) noexcept;
+ DimSpec(DimSpec &&) noexcept;
+ DimSpec & operator=(DimSpec &&) noexcept;
+ DimSpec & operator=(const DimSpec &);
+ DimSpec(const DimSpec &);
~DimSpec();
static std::vector<vespalib::string> make_dict(size_t size, size_t stride, const vespalib::string &prefix);
ValueType::Dimension type() const {
@@ -103,9 +99,9 @@ private:
seq_t _seq;
public:
- GenSpec() : _dims(), _cells(CellType::DOUBLE), _seq(N()) {}
- GenSpec(double bias) : _dims(), _cells(CellType::DOUBLE), _seq(N(bias)) {}
- GenSpec(std::vector<DimSpec> dims_in) : _dims(std::move(dims_in)), _cells(CellType::DOUBLE), _seq(N()) {}
+ GenSpec() noexcept : _dims(), _cells(CellType::DOUBLE), _seq(N()) {}
+ GenSpec(double bias) noexcept : _dims(), _cells(CellType::DOUBLE), _seq(N(bias)) {}
+ GenSpec(std::vector<DimSpec> dims_in) noexcept : _dims(std::move(dims_in)), _cells(CellType::DOUBLE), _seq(N()) {}
// Make a GenSpec object from a textual description
// (dimension names must be single characters a-z)
@@ -114,9 +110,9 @@ public:
// 'a2_1b3_2c5_1' -> GenSpec().map("a", 2).map("b", 3, 2).map("c", 5);
static GenSpec from_desc(const vespalib::string &desc);
- GenSpec(GenSpec &&other);
+ GenSpec(GenSpec &&other) noexcept;
GenSpec(const GenSpec &other);
- GenSpec &operator=(GenSpec &&other);
+ GenSpec &operator=(GenSpec &&other) noexcept;
GenSpec &operator=(const GenSpec &other);
~GenSpec();
const std::vector<DimSpec> &dims() const { return _dims; }
diff --git a/eval/src/vespa/eval/gp/gp.cpp b/eval/src/vespa/eval/gp/gp.cpp
index ca58907e320..f4c8796af23 100644
--- a/eval/src/vespa/eval/gp/gp.cpp
+++ b/eval/src/vespa/eval/gp/gp.cpp
@@ -28,6 +28,17 @@ Program::Ref map(const std::map<Program::Ref,Program::Ref> &ref_map, Program::Re
} // namespace vespalib::gp::<unnamed>
+Program::Program(Program &&) noexcept = default;
+Program & Program::operator=(Program &&) noexcept = default;
+Program::Program(const Program &) = default;
+Program::~Program() = default;
+
+Program::Program(const OpRepo &repo, size_t in_cnt, size_t out_cnt, size_t alt_cnt, size_t gen)
+ : _repo(repo), _stats(gen), _waste(0.0),
+ _in_cnt(in_cnt), _out_cnt(out_cnt), _alt_cnt(alt_cnt),
+ _program(), _frozen(0), _bound()
+{}
+
void
Program::assert_valid(Ref ref, size_t limit) const
{
diff --git a/eval/src/vespa/eval/gp/gp.h b/eval/src/vespa/eval/gp/gp.h
index cb5cb0d442e..ec27fa70d44 100644
--- a/eval/src/vespa/eval/gp/gp.h
+++ b/eval/src/vespa/eval/gp/gp.h
@@ -164,16 +164,13 @@ struct Program : public Sim {
size_t rnd_op(Random &rnd) { return rnd.get(0, _repo.max_op()); }
Ref rnd_ref(Random &rnd, size_t limit) { return Ref::rnd(rnd, _in_cnt, limit); }
- Program(Program &&) = default;
- Program &operator=(Program &&) = default;
- Program(const Program &) = default;
+ Program(Program &&) noexcept;
+ Program &operator=(Program &&) noexcept;
+ Program(const Program &);
Program &operator=(const Program &) = delete;
- ~Program() {}
+ ~Program() override;
- Program(const OpRepo &repo, size_t in_cnt, size_t out_cnt, size_t alt_cnt, size_t gen)
- : _repo(repo), _stats(gen), _waste(0.0),
- _in_cnt(in_cnt), _out_cnt(out_cnt), _alt_cnt(alt_cnt),
- _program(), _frozen(0), _bound() {}
+ Program(const OpRepo &repo, size_t in_cnt, size_t out_cnt, size_t alt_cnt, size_t gen);
Ref add_op(size_t code, Ref lhs, Ref rhs);
Ref add_forward(Ref ref);
diff --git a/flags/src/main/java/com/yahoo/vespa/flags/Flags.java b/flags/src/main/java/com/yahoo/vespa/flags/Flags.java
index 147f36b57b1..59c9ef994ab 100644
--- a/flags/src/main/java/com/yahoo/vespa/flags/Flags.java
+++ b/flags/src/main/java/com/yahoo/vespa/flags/Flags.java
@@ -332,7 +332,7 @@ public class Flags {
public static final UnboundBooleanFlag RESTRICT_DATA_PLANE_BINDINGS = defineFeatureFlag(
"restrict-data-plane-bindings", false,
- List.of("mortent"), "2022-09-08", "2023-02-01",
+ List.of("mortent"), "2022-09-08", "2023-05-01",
"Use restricted data plane bindings",
"Takes effect at redeployment",
APPLICATION_ID);
diff --git a/fnet/src/tests/frt/rpc/invoke.cpp b/fnet/src/tests/frt/rpc/invoke.cpp
index e69513aa980..38f260dd202 100644
--- a/fnet/src/tests/frt/rpc/invoke.cpp
+++ b/fnet/src/tests/frt/rpc/invoke.cpp
@@ -90,69 +90,11 @@ private:
vespalib::Stash _echo_stash;
FRT_Values _echo_args;
- EchoTest(const EchoTest &);
- EchoTest &operator=(const EchoTest &);
-
public:
- EchoTest(FRT_Supervisor *supervisor)
- : _echo_stash(),
- _echo_args(_echo_stash)
- {
- FRT_ReflectionBuilder rb(supervisor);
- rb.DefineMethod("echo", "*", "*",
- FRT_METHOD(EchoTest::RPC_Echo), this);
-
- FRT_Values *args = &_echo_args;
- args->EnsureFree(16);
-
- args->AddInt8(8);
- uint8_t *pt_int8 = args->AddInt8Array(3);
- pt_int8[0] = 1;
- pt_int8[1] = 2;
- pt_int8[2] = 3;
-
- args->AddInt16(16);
- uint16_t *pt_int16 = args->AddInt16Array(3);
- pt_int16[0] = 2;
- pt_int16[1] = 4;
- pt_int16[2] = 6;
-
- args->AddInt32(32);
- uint32_t *pt_int32 = args->AddInt32Array(3);
- pt_int32[0] = 4;
- pt_int32[1] = 8;
- pt_int32[2] = 12;
-
- args->AddInt64(64);
- uint64_t *pt_int64 = args->AddInt64Array(3);
- pt_int64[0] = 8;
- pt_int64[1] = 16;
- pt_int64[2] = 24;
-
- args->AddFloat(32.5);
- float *pt_float = args->AddFloatArray(3);
- pt_float[0] = 0.25;
- pt_float[1] = 0.5;
- pt_float[2] = 0.75;
-
- args->AddDouble(64.5);
- double *pt_double = args->AddDoubleArray(3);
- pt_double[0] = 0.1;
- pt_double[1] = 0.2;
- pt_double[2] = 0.3;
-
- args->AddString("string");
- FRT_StringValue *pt_string = args->AddStringArray(3);
- args->SetString(&pt_string[0], "str1");
- args->SetString(&pt_string[1], "str2");
- args->SetString(&pt_string[2], "str3");
-
- args->AddData("data", 4);
- FRT_DataValue *pt_data = args->AddDataArray(3);
- args->SetData(&pt_data[0], "dat1", 4);
- args->SetData(&pt_data[1], "dat2", 4);
- args->SetData(&pt_data[2], "dat3", 4);
- }
+ EchoTest(const EchoTest &) = delete;
+ EchoTest &operator=(const EchoTest &) = delete;
+ EchoTest(FRT_Supervisor *supervisor);
+ ~EchoTest() override;
bool prepare_params(FRT_RPCRequest &req)
{
@@ -178,6 +120,66 @@ public:
}
};
+EchoTest::~EchoTest() = default;
+
+EchoTest::EchoTest(FRT_Supervisor *supervisor)
+ : _echo_stash(),
+ _echo_args(_echo_stash)
+{
+ FRT_ReflectionBuilder rb(supervisor);
+ rb.DefineMethod("echo", "*", "*", FRT_METHOD(EchoTest::RPC_Echo), this);
+
+ FRT_Values *args = &_echo_args;
+ args->EnsureFree(16);
+
+ args->AddInt8(8);
+ uint8_t *pt_int8 = args->AddInt8Array(3);
+ pt_int8[0] = 1;
+ pt_int8[1] = 2;
+ pt_int8[2] = 3;
+
+ args->AddInt16(16);
+ uint16_t *pt_int16 = args->AddInt16Array(3);
+ pt_int16[0] = 2;
+ pt_int16[1] = 4;
+ pt_int16[2] = 6;
+
+ args->AddInt32(32);
+ uint32_t *pt_int32 = args->AddInt32Array(3);
+ pt_int32[0] = 4;
+ pt_int32[1] = 8;
+ pt_int32[2] = 12;
+
+ args->AddInt64(64);
+ uint64_t *pt_int64 = args->AddInt64Array(3);
+ pt_int64[0] = 8;
+ pt_int64[1] = 16;
+ pt_int64[2] = 24;
+
+ args->AddFloat(32.5);
+ float *pt_float = args->AddFloatArray(3);
+ pt_float[0] = 0.25;
+ pt_float[1] = 0.5;
+ pt_float[2] = 0.75;
+
+ args->AddDouble(64.5);
+ double *pt_double = args->AddDoubleArray(3);
+ pt_double[0] = 0.1;
+ pt_double[1] = 0.2;
+ pt_double[2] = 0.3;
+
+ args->AddString("string");
+ FRT_StringValue *pt_string = args->AddStringArray(3);
+ args->SetString(&pt_string[0], "str1");
+ args->SetString(&pt_string[1], "str2");
+ args->SetString(&pt_string[2], "str3");
+
+ args->AddData("data", 4);
+ FRT_DataValue *pt_data = args->AddDataArray(3);
+ args->SetData(&pt_data[0], "dat1", 4);
+ args->SetData(&pt_data[1], "dat2", 4);
+ args->SetData(&pt_data[2], "dat3", 4);
+}
//-------------------------------------------------------------
struct MyAccessFilter : FRT_RequestAccessFilter {
diff --git a/jrt_test/src/tests/rpc-error/test-errors.cpp b/jrt_test/src/tests/rpc-error/test-errors.cpp
index 86d699e530e..e64c2abfff6 100644
--- a/jrt_test/src/tests/rpc-error/test-errors.cpp
+++ b/jrt_test/src/tests/rpc-error/test-errors.cpp
@@ -12,6 +12,8 @@ private:
FRT_Target *target;
public:
+ TestErrors();
+ ~TestErrors() override;
void init(const char *spec) {
client = & server.supervisor();
target = client->GetTarget(spec);
@@ -31,6 +33,8 @@ public:
int Main() override;
};
+TestErrors::TestErrors() = default;
+TestErrors::~TestErrors() = default;
void
TestErrors::testNoError()
diff --git a/logd/src/tests/rpc_forwarder/rpc_forwarder_test.cpp b/logd/src/tests/rpc_forwarder/rpc_forwarder_test.cpp
index f5349face36..6fa56dfe5c4 100644
--- a/logd/src/tests/rpc_forwarder/rpc_forwarder_test.cpp
+++ b/logd/src/tests/rpc_forwarder/rpc_forwarder_test.cpp
@@ -42,19 +42,8 @@ struct RpcServer : public FRT_Invokable {
bool reply_with_proto_response;
public:
- RpcServer()
- : server(),
- request_count(0),
- messages(),
- reply_with_error(false),
- reply_with_proto_response(true)
- {
- FRT_ReflectionBuilder builder(&server.supervisor());
- builder.DefineMethod("vespa.logserver.archiveLogMessages", "bix", "bix",
- FRT_METHOD(RpcServer::rpc_archive_log_messages), this);
- server.supervisor().Listen(0);
- }
- ~RpcServer() = default;
+ RpcServer();
+ ~RpcServer() override;
int get_listen_port() {
return server.supervisor().GetListenPort();
}
@@ -81,6 +70,20 @@ public:
}
};
+RpcServer::RpcServer()
+ : server(),
+ request_count(0),
+ messages(),
+ reply_with_error(false),
+ reply_with_proto_response(true)
+{
+ FRT_ReflectionBuilder builder(&server.supervisor());
+ builder.DefineMethod("vespa.logserver.archiveLogMessages", "bix", "bix",
+ FRT_METHOD(RpcServer::rpc_archive_log_messages), this);
+ server.supervisor().Listen(0);
+}
+RpcServer::~RpcServer() = default;
+
std::string
make_log_line(const std::string& level, const std::string& payload)
{
diff --git a/logd/src/tests/watcher/watcher_test.cpp b/logd/src/tests/watcher/watcher_test.cpp
index 55ba720c0cb..fa8c2ffe932 100644
--- a/logd/src/tests/watcher/watcher_test.cpp
+++ b/logd/src/tests/watcher/watcher_test.cpp
@@ -61,14 +61,8 @@ struct DummyForwarder : public Forwarder {
std::mutex lock;
std::condition_variable cond;
std::vector<std::string> lines;
- DummyForwarder()
- : Forwarder(),
- lock(),
- cond(),
- lines()
- {
- }
- ~DummyForwarder() override = default;
+ DummyForwarder();
+ ~DummyForwarder() override;
void forwardLine(std::string_view log_line) override {
std::lock_guard guard(lock);
lines.emplace_back(log_line);
@@ -87,6 +81,14 @@ struct DummyForwarder : public Forwarder {
}
};
+DummyForwarder::DummyForwarder()
+ : Forwarder(),
+ lock(),
+ cond(),
+ lines()
+{ }
+DummyForwarder::~DummyForwarder() = default;
+
struct WatcherFixture
{
DummyForwarder fwd;
diff --git a/metrics/src/tests/metricmanagertest.cpp b/metrics/src/tests/metricmanagertest.cpp
index 615baeccf43..604e9c46b80 100644
--- a/metrics/src/tests/metricmanagertest.cpp
+++ b/metrics/src/tests/metricmanagertest.cpp
@@ -898,13 +898,17 @@ struct NestedDimensionTestMetricSet : MetricSet
{
DimensionTestMetricSet nestedSet;
- NestedDimensionTestMetricSet()
- : MetricSet("outer", {{"fancy", "stuff"}}, ""),
- nestedSet(this)
- {
- }
+ NestedDimensionTestMetricSet();
+ ~NestedDimensionTestMetricSet();
};
+NestedDimensionTestMetricSet::NestedDimensionTestMetricSet()
+ : MetricSet("outer", {{"fancy", "stuff"}}, ""),
+ nestedSet(this)
+{
+}
+NestedDimensionTestMetricSet::~NestedDimensionTestMetricSet() = default;
+
}
TEST_F(MetricManagerTest, json_output_can_nest_dimensions_from_multiple_metric_sets)
@@ -933,13 +937,16 @@ struct DimensionOverridableTestMetricSet : MetricSet
{
DoubleValueMetric val;
- DimensionOverridableTestMetricSet(const std::string& dimValue,
- MetricSet* owner = nullptr)
- : MetricSet("temp", {{"foo", dimValue}}, "", owner),
- val("val", {}, "val desc", this)
- { }
+ DimensionOverridableTestMetricSet(const std::string& dimValue, MetricSet* owner = nullptr);
+ ~DimensionOverridableTestMetricSet() override;
};
+DimensionOverridableTestMetricSet::DimensionOverridableTestMetricSet(const std::string& dimValue, MetricSet* owner)
+ : MetricSet("temp", {{"foo", dimValue}}, "", owner),
+ val("val", {}, "val desc", this)
+{ }
+DimensionOverridableTestMetricSet::~DimensionOverridableTestMetricSet() = default;
+
struct SameNamesTestMetricSet : MetricSet
{
DimensionOverridableTestMetricSet set1;
@@ -954,7 +961,7 @@ SameNamesTestMetricSet::SameNamesTestMetricSet()
set1("bar", this),
set2("baz", this)
{ }
-SameNamesTestMetricSet::~SameNamesTestMetricSet() { }
+SameNamesTestMetricSet::~SameNamesTestMetricSet() = default;
}
diff --git a/searchcore/src/apps/verify_ranksetup/verify_ranksetup.cpp b/searchcore/src/apps/verify_ranksetup/verify_ranksetup.cpp
index 43d0b709a1b..deba3925eb1 100644
--- a/searchcore/src/apps/verify_ranksetup/verify_ranksetup.cpp
+++ b/searchcore/src/apps/verify_ranksetup/verify_ranksetup.cpp
@@ -114,7 +114,7 @@ private:
public:
VerifyRankSetup();
~VerifyRankSetup();
- const std::vector<search::fef::Message> & getMessages() const { return _messages; }
+ [[nodiscard]] const std::vector<search::fef::Message> & getMessages() const { return _messages; }
bool verify(const std::string & configId);
};
@@ -122,22 +122,25 @@ struct DummyRankingAssetsRepo : IRankingAssetsRepo {
const RankingConstantsConfig &cfg;
RankingExpressions _expressions;
OnnxModels _onnxModels;
- DummyRankingAssetsRepo(const RankingConstantsConfig &cfg_in, RankingExpressions expressions, OnnxModels onnxModels)
- : cfg(cfg_in),
- _expressions(std::move(expressions)),
- _onnxModels(std::move(onnxModels))
- {}
- vespalib::eval::ConstantValue::UP getConstant(const vespalib::string &name) const override;
+ DummyRankingAssetsRepo(const RankingConstantsConfig &cfg_in, RankingExpressions expressions, OnnxModels onnxModels);
+ ~DummyRankingAssetsRepo() override;
+ [[nodiscard]] vespalib::eval::ConstantValue::UP getConstant(const vespalib::string &name) const override;
- vespalib::string getExpression(const vespalib::string & name) const override {
+ [[nodiscard]] vespalib::string getExpression(const vespalib::string & name) const override {
return _expressions.loadExpression(name);
}
- const search::fef::OnnxModel *getOnnxModel(const vespalib::string & name) const override {
+ [[nodiscard]] const search::fef::OnnxModel *getOnnxModel(const vespalib::string & name) const override {
return _onnxModels.getModel(name);
}
};
+DummyRankingAssetsRepo::DummyRankingAssetsRepo(const RankingConstantsConfig &cfg_in, RankingExpressions expressions, OnnxModels onnxModels)
+ : cfg(cfg_in),
+ _expressions(std::move(expressions)),
+ _onnxModels(std::move(onnxModels))
+{}
+DummyRankingAssetsRepo::~DummyRankingAssetsRepo() = default;
vespalib::eval::ConstantValue::UP
DummyRankingAssetsRepo::getConstant(const vespalib::string &name) const {
for (const auto &entry: cfg.constant) {
@@ -178,14 +181,14 @@ VerifyRankSetup::verify(const search::index::Schema &schema,
if (!rankSetup.getSecondPhaseRank().empty()) {
ok = verifyFeature(factory, indexEnv, rankSetup.getSecondPhaseRank(), "second phase ranking", _messages) && ok;
}
- for (size_t i = 0; i < rankSetup.getSummaryFeatures().size(); ++i) {
- ok = verifyFeature(factory, indexEnv, rankSetup.getSummaryFeatures()[i], "summary features", _messages) && ok;
+ for (const auto & i : rankSetup.getSummaryFeatures()) {
+ ok = verifyFeature(factory, indexEnv, i, "summary features", _messages) && ok;
}
for (const auto & feature : rankSetup.get_match_features()) {
ok = verifyFeature(factory, indexEnv, feature, "match features", _messages) && ok;
}
- for (size_t i = 0; i < rankSetup.getDumpFeatures().size(); ++i) {
- ok = verifyFeature(factory, indexEnv, rankSetup.getDumpFeatures()[i], "dump features", _messages) && ok;
+ for (const auto & i : rankSetup.getDumpFeatures()) {
+ ok = verifyFeature(factory, indexEnv, i, "dump features", _messages) && ok;
}
return ok;
}
@@ -205,12 +208,10 @@ VerifyRankSetup::verifyConfig(const VerifyRanksetupConfig &myCfg,
search::index::SchemaBuilder::build(attributeCfg, schema);
DummyRankingAssetsRepo repo(constantsCfg, make_expressions(expressionsCfg, myCfg, _messages),
make_models(modelsCfg, myCfg, _messages));
- for(size_t i = 0; i < rankCfg.rankprofile.size(); i++) {
+ for(const auto & profile : rankCfg.rankprofile) {
search::fef::Properties properties;
- const RankProfilesConfig::Rankprofile &profile = rankCfg.rankprofile[i];
- for(size_t j = 0; j < profile.fef.property.size(); j++) {
- properties.add(profile.fef.property[j].name,
- profile.fef.property[j].value);
+ for(const auto & j : profile.fef.property) {
+ properties.add(j.name, j.value);
}
if (verify(schema, properties, repo)) {
_messages.emplace_back(search::fef::Level::INFO,
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 07167a91498..616bf9edf6a 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
@@ -181,7 +181,7 @@ struct AttributeManagerFixture
proton::AttributeManager::SP _msp;
proton::AttributeManager &_m;
ImportedAttributesRepoBuilder _builder;
- AttributeManagerFixture(BaseFixture &bf);
+ explicit AttributeManagerFixture(BaseFixture &bf);
~AttributeManagerFixture();
AttributeVector::SP addAttribute(const vespalib::string &name) {
return _m.addAttribute({name, INT32_SINGLE}, createSerialNum);
@@ -214,18 +214,21 @@ struct SequentialAttributeManager
{
SequentialAttributesInitializer initializer;
proton::AttributeManager mgr;
- SequentialAttributeManager(const AttributeManager &currMgr, AttrMgrSpec && newSpec)
- : initializer(newSpec.getDocIdLimit()),
- mgr(currMgr, std::move(newSpec), initializer)
- {
- mgr.addInitializedAttributes(initializer.getInitializedAttributes());
- }
- ~SequentialAttributeManager() = default;
+ SequentialAttributeManager(const AttributeManager &currMgr, AttrMgrSpec && newSpec);
+ ~SequentialAttributeManager();
};
+SequentialAttributeManager::SequentialAttributeManager(const AttributeManager &currMgr, AttrMgrSpec && newSpec)
+ : initializer(newSpec.getDocIdLimit()),
+ mgr(currMgr, std::move(newSpec), initializer)
+{
+ mgr.addInitializedAttributes(initializer.getInitializedAttributes());
+}
+SequentialAttributeManager::~SequentialAttributeManager() = default;
+
struct DummyInitializerTask : public InitializerTask
{
- virtual void run() override {}
+ void run() override {}
};
struct ParallelAttributeManager
@@ -240,12 +243,12 @@ struct ParallelAttributeManager
ExecutorThreadService master;
AttributeManagerInitializer::SP initializer;
- ParallelAttributeManager(search::SerialNum configSerialNum, AttributeManager::SP baseAttrMgr,
+ ParallelAttributeManager(search::SerialNum configSerialNum, AttributeManager & baseAttrMgr,
const AttributesConfig &attrCfg, uint32_t docIdLimit);
~ParallelAttributeManager();
};
-ParallelAttributeManager::ParallelAttributeManager(search::SerialNum configSerialNum, AttributeManager::SP baseAttrMgr,
+ParallelAttributeManager::ParallelAttributeManager(search::SerialNum configSerialNum, AttributeManager & baseAttrMgr,
const AttributesConfig &attrCfg, uint32_t docIdLimit)
: documentMetaStoreInitTask(std::make_shared<DummyInitializerTask>()),
bucketDbOwner(std::make_shared<bucketdb::BucketDBOwner>()),
@@ -256,7 +259,7 @@ ParallelAttributeManager::ParallelAttributeManager(search::SerialNum configSeria
masterExecutor(1),
master(masterExecutor),
initializer(std::make_shared<AttributeManagerInitializer>(configSerialNum, documentMetaStoreInitTask,
- documentMetaStore, *baseAttrMgr, attrCfg,
+ documentMetaStore, baseAttrMgr, attrCfg,
alloc_strategy,
fastAccessAttributesOnly, master, mgr))
{
@@ -389,7 +392,7 @@ TEST_F("require that predicate attributes are flushed and loaded", BaseFixture)
AttributeVector::SP a1 = am.addAttribute({"a1", AttributeUtils::getPredicateConfig()}, createSerialNum);
EXPECT_EQUAL(1u, a1->getNumDocs());
- auto &pa = static_cast<PredicateAttribute &>(*a1);
+ auto &pa = dynamic_cast<PredicateAttribute &>(*a1);
PredicateIndex &index = pa.getIndex();
uint32_t doc_id;
a1->addDoc(doc_id);
@@ -409,7 +412,7 @@ TEST_F("require that predicate attributes are flushed and loaded", BaseFixture)
AttributeVector::SP a1 = am.addAttribute({"a1", AttributeUtils::getPredicateConfig()}, createSerialNum); // loaded
EXPECT_EQUAL(2u, a1->getNumDocs());
- auto &pa = static_cast<PredicateAttribute &>(*a1);
+ auto &pa = dynamic_cast<PredicateAttribute &>(*a1);
PredicateIndex &index = pa.getIndex();
uint32_t doc_id;
a1->addDoc(doc_id);
@@ -441,9 +444,9 @@ TEST_F("require that reconfig can add attributes", Fixture)
f._m.addExtraAttribute(ex);
AttrSpecList newSpec;
- newSpec.push_back(AttributeSpec("a1", INT32_SINGLE));
- newSpec.push_back(AttributeSpec("a2", INT32_SINGLE));
- newSpec.push_back(AttributeSpec("a3", INT32_SINGLE));
+ newSpec.emplace_back("a1", INT32_SINGLE);
+ newSpec.emplace_back("a2", INT32_SINGLE);
+ newSpec.emplace_back("a3", INT32_SINGLE);
SequentialAttributeManager sam(f._m, AttrMgrSpec(std::move(newSpec), f._m.getNumDocs(), 10));
std::vector<AttributeGuard> list;
@@ -466,7 +469,7 @@ TEST_F("require that reconfig can remove attributes", Fixture)
AttributeVector::SP a3 = f.addAttribute("a3");
AttrSpecList newSpec;
- newSpec.push_back(AttributeSpec("a2", INT32_SINGLE));
+ newSpec.emplace_back("a2", INT32_SINGLE);
SequentialAttributeManager sam(f._m, AttrMgrSpec(std::move(newSpec), 1, 10));
std::vector<AttributeGuard> list;
@@ -487,9 +490,9 @@ TEST_F("require that new attributes after reconfig are initialized", Fixture)
EXPECT_EQUAL(3u, a1->getNumDocs());
AttrSpecList newSpec;
- newSpec.push_back(AttributeSpec("a1", INT32_SINGLE));
- newSpec.push_back(AttributeSpec("a2", INT32_SINGLE));
- newSpec.push_back(AttributeSpec("a3", INT32_ARRAY));
+ newSpec.emplace_back("a1", INT32_SINGLE);
+ newSpec.emplace_back("a2", INT32_SINGLE);
+ newSpec.emplace_back("a3", INT32_ARRAY);
SequentialAttributeManager sam(f._m, AttrMgrSpec(std::move(newSpec), 3, 4));
AttributeGuard::UP a2ap = sam.mgr.getAttribute("a2");
@@ -521,7 +524,7 @@ TEST_F("require that removed attributes cannot resurrect", BaseFixture)
am1.reset();
AttrSpecList ns2;
- ns2.push_back(AttributeSpec("a1", INT32_SINGLE));
+ ns2.emplace_back("a1", INT32_SINGLE);
// 2 new documents added since a1 was removed
SequentialAttributeManager am3(am2.mgr, AttrMgrSpec(std::move(ns2), 5, 20));
@@ -555,7 +558,7 @@ TEST_F("require that removed fields can be pruned", Fixture)
f._m.flushAll(10);
AttrSpecList newSpec;
- newSpec.push_back(AttributeSpec("a2", INT32_SINGLE));
+ newSpec.emplace_back("a2", INT32_SINGLE);
SequentialAttributeManager sam(f._m, AttrMgrSpec(std::move(newSpec), 1, 11));
sam.mgr.pruneRemovedFields(11);
@@ -684,9 +687,9 @@ TEST_F("require that attributes can be initialized and loaded in sequence", Base
AttributeManagerFixture amf(f);
AttrSpecList newSpec;
- newSpec.push_back(AttributeSpec("a1", INT32_SINGLE));
- newSpec.push_back(AttributeSpec("a2", INT32_SINGLE));
- newSpec.push_back(AttributeSpec("a3", INT32_SINGLE));
+ newSpec.emplace_back("a1", INT32_SINGLE);
+ newSpec.emplace_back("a2", INT32_SINGLE);
+ newSpec.emplace_back("a3", INT32_SINGLE);
SequentialAttributeManager newMgr(amf._m, AttrMgrSpec(std::move(newSpec), 10, createSerialNum + 5));
@@ -723,7 +726,7 @@ TEST_F("require that attributes can be initialized and loaded in parallel", Base
attrCfg.attribute.push_back(createAttributeConfig("a2"));
attrCfg.attribute.push_back(createAttributeConfig("a3"));
- ParallelAttributeManager newMgr(createSerialNum + 5, amf._msp, attrCfg, 10);
+ ParallelAttributeManager newMgr(createSerialNum + 5, *amf._msp, attrCfg, 10);
AttributeGuard::UP a1 = newMgr.mgr->get()->getAttribute("a1");
TEST_DO(validateAttribute(*a1->get()));
@@ -811,12 +814,12 @@ TEST_F("require that attribute vector of wrong type is dropped", BaseFixture)
am1->addAttribute({"a5", predicate}, 5);
am1->addAttribute({"a6", predicate}, 6);
AttrSpecList newSpec;
- newSpec.push_back(AttributeSpec("a1", INT32_SINGLE));
- newSpec.push_back(AttributeSpec("a2", INT32_ARRAY));
- newSpec.push_back(AttributeSpec("a3", generic_tensor));
- newSpec.push_back(AttributeSpec("a4", dense_tensor));
- newSpec.push_back(AttributeSpec("a5", predicate));
- newSpec.push_back(AttributeSpec("a6", predicate2));
+ newSpec.emplace_back("a1", INT32_SINGLE);
+ newSpec.emplace_back("a2", INT32_ARRAY);
+ newSpec.emplace_back("a3", generic_tensor);
+ newSpec.emplace_back("a4", dense_tensor);
+ newSpec.emplace_back("a5", predicate);
+ newSpec.emplace_back("a6", predicate2);
SequentialAttributeManager am2(*am1, AttrMgrSpec(std::move(newSpec), 5, 20));
TEST_DO(assertCreateSerialNum(*am1, "a1", 1));
TEST_DO(assertCreateSerialNum(*am1, "a2", 2));
@@ -858,7 +861,7 @@ TEST_F("require that shrink flushtarget is handed over to new attribute manager"
auto am1 = f.make_manager();
am1->addAttribute({"a1", INT32_SINGLE}, 4);
AttrSpecList newSpec;
- newSpec.push_back(AttributeSpec("a1", INT32_SINGLE));
+ newSpec.emplace_back("a1", INT32_SINGLE);
auto am2 = am1->create(AttrMgrSpec(std::move(newSpec), 5, 20));
auto am3 = std::dynamic_pointer_cast<AttributeManager>(am2);
TEST_DO(assertShrinkTargetSerial(*am3, "a1", 3));
diff --git a/searchcore/src/tests/proton/documentdb/buckethandler/buckethandler_test.cpp b/searchcore/src/tests/proton/documentdb/buckethandler/buckethandler_test.cpp
index dbc0b890cba..c9262605274 100644
--- a/searchcore/src/tests/proton/documentdb/buckethandler/buckethandler_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/buckethandler/buckethandler_test.cpp
@@ -31,33 +31,31 @@ struct MySubDb
{
DocumentMetaStore _metaStore;
test::UserDocuments _docs;
- MySubDb(std::shared_ptr<bucketdb::BucketDBOwner> bucketDB, SubDbType subDbType)
- : _metaStore(bucketDB,
- DocumentMetaStore::getFixedName(),
- search::GrowStrategy(),
- subDbType),
- _docs()
- {
- }
+ MySubDb(std::shared_ptr<bucketdb::BucketDBOwner> bucketDB, SubDbType subDbType);
+ ~MySubDb();
void insertDocs(const test::UserDocuments &docs_) {
_docs = docs_;
- for (test::UserDocuments::Iterator itr = _docs.begin(); itr != _docs.end(); ++itr) {
- const test::BucketDocuments &bucketDocs = itr->second;
- for (size_t i = 0; i < bucketDocs.getDocs().size(); ++i) {
- const test::Document &testDoc = bucketDocs.getDocs()[i];
+ for (const auto & _doc : _docs) {
+ const test::BucketDocuments &bucketDocs = _doc.second;
+ for (const auto & testDoc : bucketDocs.getDocs()) {
_metaStore.put(testDoc.getGid(), testDoc.getBucket(),
testDoc.getTimestamp(), testDoc.getDocSize(), testDoc.getLid(), 0u);
}
}
}
- BucketId bucket(uint32_t userId) {
+ BucketId bucket(uint32_t userId) const {
return _docs.getBucket(userId);
}
- test::DocumentVector docs(uint32_t userId) {
+ test::DocumentVector docs(uint32_t userId) const {
return _docs.getGidOrderDocs(userId);
}
};
+MySubDb::MySubDb(std::shared_ptr<bucketdb::BucketDBOwner> bucketDB, SubDbType subDbType)
+ : _metaStore(std::move(bucketDB), DocumentMetaStore::getFixedName(), search::GrowStrategy(), subDbType),
+ _docs()
+{ }
+MySubDb::~MySubDb() = default;
struct MyChangedHandler : public IBucketStateChangedHandler
{
@@ -65,8 +63,8 @@ struct MyChangedHandler : public IBucketStateChangedHandler
BucketInfo::ActiveState _state;
MyChangedHandler() : _bucket(), _state(BucketInfo::NOT_ACTIVE) {}
- virtual void notifyBucketStateChanged(const document::BucketId &bucketId,
- storage::spi::BucketInfo::ActiveState newState) override {
+ void notifyBucketStateChanged(const document::BucketId &bucketId,
+ storage::spi::BucketInfo::ActiveState newState) override {
_bucket = bucketId;
_state = newState;
}
diff --git a/searchcore/src/tests/proton/flushengine/prepare_restart_flush_strategy/prepare_restart_flush_strategy_test.cpp b/searchcore/src/tests/proton/flushengine/prepare_restart_flush_strategy/prepare_restart_flush_strategy_test.cpp
index 6aa17151942..fb29f968d61 100644
--- a/searchcore/src/tests/proton/flushengine/prepare_restart_flush_strategy/prepare_restart_flush_strategy_test.cpp
+++ b/searchcore/src/tests/proton/flushengine/prepare_restart_flush_strategy/prepare_restart_flush_strategy_test.cpp
@@ -14,7 +14,6 @@ using search::SerialNum;
using searchcorespi::IFlushTarget;
using SimpleFlushHandler = test::DummyFlushHandler;
-using FlushCandidatesList = std::vector<FlushTargetCandidates>;
using Config = PrepareRestartFlushStrategy::Config;
const Config DEFAULT_CFG(2.0, 0.0, 4.0);
@@ -34,13 +33,13 @@ struct SimpleFlushTarget : public test::DummyFlushTarget
approxDiskBytes(approxDiskBytes_),
replay_operation_cost(replay_operation_cost_)
{}
- SerialNum getFlushedSerialNum() const override {
+ [[nodiscard]] SerialNum getFlushedSerialNum() const override {
return flushedSerial;
}
- uint64_t getApproxBytesToWriteToDisk() const override {
+ [[nodiscard]] uint64_t getApproxBytesToWriteToDisk() const override {
return approxDiskBytes;
}
- double get_replay_operation_cost() const override {
+ [[nodiscard]] double get_replay_operation_cost() const override {
return replay_operation_cost;
}
};
@@ -62,7 +61,8 @@ private:
}
public:
- ContextsBuilder() : _result(), _handlers() {}
+ ContextsBuilder() noexcept;
+ ~ContextsBuilder();
ContextsBuilder &add(const vespalib::string &handlerName,
const vespalib::string &targetName,
IFlushTarget::Type targetType,
@@ -97,9 +97,12 @@ public:
double replay_operation_cost = 0.0) {
return add("handler1", targetName, IFlushTarget::Type::GC, flushedSerial, approxDiskBytes, replay_operation_cost);
}
- FlushContext::List build() const { return _result; }
+ [[nodiscard]] FlushContext::List build() const { return _result; }
};
+ContextsBuilder::ContextsBuilder() noexcept = default;
+ContextsBuilder::~ContextsBuilder() = default;
+
class CandidatesBuilder
{
private:
@@ -110,7 +113,7 @@ private:
Config _cfg;
public:
- CandidatesBuilder(const FlushContext::List &sortedFlushContexts)
+ explicit CandidatesBuilder(const FlushContext::List &sortedFlushContexts)
: _sortedFlushContexts(&sortedFlushContexts),
_numCandidates(sortedFlushContexts.size()),
_candidates(),
@@ -142,10 +145,7 @@ public:
}
FlushTargetCandidates build() const {
setup_candidates();
- return FlushTargetCandidates(_candidates,
- _numCandidates,
- _tlsStats,
- _cfg);
+ return {_candidates, _numCandidates, _tlsStats, _cfg};
}
};
@@ -212,14 +212,14 @@ struct FlushStrategyFixture
{
flushengine::TlsStatsMap _tlsStatsMap;
PrepareRestartFlushStrategy strategy;
- FlushStrategyFixture(const Config &config)
+ explicit FlushStrategyFixture(const Config &config)
: _tlsStatsMap(defaultTransactionLogStats()),
strategy(config)
{}
FlushStrategyFixture()
: FlushStrategyFixture(DEFAULT_CFG)
{}
- FlushContext::List getFlushTargets(const FlushContext::List &targetList,
+ [[nodiscard]] FlushContext::List getFlushTargets(const FlushContext::List &targetList,
const flushengine::TlsStatsMap &tlsStatsMap) const {
flushengine::ActiveFlushStats active_flushes;
return strategy.getFlushTargets(targetList, tlsStatsMap, active_flushes);
diff --git a/searchcore/src/tests/proton/reference/document_db_reference_resolver/CMakeLists.txt b/searchcore/src/tests/proton/reference/document_db_reference_resolver/CMakeLists.txt
index c5081f27db6..aab02c2b48c 100644
--- a/searchcore/src/tests/proton/reference/document_db_reference_resolver/CMakeLists.txt
+++ b/searchcore/src/tests/proton/reference/document_db_reference_resolver/CMakeLists.txt
@@ -5,6 +5,7 @@ vespa_add_executable(searchcore_document_db_reference_resolver_test_app TEST
DEPENDS
searchcore_reference
searchcore_attribute
+ searchcore_test
searchlib_test
)
vespa_add_test(NAME searchcore_document_db_reference_resolver_test_app COMMAND searchcore_document_db_reference_resolver_test_app)
diff --git a/searchcore/src/tests/proton/reference/gid_to_lid_change_handler/CMakeLists.txt b/searchcore/src/tests/proton/reference/gid_to_lid_change_handler/CMakeLists.txt
index 6ac416d2ce2..d9d6501af5e 100644
--- a/searchcore/src/tests/proton/reference/gid_to_lid_change_handler/CMakeLists.txt
+++ b/searchcore/src/tests/proton/reference/gid_to_lid_change_handler/CMakeLists.txt
@@ -5,5 +5,6 @@ vespa_add_executable(searchcore_gid_to_lid_change_handler_test_app TEST
DEPENDS
searchcore_reference
searchcore_server
+ searchcore_test
)
vespa_add_test(NAME searchcore_gid_to_lid_change_handler_test_app COMMAND searchcore_gid_to_lid_change_handler_test_app)
diff --git a/searchcore/src/tests/proton/reference/gid_to_lid_change_registrator/CMakeLists.txt b/searchcore/src/tests/proton/reference/gid_to_lid_change_registrator/CMakeLists.txt
index 30929059cab..6808258cbc8 100644
--- a/searchcore/src/tests/proton/reference/gid_to_lid_change_registrator/CMakeLists.txt
+++ b/searchcore/src/tests/proton/reference/gid_to_lid_change_registrator/CMakeLists.txt
@@ -5,5 +5,6 @@ vespa_add_executable(searchcore_gid_to_lid_change_registrator_test_app TEST
DEPENDS
searchcore_reference
searchcore_server
+ searchcore_test
)
vespa_add_test(NAME searchcore_gid_to_lid_change_registrator_test_app COMMAND searchcore_gid_to_lid_change_registrator_test_app)
diff --git a/searchcore/src/vespa/searchcore/proton/matching/onnx_models.h b/searchcore/src/vespa/searchcore/proton/matching/onnx_models.h
index c0582600973..4a8bdbca3d9 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/onnx_models.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/onnx_models.h
@@ -34,8 +34,8 @@ public:
OnnxModels & operator =(const OnnxModels &) = delete;
~OnnxModels();
bool operator==(const OnnxModels &rhs) const;
- const Model *getModel(const vespalib::string &name) const;
- size_t size() const { return _models.size(); }
+ [[nodiscard]] const Model *getModel(const vespalib::string &name) const;
+ [[nodiscard]] size_t size() const { return _models.size(); }
static void configure(const ModelConfig &config, Model &model);
};
diff --git a/searchcore/src/vespa/searchcore/proton/matching/querynodes.h b/searchcore/src/vespa/searchcore/proton/matching/querynodes.h
index fc3f12af4f7..4e9f03f2fac 100644
--- a/searchcore/src/vespa/searchcore/proton/matching/querynodes.h
+++ b/searchcore/src/vespa/searchcore/proton/matching/querynodes.h
@@ -36,12 +36,11 @@ public:
attribute_field(false),
filter_field(false) {}
- FieldSpec fieldSpec() const {
- return FieldSpec(field_name, getFieldId(),
- getHandle(), filter_field);
+ [[nodiscard]] FieldSpec fieldSpec() const {
+ return {field_name, getFieldId(), getHandle(), filter_field};
}
using SimpleTermFieldData::getHandle;
- search::fef::TermFieldHandle getHandle(search::fef::MatchDataDetails requested_details) const override;
+ [[nodiscard]] search::fef::TermFieldHandle getHandle(search::fef::MatchDataDetails requested_details) const override;
};
private:
@@ -67,10 +66,10 @@ public:
void setDocumentFrequency(uint32_t estHits, uint32_t numDocs);
// ITermData interface
- std::optional<vespalib::string> query_tensor_name() const override { return std::nullopt; }
- size_t numFields() const override final { return _fields.size(); }
- const FieldEntry &field(size_t i) const override final { return _fields[i]; }
- const FieldEntry *lookupField(uint32_t fieldId) const override final;
+ [[nodiscard]] std::optional<vespalib::string> query_tensor_name() const override { return std::nullopt; }
+ [[nodiscard]] size_t numFields() const final { return _fields.size(); }
+ [[nodiscard]] const FieldEntry &field(size_t i) const final { return _fields[i]; }
+ [[nodiscard]] const FieldEntry *lookupField(uint32_t fieldId) const final;
};
template <typename NodeType> inline uint32_t numTerms(const NodeType &) { return 1; }
@@ -85,6 +84,7 @@ struct ProtonTermBase : public Base,
public ProtonTermData
{
using Base::Base;
+ ~ProtonTermBase() override;
void resolve(const ViewResolver &resolver, const search::fef::IIndexEnvironment &idxEnv)
{
@@ -93,12 +93,15 @@ struct ProtonTermBase : public Base,
}
// ITermData interface
- uint32_t getPhraseLength() const final { return numTerms<Base>(*this); }
- search::query::Weight getWeight() const final { return Base::getWeight(); }
- uint32_t getUniqueId() const final { return Base::getId(); }
+ [[nodiscard]] uint32_t getPhraseLength() const final { return numTerms<Base>(*this); }
+ [[nodiscard]] search::query::Weight getWeight() const final { return Base::getWeight(); }
+ [[nodiscard]] uint32_t getUniqueId() const final { return Base::getId(); }
};
template <typename Base>
+ProtonTermBase<Base>::~ProtonTermBase() = default;
+
+template <typename Base>
struct ProtonTerm final : public ProtonTermBase<Base> {
using ProtonTermBase<Base>::ProtonTermBase;
~ProtonTerm();
@@ -128,7 +131,7 @@ struct ProtonSameElement final : public ProtonTermBase<search::query::SameElemen
struct ProtonNearestNeighborTerm : public ProtonTermBase<search::query::NearestNeighborTerm> {
using ProtonTermBase::ProtonTermBase;
- std::optional<vespalib::string> query_tensor_name() const override {
+ [[nodiscard]] std::optional<vespalib::string> query_tensor_name() const override {
return ProtonTermBase::NearestNeighborTerm::get_query_tensor_name();
}
};
diff --git a/searchcore/src/vespa/searchcore/proton/server/maintenance_controller_explorer.cpp b/searchcore/src/vespa/searchcore/proton/server/maintenance_controller_explorer.cpp
index f7123c1f862..170632739da 100644
--- a/searchcore/src/vespa/searchcore/proton/server/maintenance_controller_explorer.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/maintenance_controller_explorer.cpp
@@ -41,6 +41,7 @@ MaintenanceControllerExplorer(std::vector<MaintenanceJobRunner::SP> jobs)
: _jobs(std::move(jobs))
{
}
+MaintenanceControllerExplorer::~MaintenanceControllerExplorer() = default;
void
MaintenanceControllerExplorer::get_state(const Inserter &inserter, bool full) const
diff --git a/searchcore/src/vespa/searchcore/proton/server/maintenance_controller_explorer.h b/searchcore/src/vespa/searchcore/proton/server/maintenance_controller_explorer.h
index 76aef09e58c..aabb9836dcb 100644
--- a/searchcore/src/vespa/searchcore/proton/server/maintenance_controller_explorer.h
+++ b/searchcore/src/vespa/searchcore/proton/server/maintenance_controller_explorer.h
@@ -16,7 +16,8 @@ private:
std::vector<MaintenanceJobRunner::SP> _jobs;
public:
- MaintenanceControllerExplorer(std::vector<MaintenanceJobRunner::SP> jobs);
+ explicit MaintenanceControllerExplorer(std::vector<MaintenanceJobRunner::SP> jobs);
+ ~MaintenanceControllerExplorer() override;
void get_state(const vespalib::slime::Inserter &inserter, bool full) const override;
};
diff --git a/searchcore/src/vespa/searchcore/proton/test/CMakeLists.txt b/searchcore/src/vespa/searchcore/proton/test/CMakeLists.txt
index 79b0582e1d0..e3b1aad3c60 100644
--- a/searchcore/src/vespa/searchcore/proton/test/CMakeLists.txt
+++ b/searchcore/src/vespa/searchcore/proton/test/CMakeLists.txt
@@ -11,6 +11,7 @@ vespa_add_library(searchcore_test STATIC
dummy_feed_view.cpp
dummy_flush_target.cpp
dummydbowner.cpp
+ mock_gid_to_lid_change_handler.cpp
mock_index_manager.cpp
mock_shared_threading_service.cpp
userdocumentsbuilder.cpp
diff --git a/searchcore/src/vespa/searchcore/proton/test/mock_gid_to_lid_change_handler.cpp b/searchcore/src/vespa/searchcore/proton/test/mock_gid_to_lid_change_handler.cpp
new file mode 100644
index 00000000000..ea011dd2d37
--- /dev/null
+++ b/searchcore/src/vespa/searchcore/proton/test/mock_gid_to_lid_change_handler.cpp
@@ -0,0 +1,17 @@
+// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#include "mock_gid_to_lid_change_handler.h"
+
+namespace proton::test {
+
+MockGidToLidChangeHandler::MockGidToLidChangeHandler() noexcept
+ : IGidToLidChangeHandler(),
+ _adds(),
+ _removes(),
+ _listeners()
+{
+}
+
+MockGidToLidChangeHandler::~MockGidToLidChangeHandler() = default;
+
+}
diff --git a/searchcore/src/vespa/searchcore/proton/test/mock_gid_to_lid_change_handler.h b/searchcore/src/vespa/searchcore/proton/test/mock_gid_to_lid_change_handler.h
index 5931defbe7e..d7c72e3109a 100644
--- a/searchcore/src/vespa/searchcore/proton/test/mock_gid_to_lid_change_handler.h
+++ b/searchcore/src/vespa/searchcore/proton/test/mock_gid_to_lid_change_handler.h
@@ -6,6 +6,7 @@
#include <vespa/searchcore/proton/reference/i_pending_gid_to_lid_changes.h>
#include <vespa/vespalib/testkit/testapp.h>
#include <vespa/vespalib/test/insertion_operators.h>
+#include <vespa/document/base/globalid.h>
namespace proton::test {
@@ -24,15 +25,8 @@ private:
std::vector<std::unique_ptr<IGidToLidChangeListener>> _listeners;
public:
- MockGidToLidChangeHandler() noexcept
- : IGidToLidChangeHandler(),
- _adds(),
- _removes(),
- _listeners()
- {
- }
-
- ~MockGidToLidChangeHandler() override = default;
+ MockGidToLidChangeHandler() noexcept;
+ ~MockGidToLidChangeHandler() override;
void addListener(std::unique_ptr<IGidToLidChangeListener> listener) override {
_adds.emplace_back(listener->getDocTypeName(), listener->getName());
diff --git a/searchlib/src/tests/diskindex/bitvector/bitvector_test.cpp b/searchlib/src/tests/diskindex/bitvector/bitvector_test.cpp
index 9bc0382f3ab..839ead48908 100644
--- a/searchlib/src/tests/diskindex/bitvector/bitvector_test.cpp
+++ b/searchlib/src/tests/diskindex/bitvector/bitvector_test.cpp
@@ -69,13 +69,11 @@ private:
Schema _schema;
uint32_t _indexId;
public:
- void
- requireThatDictionaryHandlesNoEntries(bool directio, bool readmmap);
-
- void
- requireThatDictionaryHandlesMultipleEntries(bool directio, bool readmmap);
+ void requireThatDictionaryHandlesNoEntries(bool directio, bool readmmap);
+ void requireThatDictionaryHandlesMultipleEntries(bool directio, bool readmmap);
Test();
+ ~Test() override;
int Main() override;
};
@@ -104,8 +102,8 @@ Test::requireThatDictionaryHandlesNoEntries(bool directio, bool readmmap)
EXPECT_TRUE(dict.open("dump/1/", tuneFileRead, bvScope));
EXPECT_EQUAL(5u, dict.getDocIdLimit());
EXPECT_EQUAL(0u, dict.getEntries().size());
- EXPECT_TRUE(dict.lookup(1).get() == NULL);
- EXPECT_TRUE(dict.lookup(2).get() == NULL);
+ EXPECT_FALSE(dict.lookup(1));
+ EXPECT_FALSE(dict.lookup(2));
}
void
@@ -162,17 +160,17 @@ Test::requireThatDictionaryHandlesMultipleEntries(bool directio, bool readmmap)
EXPECT_EQUAL(5u, e._wordNum);
EXPECT_EQUAL(23u, e._numDocs);
- EXPECT_TRUE(dict.lookup(2).get() == NULL);
- EXPECT_TRUE(dict.lookup(3).get() == NULL);
- EXPECT_TRUE(dict.lookup(4).get() == NULL);
- EXPECT_TRUE(dict.lookup(6).get() == NULL);
+ EXPECT_FALSE(dict.lookup(2));
+ EXPECT_FALSE(dict.lookup(3));
+ EXPECT_FALSE(dict.lookup(4));
+ EXPECT_FALSE(dict.lookup(6));
BitVector::UP bv1act = dict.lookup(1);
- EXPECT_TRUE(bv1act.get() != NULL);
+ EXPECT_TRUE(bv1act);
EXPECT_TRUE(*bv1exp == *bv1act);
BitVector::UP bv5act = dict.lookup(5);
- EXPECT_TRUE(bv5act.get() != NULL);
+ EXPECT_TRUE(bv5act);
EXPECT_TRUE(*bv5exp == *bv5act);
}
@@ -183,6 +181,8 @@ Test::Test()
_schema.addIndexField(Schema::IndexField("f1", DataType::STRING));
}
+Test::~Test() = default;
+
int
Test::Main()
{
diff --git a/searchlib/src/tests/docstore/store_by_bucket/store_by_bucket_test.cpp b/searchlib/src/tests/docstore/store_by_bucket/store_by_bucket_test.cpp
index b849143427c..13aa1880e8c 100644
--- a/searchlib/src/tests/docstore/store_by_bucket/store_by_bucket_test.cpp
+++ b/searchlib/src/tests/docstore/store_by_bucket/store_by_bucket_test.cpp
@@ -57,6 +57,7 @@ public:
_lastBucketId = bucketId;
EXPECT_EQUAL(0, memcmp(buffer, createPayload(bucketId).c_str(), sz));
}
+ ~VerifyBucketOrder() override;
private:
uint32_t _lastLid;
BucketId _lastBucketId;
@@ -64,6 +65,8 @@ private:
vespalib::hash_set<uint64_t> _uniqueBucket;
};
+VerifyBucketOrder::~VerifyBucketOrder() = default;
+
TEST("require that StoreByBucket gives bucket by bucket and ordered within")
{
std::mutex backing_lock;
diff --git a/searchlib/src/tests/features/onnx_feature/onnx_feature_test.cpp b/searchlib/src/tests/features/onnx_feature/onnx_feature_test.cpp
index bf7cbeeb5a2..f6f6c62321e 100644
--- a/searchlib/src/tests/features/onnx_feature/onnx_feature_test.cpp
+++ b/searchlib/src/tests/features/onnx_feature/onnx_feature_test.cpp
@@ -179,9 +179,12 @@ struct MyIssues : Issue::Handler {
std::vector<vespalib::string> list;
Issue::Binding capture;
MyIssues() : list(), capture(Issue::listen(*this)) {}
+ ~MyIssues() override;
void handle(const Issue &issue) override { list.push_back(issue.message()); }
};
+MyIssues::~MyIssues() = default;
+
TEST_F(OnnxFeatureTest, broken_model_evaluates_to_all_zeros) {
add_expr("in1", "tensor<float>(x[2]):[docid,5]");
add_expr("in2", "tensor<float>(x[3]):[docid,10,31515]");
diff --git a/searchlib/src/tests/fef/featureoverride/featureoverride.cpp b/searchlib/src/tests/fef/featureoverride/featureoverride.cpp
index 90ee5519cc4..f5082871a3f 100644
--- a/searchlib/src/tests/fef/featureoverride/featureoverride.cpp
+++ b/searchlib/src/tests/fef/featureoverride/featureoverride.cpp
@@ -245,9 +245,12 @@ struct MyIssues : Issue::Handler {
std::vector<vespalib::string> list;
Issue::Binding capture;
MyIssues() : list(), capture(Issue::listen(*this)) {}
+ ~MyIssues() override;
void handle(const Issue &issue) override { list.push_back(issue.message()); }
};
+MyIssues::~MyIssues() = default;
+
//-----------------------------------------------------------------------------
TEST_F("require expression without override works", SimpleRankFixture) {
diff --git a/searchlib/src/tests/fef/phrasesplitter/benchmark.cpp b/searchlib/src/tests/fef/phrasesplitter/benchmark.cpp
index b2a5cf0f4c0..89fdff7819c 100644
--- a/searchlib/src/tests/fef/phrasesplitter/benchmark.cpp
+++ b/searchlib/src/tests/fef/phrasesplitter/benchmark.cpp
@@ -24,9 +24,12 @@ private:
public:
Benchmark() : _timer(), _sample(0) {}
+ ~Benchmark() override;
int Main() override;
};
+Benchmark::~Benchmark() = default;
+
void
Benchmark::run(size_t numRuns, size_t numPositions)
{
diff --git a/searchlib/src/tests/memoryindex/datastore/word_store_test.cpp b/searchlib/src/tests/memoryindex/datastore/word_store_test.cpp
index 1de7b4a3efd..5c2bf0d634f 100644
--- a/searchlib/src/tests/memoryindex/datastore/word_store_test.cpp
+++ b/searchlib/src/tests/memoryindex/datastore/word_store_test.cpp
@@ -1,6 +1,8 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include <vespa/searchlib/memoryindex/word_store.h>
#include <vespa/vespalib/gtest/gtest.h>
+#include <vespa/vespalib/util/exceptions.h>
+#include <vespa/vespalib/util/size_literals.h>
#include <vespa/log/log.h>
LOG_SETUP("word_store_test");
@@ -64,6 +66,13 @@ TEST(WordStoreTest, add_word_triggers_change_of_buffer)
EXPECT_EQ(4u, lastId);
}
+TEST(WordStoreTest, long_word_triggers_exception)
+{
+ WordStore ws;
+ vespalib::string word(16_Mi + 1_Ki, 'z');
+ EXPECT_THROW(ws.addWord(word), vespalib::OverflowException);
+}
+
}
GTEST_MAIN_RUN_ALL_TESTS()
diff --git a/searchlib/src/tests/memoryindex/field_index/field_index_test.cpp b/searchlib/src/tests/memoryindex/field_index/field_index_test.cpp
index 76056029f78..b57a2f42ea7 100644
--- a/searchlib/src/tests/memoryindex/field_index/field_index_test.cpp
+++ b/searchlib/src/tests/memoryindex/field_index/field_index_test.cpp
@@ -76,15 +76,8 @@ private:
bool _firstDoc;
public:
- explicit MyBuilder(const Schema &schema)
- : IndexBuilder(schema),
- _ss(),
- _insideWord(false),
- _insideField(false),
- _firstWord(true),
- _firstField(true),
- _firstDoc(true)
- {}
+ explicit MyBuilder(const Schema &schema);
+ ~MyBuilder() override;
void startWord(vespalib::stringref word) override {
assert(_insideField);
@@ -153,6 +146,17 @@ public:
}
};
+MyBuilder::MyBuilder(const Schema &schema)
+ : IndexBuilder(schema),
+ _ss(),
+ _insideWord(false),
+ _insideField(false),
+ _firstWord(true),
+ _firstField(true),
+ _firstDoc(true)
+{}
+MyBuilder::~MyBuilder() = default;
+
struct SimpleMatchData {
TermFieldMatchData term;
TermFieldMatchDataArray array;
@@ -395,7 +399,7 @@ public:
if (_inserter != nullptr) {
_inserter->flush();
}
- for (auto wfp : _mock) {
+ for (const auto& wfp : _mock) {
auto &wf = wfp.first;
auto &word = wf.first;
auto fieldId = wf.second;
@@ -522,7 +526,7 @@ myCompactFeatures(FieldIndexCollection &fieldIndexes, ISequencedTaskExecutor &pu
Schema
make_all_index_schema(DocBuilder::AddFieldsType add_fields)
{
- DocBuilder db(add_fields);
+ DocBuilder db(std::move(add_fields));
return SchemaBuilder(db).add_all_indexes().build();
}
@@ -732,12 +736,8 @@ make_multi_field_add_fields()
struct FieldIndexCollectionTest : public ::testing::Test {
Schema schema;
FieldIndexCollection fic;
- FieldIndexCollectionTest()
- : schema(make_all_index_schema(make_multi_field_add_fields())),
- fic(schema, MockFieldLengthInspector())
- {
- }
- ~FieldIndexCollectionTest();
+ FieldIndexCollectionTest();
+ ~FieldIndexCollectionTest() override;
[[nodiscard]]NormalFieldIndex::PostingList::Iterator
find(const vespalib::stringref word, uint32_t field_id) const {
@@ -745,6 +745,11 @@ struct FieldIndexCollectionTest : public ::testing::Test {
}
};
+FieldIndexCollectionTest::FieldIndexCollectionTest()
+ : schema(make_all_index_schema(make_multi_field_add_fields())),
+ fic(schema, MockFieldLengthInspector())
+{
+}
FieldIndexCollectionTest::~FieldIndexCollectionTest() = default;
TEST_F(FieldIndexCollectionTest, require_that_multiple_posting_lists_across_multiple_fields_can_exist)
@@ -938,8 +943,8 @@ public:
DocumentInverterContext _inv_context;
DocumentInverter _inv;
- InverterTest(DocBuilder::AddFieldsType add_fields)
- : _b(add_fields),
+ explicit InverterTest(DocBuilder::AddFieldsType add_fields)
+ : _b(std::move(add_fields)),
_schema(SchemaBuilder(_b).add_all_indexes().build()),
_fic(_schema, MockFieldLengthInspector()),
_invertThreads(SequencedTaskExecutor::create(invert_executor, 2)),
@@ -948,14 +953,14 @@ public:
_inv(_inv_context)
{
}
- NormalFieldIndex::PostingList::Iterator find(const vespalib::stringref word, uint32_t field_id) const {
+ [[nodiscard]] NormalFieldIndex::PostingList::Iterator find(const vespalib::stringref word, uint32_t field_id) const {
return find_in_field_index<false>(word, field_id, _fic);
}
- NormalFieldIndex::PostingList::ConstIterator findFrozen(const vespalib::stringref word, uint32_t field_id) const {
+ [[nodiscard]] NormalFieldIndex::PostingList::ConstIterator findFrozen(const vespalib::stringref word, uint32_t field_id) const {
return find_frozen_in_field_index<false>(word, field_id, _fic);
}
- SearchIterator::UP search(const vespalib::stringref word, uint32_t field_id,
- const SimpleMatchData& match_data) {
+ [[nodiscard]] SearchIterator::UP
+ search(const vespalib::stringref word, uint32_t field_id,const SimpleMatchData& match_data) const {
return make_search_iterator<false>(findFrozen(word, field_id), featureStoreRef(_fic, field_id),
field_id, match_data.array);
}
diff --git a/searchlib/src/tests/memoryindex/field_index_remover/field_index_remover_test.cpp b/searchlib/src/tests/memoryindex/field_index_remover/field_index_remover_test.cpp
index 0a9964d5c31..dee8b7f9ace 100644
--- a/searchlib/src/tests/memoryindex/field_index_remover/field_index_remover_test.cpp
+++ b/searchlib/src/tests/memoryindex/field_index_remover/field_index_remover_test.cpp
@@ -63,20 +63,8 @@ struct FieldIndexRemoverTest : public ::testing::Test {
std::vector<std::map<vespalib::string, vespalib::datastore::EntryRef>> _wordToRefMaps;
std::vector<std::unique_ptr<FieldIndexRemover>> _removers;
- FieldIndexRemoverTest()
- : _listener(),
- _wordStores(),
- _wordToRefMaps(),
- _removers()
- {
- uint32_t numFields = 4;
- for (uint32_t fieldId = 0; fieldId < numFields; ++fieldId) {
- _wordStores.push_back(std::make_unique<WordStore>());
- _removers.push_back(std::make_unique<FieldIndexRemover>
- (*_wordStores.back()));
- }
- _wordToRefMaps.resize(numFields);
- }
+ FieldIndexRemoverTest();
+ ~FieldIndexRemoverTest() override;
vespalib::datastore::EntryRef getWordRef(const vespalib::string &word, uint32_t fieldId) {
auto &wordToRefMap = _wordToRefMaps[fieldId];
WordStore &wordStore = *_wordStores[fieldId];
@@ -110,6 +98,21 @@ struct FieldIndexRemoverTest : public ::testing::Test {
}
};
+FieldIndexRemoverTest::FieldIndexRemoverTest()
+ : _listener(),
+ _wordStores(),
+ _wordToRefMaps(),
+ _removers()
+{
+ uint32_t numFields = 4;
+ for (uint32_t fieldId = 0; fieldId < numFields; ++fieldId) {
+ _wordStores.push_back(std::make_unique<WordStore>());
+ _removers.push_back(std::make_unique<FieldIndexRemover>(*_wordStores.back()));
+ }
+ _wordToRefMaps.resize(numFields);
+}
+FieldIndexRemoverTest::~FieldIndexRemoverTest() = default;
+
TEST_F(FieldIndexRemoverTest, word_field_id_pairs_for_multiple_doc_ids_can_be_inserted)
{
insert("a", 1, 10).insert("a", 1, 20).insert("a", 1, 30);
diff --git a/searchlib/src/tests/memoryindex/field_inverter/field_inverter_test.cpp b/searchlib/src/tests/memoryindex/field_inverter/field_inverter_test.cpp
index 6470d6593cd..2e3e56a123b 100644
--- a/searchlib/src/tests/memoryindex/field_inverter/field_inverter_test.cpp
+++ b/searchlib/src/tests/memoryindex/field_inverter/field_inverter_test.cpp
@@ -161,27 +161,8 @@ struct FieldInverterTest : public ::testing::Test {
};
}
- FieldInverterTest()
- : _b(make_add_fields()),
- _schema(SchemaBuilder(_b).add_all_indexes().build()),
- _word_store(),
- _remover(_word_store),
- _inserter_backend(),
- _calculators(),
- _inserters(),
- _inverters()
- {
- for (uint32_t fieldId = 0; fieldId < _schema.getNumIndexFields();
- ++fieldId) {
- _calculators.emplace_back(std::make_unique<FieldLengthCalculator>());
- _inserters.emplace_back(std::make_unique<test::OrderedFieldIndexInserter>(_inserter_backend, fieldId));
- _inverters.push_back(std::make_unique<FieldInverter>(_schema,
- fieldId,
- _remover,
- *_inserters.back(),
- *_calculators.back()));
- }
- }
+ FieldInverterTest();
+ ~FieldInverterTest() override;
void invertDocument(uint32_t docId, const Document &doc) {
uint32_t fieldId = 0;
@@ -213,6 +194,24 @@ struct FieldInverterTest : public ::testing::Test {
};
+FieldInverterTest::FieldInverterTest()
+ : _b(make_add_fields()),
+ _schema(SchemaBuilder(_b).add_all_indexes().build()),
+ _word_store(),
+ _remover(_word_store),
+ _inserter_backend(),
+ _calculators(),
+ _inserters(),
+ _inverters()
+{
+ for (uint32_t fieldId = 0; fieldId < _schema.getNumIndexFields(); ++fieldId) {
+ _calculators.emplace_back(std::make_unique<FieldLengthCalculator>());
+ _inserters.emplace_back(std::make_unique<test::OrderedFieldIndexInserter>(_inserter_backend, fieldId));
+ _inverters.push_back(std::make_unique<FieldInverter>(_schema, fieldId, _remover, *_inserters.back(), *_calculators.back()));
+ }
+}
+FieldInverterTest::~FieldInverterTest() = default;
+
TEST_F(FieldInverterTest, require_that_fresh_insert_works)
{
invertDocument(10, *makeDoc10(_b));
diff --git a/searchlib/src/tests/memoryindex/memory_index/memory_index_test.cpp b/searchlib/src/tests/memoryindex/memory_index/memory_index_test.cpp
index 69063f38aeb..4f7a7934d4c 100644
--- a/searchlib/src/tests/memoryindex/memory_index/memory_index_test.cpp
+++ b/searchlib/src/tests/memoryindex/memory_index/memory_index_test.cpp
@@ -55,6 +55,8 @@ using namespace search::queryeval;
struct MySetup : public IFieldLengthInspector {
std::vector<vespalib::string> fields;
std::map<vespalib::string, FieldLengthInfo> field_lengths;
+ MySetup();
+ ~MySetup() override;
MySetup &field(const std::string &name) {
fields.emplace_back(name);
return *this;
@@ -84,6 +86,9 @@ struct MySetup : public IFieldLengthInspector {
};
+MySetup::MySetup() = default;
+MySetup::~MySetup() = default;
+
//-----------------------------------------------------------------------------
struct Index {
diff --git a/searchlib/src/tests/queryeval/weak_and/wand_bench_setup.hpp b/searchlib/src/tests/queryeval/weak_and/wand_bench_setup.hpp
index fd73243b4fa..0cd31cd491a 100644
--- a/searchlib/src/tests/queryeval/weak_and/wand_bench_setup.hpp
+++ b/searchlib/src/tests/queryeval/weak_and/wand_bench_setup.hpp
@@ -54,13 +54,13 @@ struct ModSearch : SearchIterator {
uint32_t limit;
MinMaxPostingInfo info;
TermFieldMatchData *tfmd;
- ModSearch(Stats &stats_in, uint32_t step_in, uint32_t limit_in, int32_t maxWeight, TermFieldMatchData *tfmd_in)
- : stats(stats_in), step(step_in), limit(limit_in), info(0, maxWeight), tfmd(tfmd_in) { }
+ ModSearch(Stats &stats_in, uint32_t step_in, uint32_t limit_in, int32_t maxWeight, TermFieldMatchData *tfmd_in);
+ ~ModSearch() override;
void initRange(uint32_t begin, uint32_t end) override {
SearchIterator::initRange(begin, end);
setDocId(step);
}
- virtual void doSeek(uint32_t docid) override {
+ void doSeek(uint32_t docid) override {
assert(docid > getDocId());
uint32_t skippedDocs = (docid - getDocId() - 1);
uint32_t skippedHits = (skippedDocs / step);
@@ -76,7 +76,7 @@ struct ModSearch : SearchIterator {
setAtEnd();
}
}
- virtual void doUnpack(uint32_t docid) override {
+ void doUnpack(uint32_t docid) override {
if (tfmd != NULL) {
tfmd->reset(docid);
search::fef::TermFieldMatchDataPosition pos;
@@ -85,9 +85,14 @@ struct ModSearch : SearchIterator {
}
stats.unpack();
}
- virtual const PostingInfo *getPostingInfo() const override { return &info; }
+ const PostingInfo *getPostingInfo() const override { return &info; }
};
+ModSearch::ModSearch(Stats &stats_in, uint32_t step_in, uint32_t limit_in, int32_t maxWeight, TermFieldMatchData *tfmd_in)
+ : stats(stats_in), step(step_in), limit(limit_in), info(0, maxWeight), tfmd(tfmd_in)
+{ }
+ModSearch::~ModSearch() = default;
+
struct WandFactory {
virtual std::string name() const = 0;
virtual SearchIterator::UP create(const wand::Terms &terms) = 0;
diff --git a/searchlib/src/tests/queryeval/weighted_set_term/weighted_set_term_test.cpp b/searchlib/src/tests/queryeval/weighted_set_term/weighted_set_term_test.cpp
index 8f4381c48f9..51594c478e5 100644
--- a/searchlib/src/tests/queryeval/weighted_set_term/weighted_set_term_test.cpp
+++ b/searchlib/src/tests/queryeval/weighted_set_term/weighted_set_term_test.cpp
@@ -44,28 +44,20 @@ struct WS {
bool field_is_filter;
bool term_is_not_needed;
- WS()
- : layout(),
- handle(layout.allocTermField(fieldId)),
- tokens(),
- field_is_filter(false),
- term_is_not_needed(false)
- {
- MatchData::UP tmp = layout.createMatchData();
- ASSERT_TRUE(tmp->resolveTermField(handle)->getFieldId() == fieldId);
- }
+ WS();
+ ~WS();
WS &add(const std::string &token, uint32_t weight) {
- tokens.push_back(std::make_pair(token, weight));
+ tokens.emplace_back(token, weight);
return *this;
}
WS& set_field_is_filter(bool value) { field_is_filter = value; return *this; }
WS& set_term_is_not_needed(bool value) { term_is_not_needed = value; return *this; }
- Node::UP createNode() const {
- SimpleWeightedSetTerm *node = new SimpleWeightedSetTerm(tokens.size(), "view", 0, Weight(0));
- for (size_t i = 0; i < tokens.size(); ++i) {
- node->addTerm(tokens[i].first,Weight(tokens[i].second));
+ [[nodiscard]] Node::UP createNode() const {
+ auto *node = new SimpleWeightedSetTerm(tokens.size(), "view", 0, Weight(0));
+ for (const auto & token : tokens) {
+ node->addTerm(token.first,Weight(token.second));
}
return Node::UP(node);
}
@@ -78,7 +70,7 @@ struct WS {
queryeval::Blueprint::UP bp = searchable.createBlueprint(requestContext, fields, *node);
bp->fetchPostings(ExecuteInfo::create(strict));
SearchIterator::UP sb = bp->createSearch(*md, strict);
- return (dynamic_cast<WeightedSetTermSearch*>(sb.get()) != 0);
+ return (dynamic_cast<WeightedSetTermSearch*>(sb.get()) != nullptr);
}
FakeResult search(Searchable &searchable, const std::string &field, bool strict) const {
@@ -111,26 +103,38 @@ struct WS {
}
};
+WS::WS()
+ : layout(),
+ handle(layout.allocTermField(fieldId)),
+ tokens(),
+ field_is_filter(false),
+ term_is_not_needed(false)
+{
+ MatchData::UP tmp = layout.createMatchData();
+ ASSERT_TRUE(tmp->resolveTermField(handle)->getFieldId() == fieldId);
+}
+WS::~WS() = default;
+
struct MockSearch : public SearchIterator {
int seekCnt;
int _initial;
- MockSearch(uint32_t initial) : SearchIterator(), seekCnt(0), _initial(initial) { }
+ explicit MockSearch(uint32_t initial) : SearchIterator(), seekCnt(0), _initial(initial) { }
void initRange(uint32_t begin, uint32_t end) override {
SearchIterator::initRange(begin, end);
setDocId(_initial);
}
- virtual void doSeek(uint32_t) override {
+ void doSeek(uint32_t) override {
++seekCnt;
setAtEnd();
}
- virtual void doUnpack(uint32_t) override {}
+ void doUnpack(uint32_t) override {}
};
struct MockFixture {
MockSearch *mock;
TermFieldMatchData tfmd;
std::unique_ptr<SearchIterator> search;
- MockFixture(uint32_t initial) : mock(0), tfmd(), search() {
+ explicit MockFixture(uint32_t initial) : mock(nullptr), tfmd(), search() {
std::vector<SearchIterator*> children;
std::vector<int32_t> weights;
mock = new MockSearch(initial);
@@ -156,10 +160,11 @@ void run_simple(bool field_is_filter, bool term_is_not_needed)
.doc(5).elem(0).weight(50).pos(0)
.doc(7).elem(0).weight(70).pos(0);
}
- WS ws = WS().add("7", 70).add("5", 50).add("3", 30).add("100", 1000)
- .set_field_is_filter(field_is_filter)
- .set_term_is_not_needed(term_is_not_needed);
-;
+ WS ws;
+ ws.add("7", 70).add("5", 50).add("3", 30).add("100", 1000)
+ .set_field_is_filter(field_is_filter)
+ .set_term_is_not_needed(term_is_not_needed);
+
EXPECT_TRUE(ws.isGenericSearch(index, "field", true));
EXPECT_TRUE(ws.isGenericSearch(index, "field", false));
EXPECT_TRUE(ws.isGenericSearch(index, "multi-field", true));
@@ -197,11 +202,12 @@ void run_multi(bool field_is_filter, bool term_is_not_needed)
.doc(5).elem(0).weight(150).pos(0).elem(0).weight(50).pos(0)
.doc(7).elem(0).weight(70).pos(0);
}
- WS ws = WS().add("7", 70).add("5", 50).add("3", 30)
- .add("15", 150).add("13", 130)
- .add("23", 230).add("100", 1000)
- .set_field_is_filter(field_is_filter)
- .set_term_is_not_needed(term_is_not_needed);
+ WS ws;
+ ws.add("7", 70).add("5", 50).add("3", 30)
+ .add("15", 150).add("13", 130)
+ .add("23", 230).add("100", 1000)
+ .set_field_is_filter(field_is_filter)
+ .set_term_is_not_needed(term_is_not_needed);
EXPECT_TRUE(ws.isGenericSearch(index, "multi-field", true));
EXPECT_TRUE(ws.isGenericSearch(index, "multi-field", false));
@@ -274,9 +280,9 @@ TEST("verify search iterator conformance with document weight iterator children"
struct VerifyMatchData {
struct MyBlueprint : search::queryeval::SimpleLeafBlueprint {
VerifyMatchData &vmd;
- MyBlueprint(VerifyMatchData &vmd_in, FieldSpec spec_in)
+ MyBlueprint(VerifyMatchData &vmd_in, const FieldSpec & spec_in)
: SimpleLeafBlueprint(spec_in), vmd(vmd_in) {}
- SearchIterator::UP createLeafSearch(const fef::TermFieldMatchDataArray &tfmda, bool) const override {
+ [[nodiscard]] SearchIterator::UP createLeafSearch(const fef::TermFieldMatchDataArray &tfmda, bool) const override {
EXPECT_EQUAL(tfmda.size(), 1u);
EXPECT_TRUE(tfmda[0] != nullptr);
if (vmd.child_tfmd == nullptr) {
@@ -287,7 +293,7 @@ struct VerifyMatchData {
++vmd.child_cnt;
return std::make_unique<EmptySearch>();
}
- SearchIteratorUP createFilterSearch(bool strict, FilterConstraint constraint) const override {
+ [[nodiscard]] SearchIteratorUP createFilterSearch(bool strict, FilterConstraint constraint) const override {
return create_default_filter(strict, constraint);
}
};
diff --git a/searchlib/src/tests/sort/sortbenchmark.cpp b/searchlib/src/tests/sort/sortbenchmark.cpp
index 04832593b28..94f9424575c 100644
--- a/searchlib/src/tests/sort/sortbenchmark.cpp
+++ b/searchlib/src/tests/sort/sortbenchmark.cpp
@@ -18,9 +18,15 @@ public:
V merge();
void twoWayMerge();
V cat() const;
+ Test();
+ ~Test() override;
};
-void Test::generateVectors(size_t numVectors, size_t values)
+Test::Test() = default;
+Test::~Test() = default;
+
+void
+Test::generateVectors(size_t numVectors, size_t values)
{
_data.resize(numVectors);
for (size_t j(0); j < numVectors; j++) {
@@ -32,13 +38,15 @@ void Test::generateVectors(size_t numVectors, size_t values)
}
}
-Test::V Test::merge()
+Test::V
+Test::merge()
{
twoWayMerge();
return _data[0];
}
-void Test::twoWayMerge()
+void
+Test::twoWayMerge()
{
std::vector<V> n((_data.size()+1)/2);
@@ -57,7 +65,8 @@ void Test::twoWayMerge()
}
}
-Test::V Test::cat() const
+Test::V
+Test::cat() const
{
size_t sum(0);
for (size_t i(0), m(_data.size()); i < m; i++) {
diff --git a/searchlib/src/vespa/searchlib/aggregation/hitsaggregationresult.cpp b/searchlib/src/vespa/searchlib/aggregation/hitsaggregationresult.cpp
index b3dff78abfb..01559952f28 100644
--- a/searchlib/src/vespa/searchlib/aggregation/hitsaggregationresult.cpp
+++ b/searchlib/src/vespa/searchlib/aggregation/hitsaggregationresult.cpp
@@ -2,7 +2,6 @@
#include "hitsaggregationresult.h"
#include <vespa/document/fieldvalue/document.h>
-#include <cassert>
#include <vespa/log/log.h>
LOG_SETUP(".searchlib.aggregation.hitsaggregationresult");
@@ -21,9 +20,13 @@ HitsAggregationResult::HitsAggregationResult() :
_hits(),
_isOrdered(false),
_bestHitRank(),
- _summaryGenerator(0)
+ _summaryGenerator(nullptr)
{}
-HitsAggregationResult::~HitsAggregationResult() {}
+HitsAggregationResult::HitsAggregationResult(HitsAggregationResult &&) noexcept = default;
+HitsAggregationResult & HitsAggregationResult::operator=(HitsAggregationResult &&) noexcept = default;
+HitsAggregationResult::HitsAggregationResult(const HitsAggregationResult &) = default;
+HitsAggregationResult & HitsAggregationResult::operator=(const HitsAggregationResult &) = default;
+HitsAggregationResult::~HitsAggregationResult() = default;
void HitsAggregationResult::onPrepare(const ResultNode & result, bool useForInit)
{
@@ -34,7 +37,7 @@ void HitsAggregationResult::onPrepare(const ResultNode & result, bool useForInit
void
HitsAggregationResult::onMerge(const AggregationResult &b)
{
- const HitsAggregationResult &rhs = (const HitsAggregationResult &)b;
+ const auto &rhs = (const HitsAggregationResult &)b;
_hits.onMerge(rhs._hits);
}
diff --git a/searchlib/src/vespa/searchlib/aggregation/hitsaggregationresult.h b/searchlib/src/vespa/searchlib/aggregation/hitsaggregationresult.h
index 97595a4119c..30059078920 100644
--- a/searchlib/src/vespa/searchlib/aggregation/hitsaggregationresult.h
+++ b/searchlib/src/vespa/searchlib/aggregation/hitsaggregationresult.h
@@ -43,7 +43,11 @@ public:
DECLARE_AGGREGATIONRESULT(HitsAggregationResult);
HitsAggregationResult();
- ~HitsAggregationResult();
+ HitsAggregationResult(HitsAggregationResult &&) noexcept;
+ HitsAggregationResult & operator=(HitsAggregationResult &&) noexcept;
+ HitsAggregationResult(const HitsAggregationResult &);
+ HitsAggregationResult & operator=(const HitsAggregationResult &);
+ ~HitsAggregationResult() override;
void postMerge() override { _hits.postMerge(_maxHits); }
void setSummaryGenerator(SummaryGenerator & summaryGenerator) { _summaryGenerator = &summaryGenerator; }
const SummaryClassType & getSummaryClass() const { return _summaryClass; }
diff --git a/searchlib/src/vespa/searchlib/attribute/multienumattribute.cpp b/searchlib/src/vespa/searchlib/attribute/multienumattribute.cpp
index 817470deb69..a8006d4e3b5 100644
--- a/searchlib/src/vespa/searchlib/attribute/multienumattribute.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/multienumattribute.cpp
@@ -2,6 +2,7 @@
#include "multienumattribute.hpp"
#include "enummodifier.h"
+#include <vespa/vespalib/datastore/unique_store_remapper.hpp>
#include <stdexcept>
namespace search::multienumattribute {
diff --git a/searchlib/src/vespa/searchlib/attribute/search_context.cpp b/searchlib/src/vespa/searchlib/attribute/search_context.cpp
index 3deacca5764..a0345ddce70 100644
--- a/searchlib/src/vespa/searchlib/attribute/search_context.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/search_context.cpp
@@ -10,7 +10,7 @@ using search::queryeval::SearchIterator;
namespace search::attribute {
-SearchContext::SearchContext(const AttributeVector &attr)
+SearchContext::SearchContext(const AttributeVector &attr) noexcept
: _attr(attr),
_plsc(nullptr)
{
diff --git a/searchlib/src/vespa/searchlib/attribute/search_context.h b/searchlib/src/vespa/searchlib/attribute/search_context.h
index 8e1297ad2df..025b0fdf113 100644
--- a/searchlib/src/vespa/searchlib/attribute/search_context.h
+++ b/searchlib/src/vespa/searchlib/attribute/search_context.h
@@ -47,7 +47,7 @@ public:
const AttributeVector& attribute() const { return _attr; }
protected:
- SearchContext(const AttributeVector& attr);
+ SearchContext(const AttributeVector& attr) noexcept;
const AttributeVector& _attr;
attribute::IPostingListSearchContext* _plsc;
diff --git a/searchlib/src/vespa/searchlib/attribute/string_search_context.cpp b/searchlib/src/vespa/searchlib/attribute/string_search_context.cpp
index e548ab8078c..fadf7a3151d 100644
--- a/searchlib/src/vespa/searchlib/attribute/string_search_context.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/string_search_context.cpp
@@ -21,6 +21,9 @@ StringSearchContext::StringSearchContext(const AttributeVector& to_be_searched,
{
}
+StringSearchContext::StringSearchContext(StringSearchContext &&) noexcept = default;
+StringSearchContext::~StringSearchContext() = default;
+
const QueryTermUCS4*
StringSearchContext::queryTerm() const
{
diff --git a/searchlib/src/vespa/searchlib/attribute/string_search_context.h b/searchlib/src/vespa/searchlib/attribute/string_search_context.h
index fc9f3688a7a..a0014379436 100644
--- a/searchlib/src/vespa/searchlib/attribute/string_search_context.h
+++ b/searchlib/src/vespa/searchlib/attribute/string_search_context.h
@@ -26,6 +26,8 @@ protected:
public:
StringSearchContext(const AttributeVector& to_be_searched, std::unique_ptr<QueryTermSimple> query_term, bool cased);
StringSearchContext(const AttributeVector& to_be_searched, StringMatcher&& matcher);
+ StringSearchContext(StringSearchContext &&) noexcept;
+ ~StringSearchContext() override;
const QueryTermUCS4* queryTerm() const override;
bool valid() const override;
diff --git a/searchlib/src/vespa/searchlib/expression/functionnodes.cpp b/searchlib/src/vespa/searchlib/expression/functionnodes.cpp
index 9046a5427ce..cc6a8c137a7 100644
--- a/searchlib/src/vespa/searchlib/expression/functionnodes.cpp
+++ b/searchlib/src/vespa/searchlib/expression/functionnodes.cpp
@@ -3,9 +3,7 @@
#include "floatresultnode.h"
#include "stringresultnode.h"
#include "rawresultnode.h"
-#include "enumresultnode.h"
#include "constantnode.h"
-#include "relevancenode.h"
#include "addfunctionnode.h"
#include "dividefunctionnode.h"
#include "multiplyfunctionnode.h"
@@ -29,8 +27,6 @@
#include "xorbitfunctionnode.h"
#include "md5bitfunctionnode.h"
#include "binaryfunctionnode.h"
-#include "nullresultnode.h"
-#include "positiveinfinityresultnode.h"
#include "resultvector.h"
#include "catserializer.h"
#include "strcatserializer.h"
@@ -320,6 +316,8 @@ ResultNode::CP DivideFunctionNode::getInitialValue() const
throw std::runtime_error("DivideFunctionNode::getInitialValue() const not implemented since it shall never be used.");
}
+UnaryBitFunctionNode::~UnaryBitFunctionNode() = default;
+
void UnaryBitFunctionNode::onPrepareResult()
{
setResultType(std::unique_ptr<ResultNode>(new RawResultNode()));
diff --git a/searchlib/src/vespa/searchlib/expression/unarybitfunctionnode.h b/searchlib/src/vespa/searchlib/expression/unarybitfunctionnode.h
index 63114188b1f..536d881cb90 100644
--- a/searchlib/src/vespa/searchlib/expression/unarybitfunctionnode.h
+++ b/searchlib/src/vespa/searchlib/expression/unarybitfunctionnode.h
@@ -4,8 +4,7 @@
#include "unaryfunctionnode.h"
#include <vespa/vespalib/objects/nbostream.h>
-namespace search {
-namespace expression {
+namespace search::expression {
class UnaryBitFunctionNode : public UnaryFunctionNode
{
@@ -15,6 +14,7 @@ public:
DECLARE_ABSTRACT_EXPRESSIONNODE(UnaryBitFunctionNode);
UnaryBitFunctionNode() : _numBits(0) { }
UnaryBitFunctionNode(ExpressionNode::UP arg, unsigned numBits) : UnaryFunctionNode(std::move(arg)), _numBits(numBits) { }
+ ~UnaryBitFunctionNode() override;
protected:
size_t getNumBits() const { return _numBits; }
size_t getNumBytes() const { return (_numBits+7)/8; }
@@ -28,5 +28,3 @@ private:
};
}
-}
-
diff --git a/searchlib/src/vespa/searchlib/features/element_similarity_feature.cpp b/searchlib/src/vespa/searchlib/features/element_similarity_feature.cpp
index a58f97a2755..d039b80930b 100644
--- a/searchlib/src/vespa/searchlib/features/element_similarity_feature.cpp
+++ b/searchlib/src/vespa/searchlib/features/element_similarity_feature.cpp
@@ -236,15 +236,8 @@ private:
const fef::MatchData *_md;
public:
- ElementSimilarityExecutor(VectorizedQueryTerms &&terms, std::vector<OutputSpec> &&outputs_in)
- : _terms(std::move(terms)),
- _pos(_terms.handles.size(), nullptr),
- _end(_terms.handles.size(), nullptr),
- _position_queue(CmpPosition(_pos.data())),
- _element_queue(CmpElement(_pos.data())),
- _outputs(std::move(outputs_in)),
- _md(nullptr)
- { }
+ ElementSimilarityExecutor(VectorizedQueryTerms &&terms, std::vector<OutputSpec> &&outputs_in);
+ ~ElementSimilarityExecutor() override;
bool isPure() override { return _terms.handles.empty(); }
@@ -317,6 +310,17 @@ public:
}
};
+ElementSimilarityExecutor::ElementSimilarityExecutor(VectorizedQueryTerms &&terms, std::vector<OutputSpec> &&outputs_in)
+ : _terms(std::move(terms)),
+ _pos(_terms.handles.size(), nullptr),
+ _end(_terms.handles.size(), nullptr),
+ _position_queue(CmpPosition(_pos.data())),
+ _element_queue(CmpElement(_pos.data())),
+ _outputs(std::move(outputs_in)),
+ _md(nullptr)
+{ }
+ElementSimilarityExecutor::~ElementSimilarityExecutor() = default;
+
//-----------------------------------------------------------------------------
std::vector<std::pair<vespalib::string, vespalib::string> >
diff --git a/searchlib/src/vespa/searchlib/fef/blueprintresolver.cpp b/searchlib/src/vespa/searchlib/fef/blueprintresolver.cpp
index dd94e26b056..cc2cae1c8cb 100644
--- a/searchlib/src/vespa/searchlib/fef/blueprintresolver.cpp
+++ b/searchlib/src/vespa/searchlib/fef/blueprintresolver.cpp
@@ -51,7 +51,7 @@ struct Compiler : public Blueprint::DependencyHandler {
struct Frame {
ExecutorSpec spec;
const FeatureNameParser &parser;
- Frame(Blueprint::SP blueprint, const FeatureNameParser &parser_in)
+ Frame(Blueprint::SP blueprint, const FeatureNameParser &parser_in) noexcept
: spec(std::move(blueprint)), parser(parser_in) {}
};
using Stack = std::vector<Frame>;
@@ -91,7 +91,7 @@ struct Compiler : public Blueprint::DependencyHandler {
failed_set(),
min_stack(nullptr),
max_stack(nullptr) {}
- ~Compiler();
+ ~Compiler() override;
void probe_stack() {
const char c = 'X';
@@ -99,12 +99,12 @@ struct Compiler : public Blueprint::DependencyHandler {
max_stack = (max_stack == nullptr) ? &c : std::max(max_stack, &c);
}
- int stack_usage() const {
+ [[nodiscard]] int stack_usage() const {
return (max_stack - min_stack);
}
Frame &self() { return resolve_stack.back(); }
- bool failed() const { return !failed_set.empty(); }
+ [[nodiscard]] bool failed() const { return !failed_set.empty(); }
vespalib::string make_trace(bool skip_self) {
vespalib::string trace;
@@ -142,7 +142,7 @@ struct Compiler : public Blueprint::DependencyHandler {
errors.emplace_back(msg);
}
probe_stack();
- return FeatureRef();
+ return {};
}
void fail_self(const vespalib::string &reason) {
@@ -245,12 +245,14 @@ Compiler::~Compiler() = default;
} // namespace search::fef::<unnamed>
-BlueprintResolver::ExecutorSpec::ExecutorSpec(Blueprint::SP blueprint_in)
+BlueprintResolver::ExecutorSpec::ExecutorSpec(Blueprint::SP blueprint_in) noexcept
: blueprint(std::move(blueprint_in)),
inputs(),
output_types()
{ }
-
+BlueprintResolver::ExecutorSpec::ExecutorSpec(ExecutorSpec &&) noexcept = default;
+BlueprintResolver::ExecutorSpec & BlueprintResolver::ExecutorSpec::operator =(ExecutorSpec &&) noexcept = default;
+BlueprintResolver::ExecutorSpec::ExecutorSpec(const ExecutorSpec &) = default;
BlueprintResolver::ExecutorSpec::~ExecutorSpec() = default;
BlueprintResolver::~BlueprintResolver() = default;
diff --git a/searchlib/src/vespa/searchlib/fef/blueprintresolver.h b/searchlib/src/vespa/searchlib/fef/blueprintresolver.h
index cbc8614dbde..3cf52a90684 100644
--- a/searchlib/src/vespa/searchlib/fef/blueprintresolver.h
+++ b/searchlib/src/vespa/searchlib/fef/blueprintresolver.h
@@ -43,7 +43,7 @@ public:
FeatureRef() : executor(undef), output(0) {}
FeatureRef(uint32_t executor_in, uint32_t output_in)
: executor(executor_in), output(output_in) {}
- bool valid() { return (executor != undef); }
+ [[nodiscard]] bool valid() const { return (executor != undef); }
};
using FeatureMap = std::map<vespalib::string, FeatureRef>;
@@ -57,7 +57,10 @@ public:
std::vector<FeatureRef> inputs;
std::vector<FeatureType> output_types;
- ExecutorSpec(BlueprintSP blueprint_in);
+ explicit ExecutorSpec(BlueprintSP blueprint_in) noexcept;
+ ExecutorSpec(ExecutorSpec &&) noexcept;
+ ExecutorSpec & operator =(ExecutorSpec &&) noexcept;
+ ExecutorSpec(const ExecutorSpec &);
~ExecutorSpec();
};
using ExecutorSpecList = std::vector<ExecutorSpec>;
@@ -136,7 +139,7 @@ public:
*
* @return feature executor assembly directions
**/
- const ExecutorSpecList &getExecutorSpecs() const { return _executorSpecs; }
+ [[nodiscard]] const ExecutorSpecList &getExecutorSpecs() const { return _executorSpecs; }
/**
* Obtain the location of all named features known to this
@@ -147,7 +150,7 @@ public:
*
* @return feature locations
**/
- const FeatureMap &getFeatureMap() const { return _featureMap; }
+ [[nodiscard]] const FeatureMap &getFeatureMap() const { return _featureMap; }
/**
* Obtain the location of all seeds used by this resolver. This
@@ -158,13 +161,13 @@ public:
*
* @return seed locations
**/
- const FeatureMap &getSeedMap() const { return _seedMap; }
+ [[nodiscard]] const FeatureMap &getSeedMap() const { return _seedMap; }
/**
* Will return any accumulated warnings during compile
* @return list of warnings
**/
- const Warnings & getWarnings() const { return _warnings; }
+ [[nodiscard]] const Warnings & getWarnings() const { return _warnings; }
};
}
diff --git a/searchlib/src/vespa/searchlib/fef/feature_type.h b/searchlib/src/vespa/searchlib/fef/feature_type.h
index 643d0b9ae0f..dea1920e840 100644
--- a/searchlib/src/vespa/searchlib/fef/feature_type.h
+++ b/searchlib/src/vespa/searchlib/fef/feature_type.h
@@ -23,12 +23,12 @@ private:
using TYPE_UP = std::unique_ptr<TYPE>;
TYPE_UP _type;
static const FeatureType _number;
- FeatureType(TYPE_UP type_in) : _type(std::move(type_in)) {}
+ explicit FeatureType(TYPE_UP type_in) : _type(std::move(type_in)) {}
public:
FeatureType(const FeatureType &rhs);
- FeatureType(FeatureType &&rhs) = default;
- bool is_object() const { return (_type.get() != nullptr); }
- const TYPE &type() const;
+ FeatureType(FeatureType &&rhs) noexcept = default;
+ [[nodiscard]] bool is_object() const { return (_type.get() != nullptr); }
+ [[nodiscard]] const TYPE &type() const;
static const FeatureType &number() { return _number; }
static FeatureType object(const TYPE &type_in);
};
diff --git a/searchlib/src/vespa/searchlib/fef/phrase_splitter_query_env.cpp b/searchlib/src/vespa/searchlib/fef/phrase_splitter_query_env.cpp
index 02b1e3616a0..dfa1d9886f7 100644
--- a/searchlib/src/vespa/searchlib/fef/phrase_splitter_query_env.cpp
+++ b/searchlib/src/vespa/searchlib/fef/phrase_splitter_query_env.cpp
@@ -21,7 +21,7 @@ PhraseSplitterQueryEnv::considerTerm(uint32_t termIdx, const ITermData &term, ui
prototype.addField(fieldId);
_phrase_terms.push_back(PhraseTerm(term, _terms.size(), h));
for (uint32_t i = 0; i < term.getPhraseLength(); ++i) {
- _terms.push_back(prototype);
+ _terms.emplace_back(prototype);
_termIdxMap.push_back(TermIdx(_terms.size() - 1, true));
}
return;
diff --git a/searchlib/src/vespa/searchlib/fef/simpletermdata.cpp b/searchlib/src/vespa/searchlib/fef/simpletermdata.cpp
index fdea499f9b4..92245ef21b3 100644
--- a/searchlib/src/vespa/searchlib/fef/simpletermdata.cpp
+++ b/searchlib/src/vespa/searchlib/fef/simpletermdata.cpp
@@ -4,10 +4,9 @@
namespace search::fef {
-SimpleTermData::SimpleTermData()
+SimpleTermData::SimpleTermData() noexcept
: _weight(0),
_numTerms(0),
- _termIndex(0),
_uniqueId(0),
_query_tensor_name(),
_fields()
@@ -21,11 +20,16 @@ SimpleTermData::SimpleTermData(const ITermData &rhs)
_query_tensor_name(rhs.query_tensor_name()),
_fields()
{
+ _fields.reserve(rhs.numFields());
for (size_t i(0), m(rhs.numFields()); i < m; ++i) {
- _fields.push_back(SimpleTermFieldData(rhs.field(i)));
+ _fields.emplace_back(rhs.field(i));
}
}
+SimpleTermData::SimpleTermData(const SimpleTermData &) = default;
+SimpleTermData::SimpleTermData(SimpleTermData &&) noexcept = default;
+SimpleTermData & SimpleTermData::operator=(SimpleTermData &&) noexcept = default;
+
SimpleTermData::~SimpleTermData() = default;
}
diff --git a/searchlib/src/vespa/searchlib/fef/simpletermdata.h b/searchlib/src/vespa/searchlib/fef/simpletermdata.h
index c59816dc687..d501d0848e8 100644
--- a/searchlib/src/vespa/searchlib/fef/simpletermdata.h
+++ b/searchlib/src/vespa/searchlib/fef/simpletermdata.h
@@ -9,8 +9,7 @@
#include <vector>
#include <cassert>
-namespace search {
-namespace fef {
+namespace search::fef {
/**
* Static match data for a single unit (term/phrase/etc).
@@ -20,49 +19,42 @@ class SimpleTermData final : public ITermData
private:
query::Weight _weight;
uint32_t _numTerms;
- uint32_t _termIndex;
uint32_t _uniqueId;
- std::optional<vespalib::string> _query_tensor_name;
-
+ std::optional<vespalib::string> _query_tensor_name;
std::vector<SimpleTermFieldData> _fields;
public:
- /**
- * Creates a new object.
- **/
- SimpleTermData();
-
- /**
- * Side-cast copy constructor.
- **/
+ SimpleTermData() noexcept;
SimpleTermData(const ITermData &rhs);
-
- ~SimpleTermData();
+ SimpleTermData(const SimpleTermData &);
+ SimpleTermData(SimpleTermData &&) noexcept;
+ SimpleTermData & operator=(SimpleTermData &&) noexcept;
+ ~SimpleTermData() override;
//----------- ITermData implementation ------------------------------------
- query::Weight getWeight() const override { return _weight; }
+ [[nodiscard]] query::Weight getWeight() const override { return _weight; }
- uint32_t getPhraseLength() const override { return _numTerms; }
+ [[nodiscard]] uint32_t getPhraseLength() const override { return _numTerms; }
- uint32_t getUniqueId() const override { return _uniqueId; }
+ [[nodiscard]] uint32_t getUniqueId() const override { return _uniqueId; }
- std::optional<vespalib::string> query_tensor_name() const override { return _query_tensor_name; }
+ [[nodiscard]] std::optional<vespalib::string> query_tensor_name() const override { return _query_tensor_name; }
- size_t numFields() const override { return _fields.size(); }
+ [[nodiscard]] size_t numFields() const override { return _fields.size(); }
- const ITermFieldData &field(size_t i) const override {
+ [[nodiscard]] const ITermFieldData &field(size_t i) const override {
return _fields[i];
}
- const ITermFieldData *lookupField(uint32_t fieldId) const override {
+ [[nodiscard]] const ITermFieldData *lookupField(uint32_t fieldId) const override {
for (size_t fieldIdx(0), m(numFields()); fieldIdx < m; ++fieldIdx) {
const ITermFieldData &tfd = field(fieldIdx);
if (tfd.getFieldId() == fieldId) {
return &tfd;
}
}
- return 0;
+ return nullptr;
}
//----------- Utility functions -------------------------------------------
@@ -84,17 +76,6 @@ public:
}
/**
- * Set the location of this term in the original user query.
- *
- * @return this to allow chaining.
- * @param idx term index
- **/
- SimpleTermData &setTermIndex(uint32_t idx) {
- _termIndex = idx;
- return *this;
- }
-
- /**
* Set the unique id of this term. 0 means not set.
*
* @param id unique id or 0
@@ -117,7 +98,7 @@ public:
* @param fieldId field id of the added field
**/
SimpleTermFieldData &addField(uint32_t fieldId) {
- _fields.push_back(SimpleTermFieldData(fieldId));
+ _fields.emplace_back(fieldId);
return _fields.back();
}
@@ -143,11 +124,10 @@ public:
return &tfd;
}
}
- return 0;
+ return nullptr;
}
};
-
/**
* convenience adapter for easy iteration
**/
@@ -161,14 +141,11 @@ public:
: _ref(ref), _idx(0), _lim(ref.numFields())
{}
- bool valid() const { return (_idx < _lim); }
+ [[nodiscard]] bool valid() const { return (_idx < _lim); }
- SimpleTermFieldData& get() const { return _ref.field(_idx); }
+ [[nodiscard]] SimpleTermFieldData& get() const { return _ref.field(_idx); }
void next() { assert(valid()); ++_idx; }
};
-
-} // namespace fef
-} // namespace search
-
+}
diff --git a/searchlib/src/vespa/searchlib/grouping/sketch.h b/searchlib/src/vespa/searchlib/grouping/sketch.h
index b973a99da92..6a2082b793d 100644
--- a/searchlib/src/vespa/searchlib/grouping/sketch.h
+++ b/searchlib/src/vespa/searchlib/grouping/sketch.h
@@ -74,6 +74,7 @@ struct SparseSketch : Sketch<BucketBits, HashT> {
};
std::unordered_set<HashT, IdentityHash> hash_set;
+ ~SparseSketch() override;
[[nodiscard]] size_t getSize() const { return hash_set.size(); }
int aggregate(HashT hash) override {
@@ -184,6 +185,8 @@ struct NormalSketch : Sketch<BucketBits, HashT> {
}
};
+template <int BucketBits, typename HashT>
+SparseSketch<BucketBits, HashT>::~SparseSketch() = default;
template <int BucketBits, typename HashT>
void SparseSketch<BucketBits, HashT>::
diff --git a/searchlib/src/vespa/searchlib/memoryindex/field_inverter.cpp b/searchlib/src/vespa/searchlib/memoryindex/field_inverter.cpp
index a05b39a74a9..25aff06b5ef 100644
--- a/searchlib/src/vespa/searchlib/memoryindex/field_inverter.cpp
+++ b/searchlib/src/vespa/searchlib/memoryindex/field_inverter.cpp
@@ -18,7 +18,9 @@
#include <vespa/searchlib/util/url.h>
#include <vespa/vespalib/datastore/aligner.h>
#include <vespa/vespalib/text/utf8.h>
+#include <vespa/vespalib/util/exceptions.h>
#include <vespa/vespalib/util/stringfmt.h>
+#include <vespa/vespalib/stllike/asciistream.h>
#include <vespa/vespalib/stllike/hash_map.hpp>
#include <stdexcept>
@@ -519,7 +521,7 @@ FieldInverter::applyRemoves()
}
void
-FieldInverter::pushDocuments()
+FieldInverter::push_documents_internal()
{
trimAbortedDocs();
@@ -605,5 +607,18 @@ FieldInverter::pushDocuments()
reset();
}
+void
+FieldInverter::pushDocuments()
+{
+ try {
+ push_documents_internal();
+ } catch (vespalib::OverflowException &e) {
+ const Schema::IndexField &field = _schema.getIndexField(_fieldId);
+ vespalib::asciistream s;
+ s << "FieldInverter::pushDocuments(), caught exception for field " << field.getName();
+ throw vespalib::OverflowException(s.c_str(), e);
+ }
+}
+
}
diff --git a/searchlib/src/vespa/searchlib/memoryindex/field_inverter.h b/searchlib/src/vespa/searchlib/memoryindex/field_inverter.h
index 7995dc56de8..1a582bf8099 100644
--- a/searchlib/src/vespa/searchlib/memoryindex/field_inverter.h
+++ b/searchlib/src/vespa/searchlib/memoryindex/field_inverter.h
@@ -248,6 +248,8 @@ public:
VESPA_DLL_LOCAL void
processAnnotations(const document::StringFieldValue &value);
+ void push_documents_internal();
+
private:
void processNormalDocTextField(const document::StringFieldValue &field);
void processNormalDocArrayTextField(const document::ArrayFieldValue &field);
diff --git a/searchlib/src/vespa/searchlib/query/tree/termnodes.cpp b/searchlib/src/vespa/searchlib/query/tree/termnodes.cpp
index 6e889e76f21..00f17f7963c 100644
--- a/searchlib/src/vespa/searchlib/query/tree/termnodes.cpp
+++ b/searchlib/src/vespa/searchlib/query/tree/termnodes.cpp
@@ -30,7 +30,8 @@ namespace {
class StringTermVector final : public MultiTerm::TermVector {
public:
- StringTermVector(uint32_t sz) : _terms() { _terms.reserve(sz); }
+ explicit StringTermVector(uint32_t sz) : _terms() { _terms.reserve(sz); }
+ ~StringTermVector() override;
void addTerm(stringref term, Weight weight) override {
_terms.emplace_back(term, weight);
}
@@ -39,27 +40,27 @@ public:
auto res = std::to_chars(buf, buf + sizeof(buf), value, 10);
addTerm(stringref(buf, res.ptr - buf), weight);
}
- StringAndWeight getAsString(uint32_t index) const override {
+ [[nodiscard]] StringAndWeight getAsString(uint32_t index) const override {
const auto & v = _terms[index];
- return StringAndWeight(v.first, v.second);
+ return {v.first, v.second};
}
- IntegerAndWeight getAsInteger(uint32_t index) const override {
+ [[nodiscard]] IntegerAndWeight getAsInteger(uint32_t index) const override {
const auto & v = _terms[index];
int64_t value(0);
std::from_chars(v.first.c_str(), v.first.c_str() + v.first.size(), value);
- return IntegerAndWeight(value, v.second);
+ return {value, v.second};
}
- Weight getWeight(uint32_t index) const override {
+ [[nodiscard]] Weight getWeight(uint32_t index) const override {
return _terms[index].second;
}
- uint32_t size() const override { return _terms.size(); }
+ [[nodiscard]] uint32_t size() const override { return _terms.size(); }
private:
std::vector<std::pair<vespalib::string, Weight>> _terms;
};
class IntegerTermVector final : public MultiTerm::TermVector {
public:
- IntegerTermVector(uint32_t sz) : _terms() { _terms.reserve(sz); }
+ explicit IntegerTermVector(uint32_t sz) : _terms() { _terms.reserve(sz); }
void addTerm(stringref, Weight) override {
// Will/should never happen
assert(false);
@@ -71,7 +72,7 @@ public:
const auto & v = _terms[index];
auto res = std::to_chars(_scratchPad, _scratchPad + sizeof(_scratchPad)-1, v.first, 10);
res.ptr[0] = '\0';
- return StringAndWeight(stringref(_scratchPad, res.ptr - _scratchPad), v.second);
+ return {stringref(_scratchPad, res.ptr - _scratchPad), v.second};
}
IntegerAndWeight getAsInteger(uint32_t index) const override {
return _terms[index];
@@ -85,6 +86,8 @@ private:
mutable char _scratchPad[24];
};
+StringTermVector::~StringTermVector() = default;
+
}
MultiTerm::MultiTerm(uint32_t num_terms)
diff --git a/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.cpp b/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.cpp
index 9a29c4c0caf..8e7bd185f85 100644
--- a/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.cpp
+++ b/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.cpp
@@ -601,6 +601,8 @@ SourceBlenderBlueprint::SourceBlenderBlueprint(const ISourceSelector &selector)
{
}
+SourceBlenderBlueprint::~SourceBlenderBlueprint() = default;
+
Blueprint::HitEstimate
SourceBlenderBlueprint::combine(const std::vector<HitEstimate> &data) const
{
diff --git a/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.h b/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.h
index f4ae2e21b41..8cced6097b5 100644
--- a/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.h
+++ b/searchlib/src/vespa/searchlib/queryeval/intermediate_blueprints.h
@@ -177,6 +177,7 @@ private:
public:
SourceBlenderBlueprint(const ISourceSelector &selector);
+ ~SourceBlenderBlueprint() override;
HitEstimate combine(const std::vector<HitEstimate> &data) const override;
FieldSpecBaseList exposeFields() const override;
void sort(Children &children) const override;
diff --git a/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp b/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp
index d22f24cc7da..af332189b61 100644
--- a/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp
+++ b/searchlib/src/vespa/searchlib/tensor/hnsw_index.cpp
@@ -67,12 +67,12 @@ template <>
class GlobalFilterWrapper<HnswIndexType::SINGLE> {
const GlobalFilter *_filter;
public:
- GlobalFilterWrapper(const GlobalFilter *filter)
+ explicit GlobalFilterWrapper(const GlobalFilter *filter)
: _filter(filter)
{
}
- bool check(uint32_t docid) const noexcept { return !_filter || _filter->check(docid); }
+ [[nodiscard]] bool check(uint32_t docid) const noexcept { return !_filter || _filter->check(docid); }
void clamp_nodeid_limit(uint32_t& nodeid_limit) {
if (_filter) {
@@ -86,18 +86,38 @@ class GlobalFilterWrapper<HnswIndexType::MULTI> {
const GlobalFilter *_filter;
uint32_t _docid_limit;
public:
- GlobalFilterWrapper(const GlobalFilter *filter)
+ explicit GlobalFilterWrapper(const GlobalFilter *filter)
: _filter(filter),
_docid_limit(filter ? filter->size() : 0u)
{
}
- bool check(uint32_t docid) const noexcept { return !_filter || (docid < _docid_limit && _filter->check(docid)); }
+ [[nodiscard]] bool check(uint32_t docid) const noexcept { return !_filter || (docid < _docid_limit && _filter->check(docid)); }
static void clamp_nodeid_limit(uint32_t&) { }
};
}
+namespace internal {
+
+PreparedAddNode::PreparedAddNode() noexcept
+ : connections()
+{ }
+PreparedAddNode::PreparedAddNode(std::vector<Links>&& connections_in) noexcept
+ : connections(std::move(connections_in))
+{ }
+PreparedAddNode::~PreparedAddNode() = default;
+PreparedAddNode::PreparedAddNode(PreparedAddNode&& other) noexcept = default;
+
+PreparedAddDoc::PreparedAddDoc(uint32_t docid_in, ReadGuard read_guard_in) noexcept
+ : docid(docid_in),
+ read_guard(std::move(read_guard_in)),
+ nodes()
+{}
+PreparedAddDoc::~PreparedAddDoc() = default;
+PreparedAddDoc::PreparedAddDoc(PreparedAddDoc&& other) noexcept = default;
+}
+
template <HnswIndexType type>
vespalib::datastore::ArrayStoreConfig
HnswIndex<type>::make_default_level_array_store_config()
@@ -415,6 +435,10 @@ HnswIndex<type>::HnswIndex(const DocVectorAccess& vectors, DistanceFunction::UP
template <HnswIndexType type>
HnswIndex<type>::~HnswIndex() = default;
+using internal::PreparedAddNode;
+using internal::PreparedAddDoc;
+using internal::PreparedFirstAddDoc;
+
template <HnswIndexType type>
void
HnswIndex<type>::add_document(uint32_t docid)
@@ -434,7 +458,7 @@ HnswIndex<type>::add_document(uint32_t docid)
}
template <HnswIndexType type>
-typename HnswIndex<type>::PreparedAddDoc
+PreparedAddDoc
HnswIndex<type>::internal_prepare_add(uint32_t docid, VectorBundle input_vectors, vespalib::GenerationHandler::Guard read_guard) const
{
PreparedAddDoc op(docid, std::move(read_guard));
@@ -449,10 +473,10 @@ HnswIndex<type>::internal_prepare_add(uint32_t docid, VectorBundle input_vectors
template <HnswIndexType type>
void
-HnswIndex<type>::internal_prepare_add_node(typename HnswIndex::PreparedAddDoc& op, TypedCells input_vector, const typename GraphType::EntryNode& entry) const
+HnswIndex<type>::internal_prepare_add_node(PreparedAddDoc& op, TypedCells input_vector, const typename GraphType::EntryNode& entry) const
{
int node_max_level = std::min(_level_generator->max_level(), max_max_level);
- std::vector<typename PreparedAddNode::Links> connections(node_max_level + 1);
+ std::vector<PreparedAddNode::Links> connections(node_max_level + 1);
if (entry.nodeid == 0) {
// graph has no entry point
op.nodes.emplace_back(std::move(connections));
diff --git a/searchlib/src/vespa/searchlib/tensor/hnsw_index.h b/searchlib/src/vespa/searchlib/tensor/hnsw_index.h
index 8d348d13f15..984acc6c9a1 100644
--- a/searchlib/src/vespa/searchlib/tensor/hnsw_index.h
+++ b/searchlib/src/vespa/searchlib/tensor/hnsw_index.h
@@ -39,6 +39,29 @@ namespace search::tensor {
* TODO: Add details on how to handle removes.
*/
+namespace internal {
+struct PreparedAddNode {
+ using Links = std::vector<std::pair<uint32_t, vespalib::datastore::EntryRef>>;
+ std::vector<Links> connections;
+
+ PreparedAddNode() noexcept;
+ explicit PreparedAddNode(std::vector<Links>&& connections_in) noexcept;
+ ~PreparedAddNode();
+ PreparedAddNode(PreparedAddNode&& other) noexcept;
+};
+
+struct PreparedFirstAddDoc : public PrepareResult {};
+
+struct PreparedAddDoc : public PrepareResult {
+ using ReadGuard = vespalib::GenerationHandler::Guard;
+ uint32_t docid;
+ ReadGuard read_guard;
+ std::vector<PreparedAddNode> nodes;
+ PreparedAddDoc(uint32_t docid_in, ReadGuard read_guard_in) noexcept;
+ ~PreparedAddDoc();
+ PreparedAddDoc(PreparedAddDoc&& other) noexcept;
+};
+}
template <HnswIndexType type>
class HnswIndex : public NearestNeighborIndex {
public:
@@ -155,43 +178,12 @@ protected:
const GlobalFilter *filter, uint32_t explore_k,
double distance_threshold) const;
- struct PreparedAddNode {
- using Links = std::vector<std::pair<uint32_t, vespalib::datastore::EntryRef>>;
- std::vector<Links> connections;
-
- PreparedAddNode() noexcept
- : connections()
- {
- }
- PreparedAddNode(std::vector<Links>&& connections_in) noexcept
- : connections(std::move(connections_in))
- {
- }
- ~PreparedAddNode() = default;
- PreparedAddNode(PreparedAddNode&& other) noexcept = default;
- };
-
- struct PreparedFirstAddDoc : public PrepareResult {};
-
- struct PreparedAddDoc : public PrepareResult {
- using ReadGuard = vespalib::GenerationHandler::Guard;
- uint32_t docid;
- ReadGuard read_guard;
- std::vector<PreparedAddNode> nodes;
- PreparedAddDoc(uint32_t docid_in, ReadGuard read_guard_in)
- : docid(docid_in),
- read_guard(std::move(read_guard_in)),
- nodes()
- {}
- ~PreparedAddDoc() = default;
- PreparedAddDoc(PreparedAddDoc&& other) = default;
- };
- PreparedAddDoc internal_prepare_add(uint32_t docid, VectorBundle input_vectors,
+ internal::PreparedAddDoc internal_prepare_add(uint32_t docid, VectorBundle input_vectors,
vespalib::GenerationHandler::Guard read_guard) const;
- void internal_prepare_add_node(HnswIndex::PreparedAddDoc& op, TypedCells input_vector, const typename GraphType::EntryNode& entry) const;
- LinkArray filter_valid_nodeids(uint32_t level, const typename PreparedAddNode::Links &neighbors, uint32_t self_nodeid);
- void internal_complete_add(uint32_t docid, PreparedAddDoc &op);
- void internal_complete_add_node(uint32_t nodeid, uint32_t docid, uint32_t subspace, PreparedAddNode &prepared_node);
+ void internal_prepare_add_node(internal::PreparedAddDoc& op, TypedCells input_vector, const typename GraphType::EntryNode& entry) const;
+ LinkArray filter_valid_nodeids(uint32_t level, const internal::PreparedAddNode::Links &neighbors, uint32_t self_nodeid);
+ void internal_complete_add(uint32_t docid, internal::PreparedAddDoc &op);
+ void internal_complete_add_node(uint32_t nodeid, uint32_t docid, uint32_t subspace, internal::PreparedAddNode &prepared_node);
public:
HnswIndex(const DocVectorAccess& vectors, DistanceFunction::UP distance_func,
RandomLevelGenerator::UP level_generator, const HnswIndexConfig& cfg);
diff --git a/searchlib/src/vespa/searchlib/test/weightedchildrenverifiers.h b/searchlib/src/vespa/searchlib/test/weightedchildrenverifiers.h
index 1f3017237a5..208e5cb6de3 100644
--- a/searchlib/src/vespa/searchlib/test/weightedchildrenverifiers.h
+++ b/searchlib/src/vespa/searchlib/test/weightedchildrenverifiers.h
@@ -8,10 +8,10 @@ namespace search::test {
class WeightedChildrenVerifier : public SearchIteratorVerifier {
public:
- WeightedChildrenVerifier() :
- _weights(_num_children, 1)
+ WeightedChildrenVerifier()
+ : _weights(_num_children, 1)
{ }
- ~WeightedChildrenVerifier() {}
+ ~WeightedChildrenVerifier() override {}
protected:
static constexpr size_t _num_children = 7;
@@ -21,15 +21,16 @@ protected:
class IteratorChildrenVerifier : public WeightedChildrenVerifier {
public:
- IteratorChildrenVerifier() :
- WeightedChildrenVerifier(),
- _split_lists(_num_children)
+ IteratorChildrenVerifier()
+ : WeightedChildrenVerifier(),
+ _split_lists(_num_children)
{
auto full_list = getExpectedDocIds();
for (size_t i = 0; i < full_list.size(); ++i) {
_split_lists[i % _num_children].push_back(full_list[i]);
}
}
+ ~IteratorChildrenVerifier() override { }
SearchIterator::UP create(bool strict) const override {
(void) strict;
std::vector<SearchIterator*> children;
@@ -58,7 +59,7 @@ public:
_helper.set_doc(full_list[i], i % _num_children, 1);
}
}
- ~DwaIteratorChildrenVerifier() {}
+ ~DwaIteratorChildrenVerifier() override {}
SearchIterator::UP create(bool strict) const override {
(void) strict;
std::vector<DocumentWeightIterator> children;
@@ -69,9 +70,8 @@ public:
return create(std::move(children));
}
protected:
- virtual SearchIterator::UP create(std::vector<DocumentWeightIterator> && children) const {
- (void) children;
- return SearchIterator::UP();
+ virtual SearchIterator::UP create(std::vector<DocumentWeightIterator> &&) const {
+ return {};
}
DocumentWeightAttributeHelper _helper;
};
diff --git a/slobrok/src/tests/local_rpc_monitor_map/local_rpc_monitor_map_test.cpp b/slobrok/src/tests/local_rpc_monitor_map/local_rpc_monitor_map_test.cpp
index 5b0829f1dff..b7235155f8c 100644
--- a/slobrok/src/tests/local_rpc_monitor_map/local_rpc_monitor_map_test.cpp
+++ b/slobrok/src/tests/local_rpc_monitor_map/local_rpc_monitor_map_test.cpp
@@ -60,6 +60,7 @@ public:
};
struct MapLog : CallLog<MapCall>, MapListener {
+ ~MapLog() override;
void add(const ServiceMapping &mapping) override {
log(MapCall::add(mapping));
}
@@ -73,6 +74,8 @@ struct MapLog : CallLog<MapCall>, MapListener {
}
};
+MapLog::~MapLog() = default;
+
struct MonitorLog : CallLog<MonitorCall>, MappingMonitor {
void start(const ServiceMapping& mapping, bool hurry) override {
log(MonitorCall::start(mapping, hurry));
@@ -84,7 +87,7 @@ struct MonitorLog : CallLog<MonitorCall>, MappingMonitor {
struct MyMappingMonitor : MappingMonitor {
MonitorLog &monitor;
- MyMappingMonitor(MonitorLog &m) : monitor(m) {}
+ explicit MyMappingMonitor(MonitorLog &m) : monitor(m) {}
void start(const ServiceMapping& mapping, bool hurry) override {
monitor.start(mapping, hurry);
}
@@ -160,7 +163,7 @@ struct LocalRpcMonitorMapTest : public ::testing::Test {
map_log.expect({});
}
}
- ~LocalRpcMonitorMapTest();
+ ~LocalRpcMonitorMapTest() override;
};
LocalRpcMonitorMapTest::~LocalRpcMonitorMapTest() = default;
diff --git a/slobrok/src/tests/service_map_history/service_map_history_test.cpp b/slobrok/src/tests/service_map_history/service_map_history_test.cpp
index 398ec91feb2..81058d9c725 100644
--- a/slobrok/src/tests/service_map_history/service_map_history_test.cpp
+++ b/slobrok/src/tests/service_map_history/service_map_history_test.cpp
@@ -14,7 +14,7 @@ using Map = std::map<vespalib::string, vespalib::string>;
struct Dumper : ServiceMapHistory::DiffCompletionHandler {
std::unique_ptr<MapDiff> got = {};
void handle(MapDiff diff) override {
- got = std::make_unique<MapDiff>(diff);
+ got = std::make_unique<MapDiff>(std::move(diff));
}
};
@@ -22,7 +22,7 @@ MapDiff diffGen(ServiceMapHistory &history, uint32_t gen) {
Dumper dumper;
history.asyncGenerationDiff(&dumper, GenCnt(gen));
EXPECT_TRUE(dumper.got);
- return *dumper.got;
+ return std::move(*dumper.got);
}
Map dump(ServiceMapHistory &history) {
@@ -60,7 +60,7 @@ TEST(ServiceMapHistoryTest, empty_inspection) {
empty2.asyncGenerationDiff(&dumper, gen);
}
EXPECT_TRUE(dumper.got);
- auto diff1 = *dumper.got;
+ auto diff1 = std::move(*dumper.got);
EXPECT_FALSE(diff1.is_full_dump());
EXPECT_EQ(diff1.fromGen, gen);
EXPECT_TRUE(diff1.removed.empty());
@@ -140,7 +140,7 @@ TEST(ServiceMapHistoryTest, full_inspection) {
EXPECT_FALSE(dumper.got);
}
EXPECT_TRUE(dumper.got);
- auto diff1 = *dumper.got;
+ auto diff1 = std::move(*dumper.got);
EXPECT_EQ(diff1.fromGen, GenCnt(1987));
EXPECT_TRUE(diff1.removed.empty());
EXPECT_TRUE(diff1.updated.empty());
@@ -162,7 +162,7 @@ public:
got_updates = diff.updated.size();
}
- ~MockListener();
+ ~MockListener() override;
};
MockListener::~MockListener() = default;
diff --git a/slobrok/src/vespa/slobrok/server/map_diff.cpp b/slobrok/src/vespa/slobrok/server/map_diff.cpp
index ea71e1c1269..fb086fbe45b 100644
--- a/slobrok/src/vespa/slobrok/server/map_diff.cpp
+++ b/slobrok/src/vespa/slobrok/server/map_diff.cpp
@@ -4,6 +4,7 @@
namespace slobrok {
+MapDiff::MapDiff(MapDiff &&) noexcept = default;
MapDiff::~MapDiff() = default;
} // namespace slobrok
diff --git a/slobrok/src/vespa/slobrok/server/map_diff.h b/slobrok/src/vespa/slobrok/server/map_diff.h
index a28336eb2e4..638d4cd5d4c 100644
--- a/slobrok/src/vespa/slobrok/server/map_diff.h
+++ b/slobrok/src/vespa/slobrok/server/map_diff.h
@@ -29,6 +29,7 @@ struct MapDiff {
: MapDiff(0, {}, std::move(mappings), to)
{}
+ MapDiff(MapDiff &&) noexcept;
~MapDiff();
// is this a diff from the empty map:
diff --git a/streamingvisitors/src/vespa/searchvisitor/indexenvironment.cpp b/streamingvisitors/src/vespa/searchvisitor/indexenvironment.cpp
index 0131dc5639c..538f3efe44a 100644
--- a/streamingvisitors/src/vespa/searchvisitor/indexenvironment.cpp
+++ b/streamingvisitors/src/vespa/searchvisitor/indexenvironment.cpp
@@ -17,6 +17,8 @@ IndexEnvironment::IndexEnvironment(const ITableManager & tableManager) :
{
}
+IndexEnvironment::IndexEnvironment(const IndexEnvironment &) = default;
+IndexEnvironment::IndexEnvironment(IndexEnvironment &&) noexcept = default;
IndexEnvironment::~IndexEnvironment() = default;
bool
diff --git a/streamingvisitors/src/vespa/searchvisitor/indexenvironment.h b/streamingvisitors/src/vespa/searchvisitor/indexenvironment.h
index 2cc5a450b2e..af037d87076 100644
--- a/streamingvisitors/src/vespa/searchvisitor/indexenvironment.h
+++ b/streamingvisitors/src/vespa/searchvisitor/indexenvironment.h
@@ -32,7 +32,9 @@ private:
public:
IndexEnvironment(const search::fef::ITableManager & tableManager);
- ~IndexEnvironment();
+ IndexEnvironment(IndexEnvironment &&) noexcept;
+ IndexEnvironment(const IndexEnvironment &);
+ ~IndexEnvironment() override;
const search::fef::Properties & getProperties() const override { return _properties; }
diff --git a/vespalib/src/apps/vespa-tsan-digest/tsan_digest.cpp b/vespalib/src/apps/vespa-tsan-digest/tsan_digest.cpp
index d015cdb0f89..b5040583d3a 100644
--- a/vespalib/src/apps/vespa-tsan-digest/tsan_digest.cpp
+++ b/vespalib/src/apps/vespa-tsan-digest/tsan_digest.cpp
@@ -115,9 +115,11 @@ private:
bool _is_read;
bool _is_write;
public:
- StackTrace(const vespalib::string &heading) noexcept
- : _heading(heading), _frames(), _hash(), _is_read(false), _is_write(false) {}
- ~StackTrace() {}
+ StackTrace(const vespalib::string &heading) noexcept;
+ StackTrace(const StackTrace &);
+ StackTrace(StackTrace &&) noexcept;
+ StackTrace & operator=(StackTrace &&) noexcept;
+ ~StackTrace();
void add_frame(const vespalib::string &frame) {
_frames.push_back(frame);
}
@@ -149,7 +151,16 @@ public:
}
};
-std::vector<StackTrace> extract_traces(const std::vector<vespalib::string> &lines, size_t cutoff) {
+StackTrace::StackTrace(const vespalib::string &heading) noexcept
+ : _heading(heading), _frames(), _hash(), _is_read(false), _is_write(false)
+{}
+StackTrace::StackTrace(const StackTrace &) = default;
+StackTrace::StackTrace(StackTrace &&) noexcept = default;
+StackTrace & StackTrace::operator=(StackTrace &&) noexcept = default;
+StackTrace::~StackTrace() = default;
+
+std::vector<StackTrace>
+extract_traces(const std::vector<vespalib::string> &lines, size_t cutoff) {
std::vector<StackTrace> result;
for (size_t i = 1; (i < lines.size()) && (result.size() < cutoff); ++i) {
auto pos = lines[i].find("#0 ");
diff --git a/vespalib/src/tests/datastore/array_store/array_store_test.cpp b/vespalib/src/tests/datastore/array_store/array_store_test.cpp
index 69df94f7181..210c18ddb29 100644
--- a/vespalib/src/tests/datastore/array_store/array_store_test.cpp
+++ b/vespalib/src/tests/datastore/array_store/array_store_test.cpp
@@ -54,12 +54,13 @@ struct ArrayStoreTest : public TestT
generation(1),
add_using_allocate(add_using_allocate_in)
{}
- ArrayStoreTest(const ArrayStoreConfig &storeCfg)
+ explicit ArrayStoreTest(const ArrayStoreConfig &storeCfg)
: store(storeCfg, std::make_unique<MemoryAllocatorObserver>(stats)),
refStore(),
generation(1),
add_using_allocate(false)
{}
+ ~ArrayStoreTest() override;
void assertAdd(const EntryVector &input) {
EntryRef ref = add(input);
assertGet(ref, input);
@@ -163,6 +164,9 @@ struct ArrayStoreTest : public TestT
size_t largeArraySize() const { return sizeof(LargeArray); }
};
+template <typename TestT, typename EntryT, typename RefT>
+ArrayStoreTest<TestT, EntryT, RefT>::~ArrayStoreTest() = default;
+
struct TestParam {
bool add_using_allocate;
TestParam(bool add_using_allocate_in) : add_using_allocate(add_using_allocate_in) {}
diff --git a/vespalib/src/tests/unwind_message/unwind_message_test.cpp b/vespalib/src/tests/unwind_message/unwind_message_test.cpp
index f9f4824f317..ff0ee060ded 100644
--- a/vespalib/src/tests/unwind_message/unwind_message_test.cpp
+++ b/vespalib/src/tests/unwind_message/unwind_message_test.cpp
@@ -20,17 +20,21 @@ struct MyObj {
UnwindMessage msg1 = UnwindMessage("this SHOULD be printed (1/4)");
UnwindMessage msg2 = UnwindMessage("this should NOT be printed (1)");
UnwindMessage msg3 = UnwindMessage("this SHOULD be printed (2/4)");
- ~MyObj() {
- EXPECT_EQ(std::uncaught_exceptions(), 1);
- auto not_printed_1 = std::move(msg2);
- try {
- MyCheck my_check;
- auto printed_1 = std::move(msg1);
- throw E("next level");
- } catch (const E &) {}
- }
+ MyObj();
+ ~MyObj();
};
+MyObj::MyObj() = default;
+MyObj::~MyObj() {
+ EXPECT_EQ(std::uncaught_exceptions(), 1);
+ auto not_printed_1 = std::move(msg2);
+ try {
+ MyCheck my_check;
+ auto printed_1 = std::move(msg1);
+ throw E("next level");
+ } catch (const E &) {}
+}
+
TEST(UnwindMessageTest, unwind_messages_are_printed_when_appropriate) {
auto not_printed_5 = unwind_msg("this should NOT be printed (%d)", 5);
UNWIND_MSG("this should NOT be printed (%d)", 4);
diff --git a/vespalib/src/vespa/vespalib/datastore/buffer_type.cpp b/vespalib/src/vespa/vespalib/datastore/buffer_type.cpp
index d1b16e7ae7a..4a9ba2d33a8 100644
--- a/vespalib/src/vespa/vespalib/datastore/buffer_type.cpp
+++ b/vespalib/src/vespa/vespalib/datastore/buffer_type.cpp
@@ -1,6 +1,8 @@
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "buffer_type.hpp"
+#include <vespa/vespalib/stllike/asciistream.h>
+#include <vespa/vespalib/util/exceptions.h>
#include <algorithm>
#include <cassert>
#include <cmath>
@@ -150,7 +152,24 @@ BufferTypeBase::calcArraysToAlloc(uint32_t bufferId, ElemCount elemsNeeded, bool
if (result > _maxArrays) {
result = _maxArrays;
}
- assert(result >= neededArrays);
+ if (result < neededArrays) {
+ vespalib::asciistream s;
+ s << "BufferTypeBase::calcArraysToAlloc(" <<
+ "bufferId=" << bufferId <<
+ ",elemsNeeeded=" << elemsNeeded <<
+ ",resizing=" << (resizing ? "true" : "false") << ")" <<
+ " wantedArrays=" << wantedArrays <<
+ ", _arraySize=" << _arraySize <<
+ ", _maxArrays=" << _maxArrays <<
+ ", reservedElems=" << reservedElems <<
+ ", liveArrays=" << liveArrays <<
+ ", growArrays=" << growArrays <<
+ ", usedArrays=" << usedArrays <<
+ ", typeid(*this).name=\"" << typeid(*this).name() << "\"" <<
+ ", newArrays=" << result <<
+ " < neededArrays=" << neededArrays;;
+ throw vespalib::OverflowException(s.c_str());
+ }
return result;
}
diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store.hpp b/vespalib/src/vespa/vespalib/datastore/unique_store.hpp
index b8493017020..d9d5f9fee7f 100644
--- a/vespalib/src/vespa/vespalib/datastore/unique_store.hpp
+++ b/vespalib/src/vespa/vespalib/datastore/unique_store.hpp
@@ -10,6 +10,7 @@
#include "unique_store_builder.hpp"
#include "unique_store_dictionary.hpp"
#include "unique_store_enumerator.hpp"
+#include "unique_store_remapper.hpp"
#include <atomic>
#include <algorithm>
diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store_remapper.h b/vespalib/src/vespa/vespalib/datastore/unique_store_remapper.h
index 174c74a62d2..06c74ab0d4f 100644
--- a/vespalib/src/vespa/vespalib/datastore/unique_store_remapper.h
+++ b/vespalib/src/vespa/vespalib/datastore/unique_store_remapper.h
@@ -22,33 +22,12 @@ protected:
EntryRefFilter _filter;
std::vector<std::vector<EntryRef, allocator_large<EntryRef>>> _mapping;
public:
- UniqueStoreRemapper(EntryRefFilter&& filter)
- : _filter(std::move(filter)),
- _mapping()
- {
- }
- virtual ~UniqueStoreRemapper() = default;
-
- EntryRef remap(EntryRef ref) const {
- RefType internal_ref(ref);
- auto &inner_mapping = _mapping[internal_ref.bufferId()];
- assert(internal_ref.offset() < inner_mapping.size());
- EntryRef mapped_ref = inner_mapping[internal_ref.offset()];
- assert(mapped_ref.valid());
- return mapped_ref;
- }
-
- void remap(vespalib::ArrayRef<AtomicEntryRef> refs) const {
- for (auto &atomic_ref : refs) {
- auto ref = atomic_ref.load_relaxed();
- if (ref.valid() && _filter.has(ref)) {
- atomic_ref.store_release(remap(ref));
- }
- }
- }
+ UniqueStoreRemapper(EntryRefFilter&& filter);
+ virtual ~UniqueStoreRemapper();
+ EntryRef remap(EntryRef ref) const;
+ void remap(vespalib::ArrayRef<AtomicEntryRef> refs) const;
const EntryRefFilter& get_entry_ref_filter() const noexcept { return _filter; }
-
virtual void done() = 0;
};
diff --git a/vespalib/src/vespa/vespalib/datastore/unique_store_remapper.hpp b/vespalib/src/vespa/vespalib/datastore/unique_store_remapper.hpp
new file mode 100644
index 00000000000..5d8a4d7ec6f
--- /dev/null
+++ b/vespalib/src/vespa/vespalib/datastore/unique_store_remapper.hpp
@@ -0,0 +1,40 @@
+// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+
+#pragma once
+
+#include "unique_store_remapper.h"
+
+namespace vespalib::datastore {
+
+template <typename RefT>
+UniqueStoreRemapper<RefT>::UniqueStoreRemapper(EntryRefFilter&& filter)
+ : _filter(std::move(filter)),
+ _mapping()
+{
+}
+template <typename RefT>
+UniqueStoreRemapper<RefT>::~UniqueStoreRemapper() = default;
+
+template <typename RefT>
+EntryRef
+UniqueStoreRemapper<RefT>::remap(EntryRef ref) const {
+ RefType internal_ref(ref);
+ auto &inner_mapping = _mapping[internal_ref.bufferId()];
+ assert(internal_ref.offset() < inner_mapping.size());
+ EntryRef mapped_ref = inner_mapping[internal_ref.offset()];
+ assert(mapped_ref.valid());
+ return mapped_ref;
+}
+
+template <typename RefT>
+void
+UniqueStoreRemapper<RefT>::remap(vespalib::ArrayRef<AtomicEntryRef> refs) const {
+ for (auto &atomic_ref : refs) {
+ auto ref = atomic_ref.load_relaxed();
+ if (ref.valid() && _filter.has(ref)) {
+ atomic_ref.store_release(remap(ref));
+ }
+ }
+}
+
+}
diff --git a/vespalib/src/vespa/vespalib/util/cpu_usage.cpp b/vespalib/src/vespa/vespalib/util/cpu_usage.cpp
index 97dbedad66f..89ba03fdab9 100644
--- a/vespalib/src/vespa/vespalib/util/cpu_usage.cpp
+++ b/vespalib/src/vespa/vespalib/util/cpu_usage.cpp
@@ -141,6 +141,8 @@ CpuUsage::CpuUsage()
{
}
+CpuUsage::~CpuUsage() = default;
+
CpuUsage &
CpuUsage::self()
{
diff --git a/vespalib/src/vespa/vespalib/util/cpu_usage.h b/vespalib/src/vespa/vespalib/util/cpu_usage.h
index 31309d88f5f..a5687031522 100644
--- a/vespalib/src/vespa/vespalib/util/cpu_usage.h
+++ b/vespalib/src/vespa/vespalib/util/cpu_usage.h
@@ -166,6 +166,7 @@ private:
CpuUsage(const CpuUsage &) = delete;
CpuUsage &operator=(CpuUsage &&) = delete;
CpuUsage &operator=(const CpuUsage &) = delete;
+ ~CpuUsage();
static CpuUsage &self();
diff --git a/vespalog/src/vespa/log/log_message.cpp b/vespalog/src/vespa/log/log_message.cpp
index 10fb77fcf26..e1356ce5f75 100644
--- a/vespalog/src/vespa/log/log_message.cpp
+++ b/vespalog/src/vespa/log/log_message.cpp
@@ -120,9 +120,10 @@ LogMessage::LogMessage(int64_t time_nanos_in,
{
}
+LogMessage::LogMessage(LogMessage &&) noexcept = default;
+LogMessage & LogMessage::operator=(LogMessage &&) noexcept = default;
LogMessage::~LogMessage() = default;
-
/*
* Parse log line to populate log message class. The parsing is based on
* LegacyForwarder in logd.
diff --git a/vespalog/src/vespa/log/log_message.h b/vespalog/src/vespa/log/log_message.h
index 12a0ac09443..6966ad04f74 100644
--- a/vespalog/src/vespa/log/log_message.h
+++ b/vespalog/src/vespa/log/log_message.h
@@ -23,6 +23,8 @@ class LogMessage {
public:
LogMessage();
+ LogMessage(LogMessage &&) noexcept;
+ LogMessage & operator=(LogMessage &&) noexcept;
LogMessage(int64_t time_nanos_in,
const std::string& hostname_in,
int32_t process_id_in,
diff --git a/vespamalloc/src/tests/test1/new_test.cpp b/vespamalloc/src/tests/test1/new_test.cpp
index 9ea4418aad5..d41258fb115 100644
--- a/vespamalloc/src/tests/test1/new_test.cpp
+++ b/vespamalloc/src/tests/test1/new_test.cpp
@@ -9,6 +9,20 @@
LOG_SETUP("new_test");
+void *wrap_memalign_real(size_t alignment, size_t size)
+{
+ return memalign(alignment, size);
+}
+
+void* (*wrap_memalign)(size_t alignment, size_t size) = wrap_memalign_real;
+
+void *wrap_aligned_alloc_real(size_t alignment, size_t size)
+{
+ return aligned_alloc(alignment, size);
+}
+
+void* (*wrap_aligned_alloc)(size_t alignment, size_t size) = wrap_aligned_alloc_real;
+
void cmp(const void *a, const void *b) {
EXPECT_EQUAL(a, b);
}
@@ -260,33 +274,33 @@ void verify_alignment(void * ptr, size_t align, size_t min_sz) {
}
TEST("test memalign") {
- verify_alignment(memalign(0, 0), 1, 1);
- verify_alignment(memalign(0, 1), 1, 1);
- verify_alignment(memalign(1, 0), 1, 1);
+ verify_alignment(wrap_memalign(0, 0), 1, 1);
+ verify_alignment(wrap_memalign(0, 1), 1, 1);
+ verify_alignment(wrap_memalign(1, 0), 1, 1);
for (size_t align : {3,7,19}) {
// According to man pages these should fail, but it seems it rounds up and does best effort
- verify_alignment(memalign(align, 73), 1ul << vespalib::Optimized::msbIdx(align), 73);
+ verify_alignment(wrap_memalign(align, 73), 1ul << vespalib::Optimized::msbIdx(align), 73);
}
for (size_t align : {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536}) {
- verify_alignment(memalign(align, 1), align, 1);
+ verify_alignment(wrap_memalign(align, 1), align, 1);
}
}
TEST("test aligned_alloc") {
- verify_alignment(aligned_alloc(0, 0), 1, 1);
- verify_alignment(aligned_alloc(0, 1), 1, 1);
- verify_alignment(aligned_alloc(1, 0), 1, 1);
+ verify_alignment(wrap_aligned_alloc(0, 0), 1, 1);
+ verify_alignment(wrap_aligned_alloc(0, 1), 1, 1);
+ verify_alignment(wrap_aligned_alloc(1, 0), 1, 1);
for (size_t align : {3,7,19}) {
// According to man pages these should fail, but it seems it rounds up and does best effort
- verify_alignment(aligned_alloc(align, align*7), 1ul << vespalib::Optimized::msbIdx(align), align*7);
+ verify_alignment(wrap_aligned_alloc(align, align*7), 1ul << vespalib::Optimized::msbIdx(align), align*7);
}
for (size_t align : {1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536}) {
- verify_alignment(aligned_alloc(align, align*7), align, align*7);
+ verify_alignment(wrap_aligned_alloc(align, align*7), align, align*7);
}
for (size_t sz : {31,33,63}) {
// According to man pages these should fail, but it seems it rounds up and does best effort
- verify_alignment(aligned_alloc(32, sz), 32, sz);
+ verify_alignment(wrap_aligned_alloc(32, sz), 32, sz);
}
}