diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2017-03-02 02:00:41 +0100 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2017-03-08 21:38:37 +0000 |
commit | be9df8bfa22cf5a7164f4f3deba44cdbd2b8e7cf (patch) | |
tree | f4a9153a9613f375f3a7dc15fb274a528a1269ed | |
parent | 72e9888bcccbc384d2485409ba055633131ed512 (diff) |
Implement a default destructor to avoid the automatic inlining of large destructors.
163 files changed, 1493 insertions, 829 deletions
diff --git a/document/src/vespa/document/annotation/spannode.cpp b/document/src/vespa/document/annotation/spannode.cpp index 5feaffd8656..1b0ee71cc15 100644 --- a/document/src/vespa/document/annotation/spannode.cpp +++ b/document/src/vespa/document/annotation/spannode.cpp @@ -11,7 +11,8 @@ namespace { class ToStringVisitor : public SpanTreeVisitor { public: - ToStringVisitor() : _os(), _indent() { } + ToStringVisitor(); + ~ToStringVisitor(); vespalib::stringref str() const { return _os.str(); } private: vespalib::asciistream _os; @@ -79,6 +80,9 @@ private: } }; +ToStringVisitor::ToStringVisitor() : _os(), _indent() { } +ToStringVisitor::~ToStringVisitor() { } + } vespalib::string diff --git a/document/src/vespa/document/fieldvalue/stringfieldvalue.cpp b/document/src/vespa/document/fieldvalue/stringfieldvalue.cpp index 04580f906fa..9793184aa0f 100644 --- a/document/src/vespa/document/fieldvalue/stringfieldvalue.cpp +++ b/document/src/vespa/document/fieldvalue/stringfieldvalue.cpp @@ -26,6 +26,8 @@ StringFieldValue::StringFieldValue(const StringFieldValue & rhs) : { } +StringFieldValue::~StringFieldValue() {} + StringFieldValue & StringFieldValue::operator=(const StringFieldValue & rhs) { if (&rhs != this) { diff --git a/document/src/vespa/document/fieldvalue/stringfieldvalue.h b/document/src/vespa/document/fieldvalue/stringfieldvalue.h index bb3c8ddf9d5..b1690a2245a 100644 --- a/document/src/vespa/document/fieldvalue/stringfieldvalue.h +++ b/document/src/vespa/document/fieldvalue/stringfieldvalue.h @@ -30,6 +30,7 @@ public: StringFieldValue &operator=(const StringFieldValue &rhs); StringFieldValue &operator=(const vespalib::stringref &value) override; + ~StringFieldValue(); FieldValue &assign(const FieldValue &) override; diff --git a/document/src/vespa/document/select/valuenode.cpp b/document/src/vespa/document/select/valuenode.cpp index 2138b8eac41..54ab19f3087 100644 --- a/document/src/vespa/document/select/valuenode.cpp +++ b/document/src/vespa/document/select/valuenode.cpp @@ -1,15 +1,15 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "valuenode.h" #include "visitor.h" - -#include <iomanip> -#include <vespa/document/base/exceptions.h> #include "parser.h" +#include <vespa/document/base/exceptions.h> #include <vespa/document/fieldvalue/fieldvalues.h> #include <vespa/vespalib/util/md5.h> #include <vespa/document/util/stringutil.h> #include <vespa/vespalib/text/lowercase.h> #include <regex> +#include <iomanip> + #include <vespa/log/log.h> LOG_SETUP(".document.select.valuenode"); @@ -263,6 +263,9 @@ FieldValueNode::getValue(const Context& context) const } } +FieldValueNode::IteratorHandler::IteratorHandler() { } +FieldValueNode::IteratorHandler::~IteratorHandler() { } + bool FieldValueNode::IteratorHandler::hasSingleValue() const { return _firstValue.get() && (_values.size() == 0); diff --git a/document/src/vespa/document/select/valuenode.h b/document/src/vespa/document/select/valuenode.h index 60d0e3afbb3..cbbc77f8818 100644 --- a/document/src/vespa/document/select/valuenode.h +++ b/document/src/vespa/document/select/valuenode.h @@ -269,6 +269,8 @@ private: class IteratorHandler : public FieldValue::IteratorHandler { public: + IteratorHandler(); + ~IteratorHandler(); bool hasSingleValue() const; std::unique_ptr<Value> getSingleValue(); diff --git a/document/src/vespa/document/serialization/CMakeLists.txt b/document/src/vespa/document/serialization/CMakeLists.txt index e17e4a735e4..212e640b2d8 100644 --- a/document/src/vespa/document/serialization/CMakeLists.txt +++ b/document/src/vespa/document/serialization/CMakeLists.txt @@ -3,6 +3,7 @@ vespa_add_library(document_serialization OBJECT SOURCES annotationdeserializer.cpp annotationserializer.cpp + slime_output_to_vector.cpp vespadocumentserializer.cpp vespadocumentdeserializer.cpp DEPENDS diff --git a/document/src/vespa/document/serialization/slime_output_to_vector.cpp b/document/src/vespa/document/serialization/slime_output_to_vector.cpp new file mode 100644 index 00000000000..210f36e43bc --- /dev/null +++ b/document/src/vespa/document/serialization/slime_output_to_vector.cpp @@ -0,0 +1,14 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#include "slime_output_to_vector.h" + +namespace document { + +SlimeOutputToVector::SlimeOutputToVector() + : _buf(), + _size(0) +{ } + +SlimeOutputToVector::~SlimeOutputToVector() { } + +} diff --git a/document/src/vespa/document/serialization/slime_output_to_vector.h b/document/src/vespa/document/serialization/slime_output_to_vector.h index ae95accdd79..eac460d062f 100644 --- a/document/src/vespa/document/serialization/slime_output_to_vector.h +++ b/document/src/vespa/document/serialization/slime_output_to_vector.h @@ -13,7 +13,8 @@ class SlimeOutputToVector : public vespalib::Output { size_t _size; public: - SlimeOutputToVector() : _buf(), _size(0) {} + SlimeOutputToVector(); + ~SlimeOutputToVector(); vespalib::WritableMemory reserve(size_t reserve) { if (_size + reserve > _buf.size()) { diff --git a/document/src/vespa/document/update/fieldupdate.cpp b/document/src/vespa/document/update/fieldupdate.cpp index e932d985056..5a677488467 100644 --- a/document/src/vespa/document/update/fieldupdate.cpp +++ b/document/src/vespa/document/update/fieldupdate.cpp @@ -27,6 +27,8 @@ FieldUpdate::FieldUpdate(const DocumentTypeRepo& repo, deserialize(repo, type, buffer, version); } +FieldUpdate::~FieldUpdate() {} + bool FieldUpdate::operator==(const FieldUpdate& other) const { diff --git a/document/src/vespa/document/update/fieldupdate.h b/document/src/vespa/document/update/fieldupdate.h index 14766af57e1..d47e5579a31 100644 --- a/document/src/vespa/document/update/fieldupdate.h +++ b/document/src/vespa/document/update/fieldupdate.h @@ -13,8 +13,8 @@ */ #pragma once +#include "valueupdate.h" #include <vespa/document/base/field.h> -#include <vespa/document/update/valueupdate.h> #include <vespa/document/util/serializable.h> namespace document { @@ -34,6 +34,7 @@ public: typedef vespalib::CloneablePtr<FieldUpdate> CP; FieldUpdate(const Field& field); + ~FieldUpdate(); /** * This is a convenience function to construct a field update directly from diff --git a/fastos/src/tests/filetest.cpp b/fastos/src/tests/filetest.cpp index c967fc4caff..dcd1b224464 100644 --- a/fastos/src/tests/filetest.cpp +++ b/fastos/src/tests/filetest.cpp @@ -817,8 +817,14 @@ public: return allWasOk() ? 0 : 1; } + FileTest(); + ~FileTest(); }; +FileTest::FileTest() { } +FileTest::~FileTest() { } + + int main (int argc, char **argv) { FileTest app; diff --git a/memfilepersistence/src/vespa/memfilepersistence/device/directory.cpp b/memfilepersistence/src/vespa/memfilepersistence/device/directory.cpp index 9c03e1eb449..a108ad4d4d9 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/device/directory.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/device/directory.cpp @@ -49,8 +49,13 @@ namespace { std::string path; Device::State status; std::string description; + Entry(); + ~Entry(); }; + Entry::Entry() {} + Entry::~Entry() {} + Entry parseDirectoryString(const std::string& serialized) { while (1) { Entry e; diff --git a/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.cpp b/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.cpp index 7622f421331..3c10efdf0c9 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.cpp @@ -154,6 +154,12 @@ SimpleMemFileIOBuffer::HeaderChunkEncoder::bufferDocument(const Document& doc) doc.serializeHeader(_serializedDoc); } +SimpleMemFileIOBuffer::HeaderChunkEncoder::HeaderChunkEncoder(const document::DocumentId& docId) + : _serializedDoc(DEFAULT_STREAM_ALLOC_SIZE), + _docId(docId.toString()) +{ } +SimpleMemFileIOBuffer::HeaderChunkEncoder::~HeaderChunkEncoder() {} + /** * Buffer is comprised of the following: * - Document header blob (n bytes) diff --git a/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.h b/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.h index 4628291352e..3e91916ff0b 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.h +++ b/memfilepersistence/src/vespa/memfilepersistence/mapper/simplememfileiobuffer.h @@ -157,10 +157,8 @@ public: public: static const size_t DEFAULT_STREAM_ALLOC_SIZE = 5 * 2014; - HeaderChunkEncoder(const document::DocumentId& docId) - : _serializedDoc(DEFAULT_STREAM_ALLOC_SIZE), - _docId(docId.toString()) - { } + HeaderChunkEncoder(const document::DocumentId& docId); + ~HeaderChunkEncoder(); /** * Serializes header chunk to buf, which must have at least a size diff --git a/memfilepersistence/src/vespa/memfilepersistence/tools/dumpslotfile.cpp b/memfilepersistence/src/vespa/memfilepersistence/tools/dumpslotfile.cpp index 1893dc041b2..f3eb1429207 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/tools/dumpslotfile.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/tools/dumpslotfile.cpp @@ -46,48 +46,53 @@ namespace { std::string docId; // bool useConstructor; - CmdOptions(int argc, const char* const* argv) - : vespalib::ProgramOptions(argc, argv), - showSyntaxPage(false) - { - setSyntaxMessage( - "Utility program for showing the contents of the slotfiles " - "used by Vespa Document Storage in a user readable format. " - "Intended for debugging purposes." - ); - addOption("h help", showSyntaxPage, false, - "Shows this help page"); - addOption("n noheader", printHeader, true, - "If given, the header block content is not shown"); - addOption("N nobody", printBody, true, - "If given, the body block content is not shown"); - addOption("f friendly", userFriendlyOutput, false, - "Gives less compact, but more user friendly output"); - addOption("x toxml", toXml, false, - "Print document XML of contained documents"); - addOption("b tobinary", toBinary, false, - "Print binary representations of contained documents"); - addOption("includeremoveddocs", includeRemovedDocs, false, - "When showing XML, include documents that are still in " - "the file, but have been removed."); - addOption("includeremoveentries", includeRemoveEntries, false, - "When showing XML, include remove entries."); - addOption("c documentconfig", documentManConfigId, - std::string("client"), - "The document config to use, needed if deserializing " - "documents."); + CmdOptions(int argc, const char* const* argv); + ~CmdOptions(); + + }; + + CmdOptions::CmdOptions(int argc, const char* const* argv) + : vespalib::ProgramOptions(argc, argv), + showSyntaxPage(false) + { + setSyntaxMessage( + "Utility program for showing the contents of the slotfiles " + "used by Vespa Document Storage in a user readable format. " + "Intended for debugging purposes." + ); + addOption("h help", showSyntaxPage, false, + "Shows this help page"); + addOption("n noheader", printHeader, true, + "If given, the header block content is not shown"); + addOption("N nobody", printBody, true, + "If given, the body block content is not shown"); + addOption("f friendly", userFriendlyOutput, false, + "Gives less compact, but more user friendly output"); + addOption("x toxml", toXml, false, + "Print document XML of contained documents"); + addOption("b tobinary", toBinary, false, + "Print binary representations of contained documents"); + addOption("includeremoveddocs", includeRemovedDocs, false, + "When showing XML, include documents that are still in " + "the file, but have been removed."); + addOption("includeremoveentries", includeRemoveEntries, false, + "When showing XML, include remove entries."); + addOption("c documentconfig", documentManConfigId, + std::string("client"), + "The document config to use, needed if deserializing " + "documents."); // addOption("s sort", metaDataSort, std::string("none"), // "How to sort metadatalist. Valid arguments: " // "bodypos, headerpos & none."); - addOption("t time", timestampToShow, uint64_t(0), - "If set, only present data related to this timestamp, " - "when outputting XML or binary data."); - addOption("docid", docId, std::string(""), - "Retrieve single document using get semantics"); + addOption("t time", timestampToShow, uint64_t(0), + "If set, only present data related to this timestamp, " + "when outputting XML or binary data."); + addOption("docid", docId, std::string(""), + "Retrieve single document using get semantics"); // addOption("useconstructor", useConstructor, false, "Debug option"); - addArgument("slotfile", filename, "The slotfile to dump."); - } - }; + addArgument("slotfile", filename, "The slotfile to dump."); + } + CmdOptions::~CmdOptions() { } void printDoc(document::Document& doc, CmdOptions& o) { if (o.toXml) { @@ -154,41 +159,8 @@ namespace { std::unique_ptr<Environment> _env; EnvironmentImpl(config::ConfigUri& externalConfig, - const char* documentConfigId) - : _compReg(), - _component(_compReg, "dumpslotfile"), - _clock(), - _metrics(_component), - _threadMetrics(_metrics.addThreadMetrics()), - _cache(), - _mapper(*this), - _deviceManager(DeviceMapper::UP(new SimpleDeviceMapper), _clock), - _docType("foo", 1) - { - _compReg.setClock(_clock); - _compReg.setMemoryManager(_memoryMan); - _cache.reset(new MemFileCache(_compReg, _metrics._cache)); - if (documentConfigId == 0) { - _repo.reset(new DocumentTypeRepo(_docType)); - } else { - config::ConfigUri uri( - externalConfig.createWithNewId(documentConfigId)); - std::unique_ptr<document::DocumenttypesConfig> config( - ConfigGetter<DocumenttypesConfig>::getConfig( - uri.getConfigId(), uri.getContext())); - _repo.reset(new DocumentTypeRepo(*config)); - } - _deviceConfig.rootFolder = "."; - std::string configId("defaultId"); - _configSet.addBuilder(configId, &_memFileConfig); - _configSet.addBuilder(configId, &_persistenceConfig); - _configSet.addBuilder(configId, &_deviceConfig); - _configContext.reset(new config::ConfigContext(_configSet)); - _internalConfig.reset( - new config::ConfigUri(configId, _configContext)); - _env.reset(new Environment( - *_internalConfig, *_cache, _mapper, *_repo, _clock, true)); - } + const char* documentConfigId); + ~EnvironmentImpl(); MemFilePersistenceThreadMetrics& getMetrics() const { return *_threadMetrics; @@ -196,6 +168,43 @@ namespace { }; + EnvironmentImpl::EnvironmentImpl(config::ConfigUri& externalConfig, const char* documentConfigId) + : _compReg(), + _component(_compReg, "dumpslotfile"), + _clock(), + _metrics(_component), + _threadMetrics(_metrics.addThreadMetrics()), + _cache(), + _mapper(*this), + _deviceManager(DeviceMapper::UP(new SimpleDeviceMapper), _clock), + _docType("foo", 1) + { + _compReg.setClock(_clock); + _compReg.setMemoryManager(_memoryMan); + _cache.reset(new MemFileCache(_compReg, _metrics._cache)); + if (documentConfigId == 0) { + _repo.reset(new DocumentTypeRepo(_docType)); + } else { + config::ConfigUri uri( + externalConfig.createWithNewId(documentConfigId)); + std::unique_ptr<document::DocumenttypesConfig> config( + ConfigGetter<DocumenttypesConfig>::getConfig( + uri.getConfigId(), uri.getContext())); + _repo.reset(new DocumentTypeRepo(*config)); + } + _deviceConfig.rootFolder = "."; + std::string configId("defaultId"); + _configSet.addBuilder(configId, &_memFileConfig); + _configSet.addBuilder(configId, &_persistenceConfig); + _configSet.addBuilder(configId, &_deviceConfig); + _configContext.reset(new config::ConfigContext(_configSet)); + _internalConfig.reset( + new config::ConfigUri(configId, _configContext)); + _env.reset(new Environment( + *_internalConfig, *_cache, _mapper, *_repo, _clock, true)); + } + EnvironmentImpl::~EnvironmentImpl() {} + } int SlotFileDumper::dump(int argc, const char * const * argv, diff --git a/memfilepersistence/src/vespa/memfilepersistence/tools/vdsdisktool.cpp b/memfilepersistence/src/vespa/memfilepersistence/tools/vdsdisktool.cpp index 0011dddd421..ad9b08f4994 100644 --- a/memfilepersistence/src/vespa/memfilepersistence/tools/vdsdisktool.cpp +++ b/memfilepersistence/src/vespa/memfilepersistence/tools/vdsdisktool.cpp @@ -123,6 +123,7 @@ struct CmdLineOptions : public vespalib::ProgramOptions { "Required when disabling a disk, such that other " "administrators can see why it has happened."); } + ~CmdLineOptions(); vector<std::string> listDir(const std::string& dir) { DIR* dirp = opendir(dir.c_str()); @@ -313,6 +314,7 @@ struct CmdLineOptions : public vespalib::ProgramOptions { }; +CmdLineOptions::~CmdLineOptions() {} int VdsDiskTool::run(int argc, const char * const * argv, diff --git a/messagebus/src/vespa/messagebus/error.cpp b/messagebus/src/vespa/messagebus/error.cpp index 7bbe47319f2..215edaaa938 100644 --- a/messagebus/src/vespa/messagebus/error.cpp +++ b/messagebus/src/vespa/messagebus/error.cpp @@ -11,6 +11,8 @@ Error::Error() _service() { } +Error::~Error() {} + Error::Error(uint32_t c, const string &m, const string &s) : _code(c), _msg(m), diff --git a/messagebus/src/vespa/messagebus/error.h b/messagebus/src/vespa/messagebus/error.h index f94e6532307..d67442c054c 100644 --- a/messagebus/src/vespa/messagebus/error.h +++ b/messagebus/src/vespa/messagebus/error.h @@ -28,6 +28,7 @@ public: * for standard library containers. **/ Error(); + ~Error(); /** * Create a new error with the given code and message diff --git a/messagebus/src/vespa/messagebus/messagebusparams.cpp b/messagebus/src/vespa/messagebus/messagebusparams.cpp index c8efe9f97bd..14edd24a3e0 100644 --- a/messagebus/src/vespa/messagebus/messagebusparams.cpp +++ b/messagebus/src/vespa/messagebus/messagebusparams.cpp @@ -9,9 +9,9 @@ MessageBusParams::MessageBusParams() : _retryPolicy(new RetryTransientErrorsPolicy()), _maxPendingCount(1024), _maxPendingSize(128 * 1024 * 1024) -{ - // empty -} +{ } + +MessageBusParams::~MessageBusParams() {} uint32_t MessageBusParams::getNumProtocols() const diff --git a/messagebus/src/vespa/messagebus/messagebusparams.h b/messagebus/src/vespa/messagebus/messagebusparams.h index 6dbcfb8781f..b6b8accf793 100644 --- a/messagebus/src/vespa/messagebus/messagebusparams.h +++ b/messagebus/src/vespa/messagebus/messagebusparams.h @@ -29,6 +29,7 @@ public: * Constructs a new instance of this parameter object with default values for all members. */ MessageBusParams(); + ~MessageBusParams(); /** * Returns the retry policy for the resender. diff --git a/messagebus/src/vespa/messagebus/network/rpcsendv1.cpp b/messagebus/src/vespa/messagebus/network/rpcsendv1.cpp index 34f979c00be..c62b1c3f0b8 100644 --- a/messagebus/src/vespa/messagebus/network/rpcsendv1.cpp +++ b/messagebus/src/vespa/messagebus/network/rpcsendv1.cpp @@ -66,9 +66,9 @@ RPCSendV1::RPCSendV1() : _net(NULL), _clientIdent("client"), _serverIdent("server") -{ - // empty -} +{ } + +RPCSendV1::~RPCSendV1() {} void RPCSendV1::attach(RPCNetwork &net) diff --git a/messagebus/src/vespa/messagebus/network/rpcsendv1.h b/messagebus/src/vespa/messagebus/network/rpcsendv1.h index 570b3daff82..8ea63f39403 100644 --- a/messagebus/src/vespa/messagebus/network/rpcsendv1.h +++ b/messagebus/src/vespa/messagebus/network/rpcsendv1.h @@ -56,6 +56,7 @@ public: * its attach() method has been called. */ RPCSendV1(); + ~RPCSendV1(); // Implements RPCSendAdapter. void attach(RPCNetwork &net) override; diff --git a/messagebus/src/vespa/messagebus/routing/routingtablespec.cpp b/messagebus/src/vespa/messagebus/routing/routingtablespec.cpp index 06d1aa73d60..9c8c7ac93a9 100644 --- a/messagebus/src/vespa/messagebus/routing/routingtablespec.cpp +++ b/messagebus/src/vespa/messagebus/routing/routingtablespec.cpp @@ -8,9 +8,9 @@ RoutingTableSpec::RoutingTableSpec(const string &protocol) : _protocol(protocol), _hops(), _routes() -{ - // empty -} +{ } + +RoutingTableSpec::~RoutingTableSpec() {} HopSpec RoutingTableSpec::removeHop(uint32_t i) diff --git a/messagebus/src/vespa/messagebus/routing/routingtablespec.h b/messagebus/src/vespa/messagebus/routing/routingtablespec.h index 993031a0adf..8e59ce311a7 100644 --- a/messagebus/src/vespa/messagebus/routing/routingtablespec.h +++ b/messagebus/src/vespa/messagebus/routing/routingtablespec.h @@ -31,6 +31,7 @@ public: * @param protocol The name of the protocol that this belongs to. */ RoutingTableSpec(const string &protocol); + ~RoutingTableSpec(); /** * Returns the name of the protocol that this is the routing table for. diff --git a/metrics/src/vespa/metrics/CMakeLists.txt b/metrics/src/vespa/metrics/CMakeLists.txt index cd5a5ba4629..f93c1fb63c8 100644 --- a/metrics/src/vespa/metrics/CMakeLists.txt +++ b/metrics/src/vespa/metrics/CMakeLists.txt @@ -13,6 +13,7 @@ vespa_add_library(metrics metrictimer.cpp metricvalueset.cpp namehash.cpp + printutils.cpp state_api_adapter.cpp summetric.cpp textwriter.cpp diff --git a/metrics/src/vespa/metrics/printutils.cpp b/metrics/src/vespa/metrics/printutils.cpp new file mode 100644 index 00000000000..c28b74885d6 --- /dev/null +++ b/metrics/src/vespa/metrics/printutils.cpp @@ -0,0 +1,275 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#include "printutils.h" + +namespace metrics { +namespace printutils { + +typedef std::pair<int64_t, bool> LongValue; +typedef std::pair<double, bool> DoubleValue; + +MetricSource::MetricSource(const MetricSnapshot& s, + const String& metricsPrefix, + std::map<String, Metric::SP>* metricsAccessed) + : _snapshot(s), + _metricsPrefix(metricsPrefix), + _metricsAccessedOwner(), + _metricsAccessed(metricsAccessed == 0 ? _metricsAccessedOwner + : *metricsAccessed) + { + } + + Metric::String + MetricSource::createAbsoluteMetricName(const String& name) const { + String prefix = _metricsPrefix; + String addition = name; + while (addition.find("../") == 0) { + String::size_type pos1 = prefix.rfind('.'); + if (pos1 == String::npos) + throw vespalib::IllegalArgumentException( + "Cannot go back anymore in path " + prefix, + VESPA_STRLOC); + prefix = prefix.substr(0, pos1); + addition = addition.substr(3); + } + return (prefix.empty() ? addition : prefix + "." + addition); + } + + MetricSource::SourceMetricVisitor::SourceMetricVisitor(const String& path, bool prefixMatch) + : _stringPath(path), + _path(vespalib::StringTokenizer(path, ".").getTokens()), + _pathIndex(-1), + _resultMetric(), + _prefixMatch(prefixMatch), + _prefixMatches() + { + } + +MetricSource::SourceMetricVisitor::~SourceMetricVisitor() { } + + void + MetricSource::SourceMetricVisitor::checkForPrefixMatch(const Metric& metric) { + if (metric.getName().size() >= _path[_pathIndex].size()) { + if (metric.getName().find(_path[_pathIndex]) == 0) { + _prefixMatches.push_back(metric.getName()); + } + } + } + + bool + MetricSource::SourceMetricVisitor::visitMetricSet(const MetricSet& set, bool) { + if (_pathIndex == -1) { + _pathIndex = 0; + return true; + } + if (_prefixMatch + && static_cast<size_t>(_pathIndex + 1) == _path.size()) + { + for (const Metric * entry : set.getRegisteredMetrics()) { + checkForPrefixMatch(*entry); + } + return false; + } + if (set.getName() != _path[_pathIndex]) return false; + if (static_cast<size_t>(++_pathIndex) >= _path.size()) { + throw vespalib::IllegalArgumentException( + "Path " + _stringPath + " points to a metric set. " + "Only primitive metrics can be retrieved.", + VESPA_STRLOC); + } + return true; + } + bool + MetricSource::SourceMetricVisitor::visitMetric(const Metric& metric, bool) { + if (_prefixMatch) { + checkForPrefixMatch(metric); + } + if (_path[_pathIndex] != metric.getName()) { + return true; + } + if (_prefixMatch) { + throw vespalib::IllegalArgumentException( + "Cannot find existing entries with prefix " + + _stringPath + " since element " + metric.getName() + + " is not a metric set", VESPA_STRLOC); + } + if (static_cast<size_t>(_pathIndex + 1) < _path.size()) { + throw vespalib::IllegalArgumentException( + "Path " + _stringPath + " cannot exist since element " + + _path[_pathIndex] + " is not a metric set: " + + metric.toString(), + VESPA_STRLOC); + } + std::vector<Metric::LP> ownerList; + _resultMetric.reset(metric.clone(ownerList, Metric::INACTIVE, 0)); + if (!ownerList.empty()) { + throw vespalib::IllegalArgumentException( + "Metric " + metric.getName() + " added entries to " + "owners list when cloning. This should not happen " + "for primitive metrics.", VESPA_STRLOC); + } + return false; + } + + const Metric* + MetricSource::getMetric(const String& name) { + String path = createAbsoluteMetricName(name); + std::map<String, Metric::SP>::const_iterator it( + _metricsAccessed.find(path)); + if (it != _metricsAccessed.end()) { + return it->second.get(); + } + SourceMetricVisitor visitor(path, false); + _snapshot.getMetrics().visit(visitor); + if (visitor._resultMetric.get() == 0) { + throw vespalib::IllegalArgumentException( + "Metric " + path + " was not found.", VESPA_STRLOC); + } + Metric::SP metric(visitor._resultMetric.release()); + _metricsAccessed[path] = metric; + return metric.get(); + } + + std::vector<Metric::String> + MetricSource::getPathsMatchingPrefix(const String& prefix) const + { + String path = createAbsoluteMetricName(prefix); + SourceMetricVisitor visitor(path, true); + _snapshot.getMetrics().visit(visitor); + return visitor._prefixMatches; + } + +// Addition functions. Ensure that if floating point value is used, +// result ends up as floating point too. +LongValue operator+(LongValue addend1, LongValue addend2) +{ + return LongValue(addend1.first + addend2.first, + addend1.second && addend2.second); +} + +// Subtraction functions. Ensure that if floating point value is used, +// result ends up as floating point too. +LongValue operator-(LongValue minuend, LongValue subtrahend) +{ + return LongValue(minuend.first - subtrahend.first, + minuend.second && subtrahend.second); +} + +// Multiplication functions. Ensure that if floating point value is used, +// result ends up as floating point too. + +LongValue operator*(LongValue factor1, LongValue factor2) +{ + return std::pair<int64_t, bool>(factor1.first * factor2.first, + factor1.second && factor2.second); +} + +// Division functions. Ensure that if floating point value is used, +// result ends up as floating point too. + +LongValue operator/(LongValue dividend, LongValue divisor) +{ + if (dividend.first == 0) return LongValue( + 0, dividend.second && divisor.second); + if (divisor.first == 0) return LongValue( + std::numeric_limits<int64_t>().max(), + dividend.second && divisor.second); + return LongValue(dividend.first / divisor.first, + dividend.second && divisor.second); +} + +/** Get metric with given name from source. Set bool true if existing. */ +LongValue getLongMetric(const std::string& name, MetricSource& source) +{ + std::string::size_type pos = name.rfind('.'); + const Metric* metric = (pos == std::string::npos + ? 0 : source.getMetric(name.substr(0, pos))); + try{ + return LongValue(metric == 0 + ? 0 : metric->getLongValue(name.substr(pos+1)), metric != 0); + } catch (vespalib::IllegalArgumentException& e) { + return LongValue(0, false); + } +} + +/** Get metric with given name from source. Set bool true if existing. */ +DoubleValue getDoubleMetric(const std::string& name, MetricSource& source) +{ + std::string::size_type pos = name.rfind('.'); + const Metric* metric = (pos == std::string::npos + ? 0 : source.getMetric(name.substr(0, pos))); + try{ + return DoubleValue(metric == 0 + ? 0.0 : metric->getDoubleValue(name.substr(pos+1)), metric != 0); + } catch (vespalib::IllegalArgumentException& e) { + return DoubleValue(0, false); + } +} + +std::string getValueString(LongValue value, const char* format) +{ + if (!value.second) return "na"; + std::vector<char> buffer(30); + snprintf(&buffer[0], 30, format, value.first); + return std::string(&buffer[0]); +} + +std::string getValueString(DoubleValue value, const char* format) +{ + if (!value.second) return "na"; + std::vector<char> buffer(30); + snprintf(&buffer[0], 30, format, value.first); + return std::string(&buffer[0]); +} + + HttpTable::HttpTable(const std::string& title_, const std::string& topLeftText_) + : title(title_), topLeftText(topLeftText_) + {} + HttpTable::~HttpTable() { } + + HttpTable::Row& + HttpTable::operator[](uint32_t i) { + if (i >= cells.size()) cells.resize(i + 1); + return cells[i]; + } + + void + HttpTable::fillInEmptyHoles() { + if (rowNames.size() < cells.size()) rowNames.resize(cells.size()); + if (rowNames.size() > cells.size()) cells.resize(rowNames.size()); + for (uint32_t i=0; i<cells.size(); ++i) { + if (colNames.size() < cells[i].cells.size()) + colNames.resize(cells[i].cells.size()); + if (colNames.size() > cells[i].cells.size()) + cells[i].cells.resize(colNames.size()); + } + } + + void + HttpTable::print(std::ostream& out) { + out << "<h3>" << title << "</h3>\n"; + out << "<table border=\"1\">\n"; + fillInEmptyHoles(); + for (uint32_t i=0; i<=rowNames.size(); ++i) { + if (i == 0) { + out << "<tr><th>" << topLeftText << "</th>"; + for (uint32_t j=0; j<colNames.size(); ++j) { + out << "<th>" << colNames[j] << "</th>"; + } + out << "</tr>\n"; + } else { + out << "<tr><td>" << rowNames[i - 1] << "</td>"; + for (uint32_t j=0; j<colNames.size(); ++j) { + out << "<td align=\"right\">" + << (cells[i - 1][j].set ? cells[i - 1][j].value : "-") + << "</td>"; + } + out << "</tr>\n"; + } + } + out << "</table>\n"; + } + +} // printutils +} // metrics + diff --git a/metrics/src/vespa/metrics/printutils.h b/metrics/src/vespa/metrics/printutils.h index 10925864824..17562e7e064 100644 --- a/metrics/src/vespa/metrics/printutils.h +++ b/metrics/src/vespa/metrics/printutils.h @@ -32,29 +32,9 @@ struct MetricSource { MetricSource(const MetricSnapshot& s, const String& metricsPrefix, - std::map<String, Metric::SP>* metricsAccessed = 0) - : _snapshot(s), - _metricsPrefix(metricsPrefix), - _metricsAccessedOwner(), - _metricsAccessed(metricsAccessed == 0 ? _metricsAccessedOwner - : *metricsAccessed) - { - } - - String createAbsoluteMetricName(const String& name) const { - String prefix = _metricsPrefix; - String addition = name; - while (addition.find("../") == 0) { - String::size_type pos1 = prefix.rfind('.'); - if (pos1 == String::npos) - throw vespalib::IllegalArgumentException( - "Cannot go back anymore in path " + prefix, - VESPA_STRLOC); - prefix = prefix.substr(0, pos1); - addition = addition.substr(3); - } - return (prefix.empty() ? addition : prefix + "." + addition); - } + std::map<String, Metric::SP>* metricsAccessed = 0); + ~MetricSource(); + String createAbsoluteMetricName(const String& name) const; struct SourceMetricVisitor : public metrics::MetricVisitor { String _stringPath; @@ -64,115 +44,25 @@ struct MetricSource { bool _prefixMatch; std::vector<String> _prefixMatches; - SourceMetricVisitor(const String& path, bool prefixMatch) - : _stringPath(path), - _path(vespalib::StringTokenizer(path, ".").getTokens()), - _pathIndex(-1), - _resultMetric(), - _prefixMatch(prefixMatch), - _prefixMatches() - { - } + SourceMetricVisitor(const String& path, bool prefixMatch); + ~SourceMetricVisitor(); - void checkForPrefixMatch(const Metric& metric) { - if (metric.getName().size() >= _path[_pathIndex].size()) { - if (metric.getName().find(_path[_pathIndex]) == 0) { - _prefixMatches.push_back(metric.getName()); - } - } - } + void checkForPrefixMatch(const Metric& metric); - bool visitMetricSet(const MetricSet& set, bool) { - if (_pathIndex == -1) { - _pathIndex = 0; - return true; - } - if (_prefixMatch - && static_cast<size_t>(_pathIndex + 1) == _path.size()) - { - for (const Metric * entry : set.getRegisteredMetrics()) { - checkForPrefixMatch(*entry); - } - return false; - } - if (set.getName() != _path[_pathIndex]) return false; - if (static_cast<size_t>(++_pathIndex) >= _path.size()) { - throw vespalib::IllegalArgumentException( - "Path " + _stringPath + " points to a metric set. " - "Only primitive metrics can be retrieved.", - VESPA_STRLOC); - } - return true; - } + bool visitMetricSet(const MetricSet& set, bool); void doneVisitingMetricSet(const MetricSet&) { --_pathIndex; } - bool visitMetric(const Metric& metric, bool) { - if (_prefixMatch) { - checkForPrefixMatch(metric); - } - if (_path[_pathIndex] != metric.getName()) { - return true; - } - if (_prefixMatch) { - throw vespalib::IllegalArgumentException( - "Cannot find existing entries with prefix " - + _stringPath + " since element " + metric.getName() - + " is not a metric set", VESPA_STRLOC); - } - if (static_cast<size_t>(_pathIndex + 1) < _path.size()) { - throw vespalib::IllegalArgumentException( - "Path " + _stringPath + " cannot exist since element " - + _path[_pathIndex] + " is not a metric set: " - + metric.toString(), - VESPA_STRLOC); - } - std::vector<Metric::LP> ownerList; - _resultMetric.reset(metric.clone(ownerList, Metric::INACTIVE, 0)); - if (!ownerList.empty()) { - throw vespalib::IllegalArgumentException( - "Metric " + metric.getName() + " added entries to " - "owners list when cloning. This should not happen " - "for primitive metrics.", VESPA_STRLOC); - } - return false; - } - + bool visitMetric(const Metric& metric, bool); }; - const Metric* getMetric(const String& name) { - String path = createAbsoluteMetricName(name); - std::map<String, Metric::SP>::const_iterator it( - _metricsAccessed.find(path)); - if (it != _metricsAccessed.end()) { - return it->second.get(); - } - SourceMetricVisitor visitor(path, false); - _snapshot.getMetrics().visit(visitor); - if (visitor._resultMetric.get() == 0) { - throw vespalib::IllegalArgumentException( - "Metric " + path + " was not found.", VESPA_STRLOC); - } - Metric::SP metric(visitor._resultMetric.release()); - _metricsAccessed[path] = metric; - return metric.get(); - } + const Metric* getMetric(const String& name); std::vector<String> - getPathsMatchingPrefix(const String& prefix) const - { - String path = createAbsoluteMetricName(prefix); - SourceMetricVisitor visitor(path, true); - _snapshot.getMetrics().visit(visitor); - return visitor._prefixMatches; - } + getPathsMatchingPrefix(const String& prefix) const; }; // Addition functions. Ensure that if floating point value is used, // result ends up as floating point too. -LongValue operator+(LongValue addend1, LongValue addend2) -{ - return LongValue(addend1.first + addend2.first, - addend1.second && addend2.second); -} +LongValue operator+(LongValue addend1, LongValue addend2); template<typename ValueType1, typename ValueType2> DoubleValue operator+(std::pair<ValueType1, bool> addend1, @@ -184,11 +74,7 @@ DoubleValue operator+(std::pair<ValueType1, bool> addend1, // Subtraction functions. Ensure that if floating point value is used, // result ends up as floating point too. -LongValue operator-(LongValue minuend, LongValue subtrahend) -{ - return LongValue(minuend.first - subtrahend.first, - minuend.second && subtrahend.second); -} +LongValue operator-(LongValue minuend, LongValue subtrahend); template<typename ValueType1, typename ValueType2> DoubleValue operator-(std::pair<ValueType1, bool> minuend, @@ -201,11 +87,7 @@ DoubleValue operator-(std::pair<ValueType1, bool> minuend, // Multiplication functions. Ensure that if floating point value is used, // result ends up as floating point too. -LongValue operator*(LongValue factor1, LongValue factor2) -{ - return std::pair<int64_t, bool>(factor1.first * factor2.first, - factor1.second && factor2.second); -} +LongValue operator*(LongValue factor1, LongValue factor2); template<typename ValueType1, typename ValueType2> DoubleValue operator*(std::pair<ValueType1, bool> factor1, @@ -218,16 +100,7 @@ DoubleValue operator*(std::pair<ValueType1, bool> factor1, // Division functions. Ensure that if floating point value is used, // result ends up as floating point too. -LongValue operator/(LongValue dividend, LongValue divisor) -{ - if (dividend.first == 0) return LongValue( - 0, dividend.second && divisor.second); - if (divisor.first == 0) return LongValue( - std::numeric_limits<int64_t>().max(), - dividend.second && divisor.second); - return LongValue(dividend.first / divisor.first, - dividend.second && divisor.second); -} +LongValue operator/(LongValue dividend, LongValue divisor); template<typename ValueType1, typename ValueType2> DoubleValue operator/(std::pair<ValueType1, bool> dividend, @@ -276,49 +149,10 @@ typedef VW<int64_t> LVW; typedef VW<double> DVW; -/** Get metric with given name from source. Set bool true if existing. */ -LongValue getLongMetric(const std::string& name, MetricSource& source) -{ - std::string::size_type pos = name.rfind('.'); - const Metric* metric = (pos == std::string::npos - ? 0 : source.getMetric(name.substr(0, pos))); - try{ - return LongValue(metric == 0 - ? 0 : metric->getLongValue(name.substr(pos+1)), metric != 0); - } catch (vespalib::IllegalArgumentException& e) { - return LongValue(0, false); - } -} - -/** Get metric with given name from source. Set bool true if existing. */ -DoubleValue getDoubleMetric(const std::string& name, MetricSource& source) -{ - std::string::size_type pos = name.rfind('.'); - const Metric* metric = (pos == std::string::npos - ? 0 : source.getMetric(name.substr(0, pos))); - try{ - return DoubleValue(metric == 0 - ? 0.0 : metric->getDoubleValue(name.substr(pos+1)), metric != 0); - } catch (vespalib::IllegalArgumentException& e) { - return DoubleValue(0, false); - } -} - -std::string getValueString(LongValue value, const char* format = "%'lld") -{ - if (!value.second) return "na"; - std::vector<char> buffer(30); - snprintf(&buffer[0], 30, format, value.first); - return std::string(&buffer[0]); -} - -std::string getValueString(DoubleValue value, const char* format = "%'f") -{ - if (!value.second) return "na"; - std::vector<char> buffer(30); - snprintf(&buffer[0], 30, format, value.first); - return std::string(&buffer[0]); -} +LongValue getLongMetric(const std::string& name, MetricSource& source); +DoubleValue getDoubleMetric(const std::string& name, MetricSource& source); +std::string getValueString(LongValue value, const char* format = "%'lld"); +std::string getValueString(DoubleValue value, const char* format = "%'f"); template<typename ValueType> std::string getByteValueString(std::pair<ValueType, bool> val) @@ -367,48 +201,12 @@ struct HttpTable { }; std::vector<Row> cells; - HttpTable(const std::string& title_, const std::string& topLeftText_) - : title(title_), topLeftText(topLeftText_) {} - - Row& operator[](uint32_t i) { - if (i >= cells.size()) cells.resize(i + 1); - return cells[i]; - } - - void fillInEmptyHoles() { - if (rowNames.size() < cells.size()) rowNames.resize(cells.size()); - if (rowNames.size() > cells.size()) cells.resize(rowNames.size()); - for (uint32_t i=0; i<cells.size(); ++i) { - if (colNames.size() < cells[i].cells.size()) - colNames.resize(cells[i].cells.size()); - if (colNames.size() > cells[i].cells.size()) - cells[i].cells.resize(colNames.size()); - } - } + HttpTable(const std::string& title_, const std::string& topLeftText_); + ~HttpTable(); - void print(std::ostream& out) { - out << "<h3>" << title << "</h3>\n"; - out << "<table border=\"1\">\n"; - fillInEmptyHoles(); - for (uint32_t i=0; i<=rowNames.size(); ++i) { - if (i == 0) { - out << "<tr><th>" << topLeftText << "</th>"; - for (uint32_t j=0; j<colNames.size(); ++j) { - out << "<th>" << colNames[j] << "</th>"; - } - out << "</tr>\n"; - } else { - out << "<tr><td>" << rowNames[i - 1] << "</td>"; - for (uint32_t j=0; j<colNames.size(); ++j) { - out << "<td align=\"right\">" - << (cells[i - 1][j].set ? cells[i - 1][j].value : "-") - << "</td>"; - } - out << "</tr>\n"; - } - } - out << "</table>\n"; - } + Row& operator[](uint32_t i); + void fillInEmptyHoles(); + void print(std::ostream& out); }; } // printutils diff --git a/persistence/src/vespa/persistence/spi/CMakeLists.txt b/persistence/src/vespa/persistence/spi/CMakeLists.txt index dd0478c0c6a..798084f1abe 100644 --- a/persistence/src/vespa/persistence/spi/CMakeLists.txt +++ b/persistence/src/vespa/persistence/spi/CMakeLists.txt @@ -12,6 +12,7 @@ vespa_add_library(persistence_spi OBJECT metricpersistenceprovider.cpp read_consistency.cpp result + selection.cpp docentry DEPENDS ) diff --git a/persistence/src/vespa/persistence/spi/selection.cpp b/persistence/src/vespa/persistence/spi/selection.cpp new file mode 100644 index 00000000000..2f29c2c93c2 --- /dev/null +++ b/persistence/src/vespa/persistence/spi/selection.cpp @@ -0,0 +1,19 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#include "selection.h" + +namespace storage { +namespace spi { + +Selection::Selection(const DocumentSelection& docSel) + : _documentSelection(docSel), + _fromTimestamp(0), + _toTimestamp(INT64_MAX), + _timestampSubset() +{ } + +Selection::~Selection() { } + +} // spi +} // storage + diff --git a/persistence/src/vespa/persistence/spi/selection.h b/persistence/src/vespa/persistence/spi/selection.h index 84408d63517..0501475e802 100644 --- a/persistence/src/vespa/persistence/spi/selection.h +++ b/persistence/src/vespa/persistence/spi/selection.h @@ -27,12 +27,8 @@ private: TimestampSubset _timestampSubset; public: - Selection(const DocumentSelection& docSel) - : _documentSelection(docSel), - _fromTimestamp(0), - _toTimestamp(INT64_MAX), - _timestampSubset() - { } + Selection(const DocumentSelection& docSel); + ~Selection(); const DocumentSelection& getDocumentSelection() const { return _documentSelection; diff --git a/searchcommon/src/vespa/searchcommon/common/schema.cpp b/searchcommon/src/vespa/searchcommon/common/schema.cpp index 394067f36a1..f2e64cd943e 100644 --- a/searchcommon/src/vespa/searchcommon/common/schema.cpp +++ b/searchcommon/src/vespa/searchcommon/common/schema.cpp @@ -240,7 +240,9 @@ Schema::Schema() } Schema::Schema(const Schema & rhs) = default; - +Schema & Schema::operator=(const Schema & rhs) = default; +Schema::Schema(Schema && rhs) = default; +Schema & Schema::operator=(Schema && rhs) = default; Schema::~Schema() { } bool diff --git a/searchcommon/src/vespa/searchcommon/common/schema.h b/searchcommon/src/vespa/searchcommon/common/schema.h index f1b401b04a9..f40fb3d12ac 100644 --- a/searchcommon/src/vespa/searchcommon/common/schema.h +++ b/searchcommon/src/vespa/searchcommon/common/schema.h @@ -170,6 +170,9 @@ public: **/ Schema(); Schema(const Schema & rhs); + Schema & operator=(const Schema & rhs); + Schema(Schema && rhs); + Schema & operator=(Schema && rhs); ~Schema(); /** diff --git a/searchcore/src/tests/proton/docsummary/summaryfieldconverter_test.cpp b/searchcore/src/tests/proton/docsummary/summaryfieldconverter_test.cpp index 5159f5b6061..f3f495925f0 100644 --- a/searchcore/src/tests/proton/docsummary/summaryfieldconverter_test.cpp +++ b/searchcore/src/tests/proton/docsummary/summaryfieldconverter_test.cpp @@ -110,21 +110,26 @@ struct FieldBlock { search::RawBuf binary; vespalib::string json; - explicit FieldBlock(const vespalib::string &jsonInput) - : input(jsonInput), slime(), binary(1024), json() + explicit FieldBlock(const vespalib::string &jsonInput); + ~FieldBlock(); +}; + +FieldBlock::FieldBlock(const vespalib::string &jsonInput) + : input(jsonInput), slime(), binary(1024), json() +{ + size_t used = vespalib::slime::JsonFormat::decode(jsonInput, slime); + EXPECT_EQUAL(jsonInput.size(), used); { - size_t used = vespalib::slime::JsonFormat::decode(jsonInput, slime); - EXPECT_EQUAL(jsonInput.size(), used); - { - search::SlimeOutputRawBufAdapter adapter(binary); - vespalib::slime::JsonFormat::encode(slime, adapter, true); - json.assign(binary.GetDrainPos(), binary.GetUsedLen()); - binary.reset(); - } search::SlimeOutputRawBufAdapter adapter(binary); - vespalib::slime::BinaryFormat::encode(slime, adapter); + vespalib::slime::JsonFormat::encode(slime, adapter, true); + json.assign(binary.GetDrainPos(), binary.GetUsedLen()); + binary.reset(); } -}; + search::SlimeOutputRawBufAdapter adapter(binary); + vespalib::slime::BinaryFormat::encode(slime, adapter); +} + +FieldBlock::~FieldBlock() {} class Test : public vespalib::TestApp { std::unique_ptr<Schema> _schema; diff --git a/searchcore/src/tests/proton/verify_ranksetup/verify_ranksetup_test.cpp b/searchcore/src/tests/proton/verify_ranksetup/verify_ranksetup_test.cpp index 5d56966c920..fcbf4e3c241 100644 --- a/searchcore/src/tests/proton/verify_ranksetup/verify_ranksetup_test.cpp +++ b/searchcore/src/tests/proton/verify_ranksetup/verify_ranksetup_test.cpp @@ -51,9 +51,8 @@ struct Model { std::map<std::string,std::string> constants; std::vector<bool> extra_profiles; std::vector<std::string> imported_attributes; - Model() : indexes(), attributes(), properties(), extra_profiles(), imported_attributes() { - verify_dir(); - } + Model(); + ~Model(); void index(const std::string &name, schema::DataType data_type, schema::CollectionType collection_type) { @@ -170,6 +169,16 @@ struct Model { } }; +Model::Model() + : indexes(), + attributes(), + properties(), + extra_profiles() +{ + verify_dir(); +} +Model::~Model() {} + //----------------------------------------------------------------------------- struct EmptyModel : Model {}; diff --git a/searchcore/src/vespa/searchcore/proton/attribute/CMakeLists.txt b/searchcore/src/vespa/searchcore/proton/attribute/CMakeLists.txt index 6e85cc79638..a82fb1f3928 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/CMakeLists.txt +++ b/searchcore/src/vespa/searchcore/proton/attribute/CMakeLists.txt @@ -3,6 +3,7 @@ vespa_add_library(searchcore_attribute STATIC SOURCES address_space_usage_stats.cpp attribute_collection_spec_factory.cpp + attribute_collection_spec.cpp attribute_factory.cpp attribute_initializer.cpp attribute_manager_explorer.cpp diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_collection_spec.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_collection_spec.cpp new file mode 100644 index 00000000000..aba6ab99ce1 --- /dev/null +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_collection_spec.cpp @@ -0,0 +1,37 @@ +// Copyright 2017 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#include "attribute_collection_spec.h" + +namespace proton { + +AttributeCollectionSpec::Attribute::Attribute(const vespalib::string &name, + const search::attribute::Config &cfg) + : _name(name), + _cfg(cfg) +{ +} + +AttributeCollectionSpec::Attribute::Attribute(const Attribute &) = default; + +AttributeCollectionSpec::Attribute & +AttributeCollectionSpec::Attribute::operator=(const Attribute &) = default; + +AttributeCollectionSpec::Attribute::Attribute(Attribute &&) = default; + +AttributeCollectionSpec::Attribute & +AttributeCollectionSpec::Attribute::operator=(Attribute &&) = default; + +AttributeCollectionSpec::Attribute::~Attribute() { } + +AttributeCollectionSpec::AttributeCollectionSpec(const AttributeList &attributes, + uint32_t docIdLimit, + SerialNum currentSerialNum) + : _attributes(attributes), + _docIdLimit(docIdLimit), + _currentSerialNum(currentSerialNum) +{ +} + +AttributeCollectionSpec::~AttributeCollectionSpec() { } + +} diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_collection_spec.h b/searchcore/src/vespa/searchcore/proton/attribute/attribute_collection_spec.h index 7e1b65da197..ee5f913cb88 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_collection_spec.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_collection_spec.h @@ -24,11 +24,12 @@ public: search::attribute::Config _cfg; public: Attribute(const vespalib::string &name, - const search::attribute::Config &cfg) - : _name(name), - _cfg(cfg) - { - } + const search::attribute::Config &cfg); + Attribute(const Attribute &); + Attribute & operator=(const Attribute &); + Attribute(Attribute &&); + Attribute & operator=(Attribute &&); + ~Attribute(); const vespalib::string &getName() const { return _name; } const search::attribute::Config &getConfig() const { return _cfg; } }; @@ -45,12 +46,8 @@ private: public: AttributeCollectionSpec(const AttributeList &attributes, uint32_t docIdLimit, - SerialNum currentSerialNum) - : _attributes(attributes), - _docIdLimit(docIdLimit), - _currentSerialNum(currentSerialNum) - { - } + SerialNum currentSerialNum); + ~AttributeCollectionSpec(); const AttributeList &getAttributes() const { return _attributes; } diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_initializer.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_initializer.cpp index c1e4077d82d..2f657637740 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_initializer.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_initializer.cpp @@ -100,6 +100,8 @@ AttributeInitializer::AttributeHeader::AttributeHeader() { } +AttributeInitializer::AttributeHeader::~AttributeHeader() {} + AttributeVector::SP AttributeInitializer::tryLoadAttribute(const IndexMetaInfo &info) const { @@ -187,6 +189,8 @@ AttributeInitializer::AttributeInitializer(const vespalib::string &baseDir, { } +AttributeInitializer::~AttributeInitializer() {} + search::AttributeVector::SP AttributeInitializer::init() const { diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_initializer.h b/searchcore/src/vespa/searchcore/proton/attribute/attribute_initializer.h index bfcb9ad5225..b1f973fe72b 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_initializer.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_initializer.h @@ -24,6 +24,7 @@ public: vespalib::string _btString; vespalib::string _ctString; AttributeHeader(); + ~AttributeHeader(); }; private: @@ -52,6 +53,7 @@ public: const search::attribute::Config &cfg, uint64_t currentSerialNum, const IAttributeFactory &factory); + ~AttributeInitializer(); search::AttributeVector::SP init() const; uint64_t getCurrentSerialNum() const { return _currentSerialNum; } diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_manager_initializer.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_manager_initializer.cpp index 98509cb5315..073c1c5110d 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_manager_initializer.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_manager_initializer.cpp @@ -56,22 +56,33 @@ public: AttributeInitializerTasksBuilder(InitializerTask &attrMgrInitTask, InitializerTask::SP documentMetaStoreInitTask, DocumentMetaStore::SP documentMetaStore, - InitializedAttributesResult &attributesResult) - : _attrMgrInitTask(attrMgrInitTask), - _documentMetaStoreInitTask(documentMetaStoreInitTask), - _documentMetaStore(documentMetaStore), - _attributesResult(attributesResult) - {} - virtual void add(AttributeInitializer::UP initializer) override { - InitializerTask::SP attributeInitTask = - std::make_shared<AttributeInitializerTask>(std::move(initializer), - _documentMetaStore, - _attributesResult); - attributeInitTask->addDependency(_documentMetaStoreInitTask); - _attrMgrInitTask.addDependency(attributeInitTask); - } + InitializedAttributesResult &attributesResult); + ~AttributeInitializerTasksBuilder(); + void add(AttributeInitializer::UP initializer) override; }; +AttributeInitializerTasksBuilder::AttributeInitializerTasksBuilder(InitializerTask &attrMgrInitTask, + InitializerTask::SP documentMetaStoreInitTask, + DocumentMetaStore::SP documentMetaStore, + InitializedAttributesResult &attributesResult) + : _attrMgrInitTask(attrMgrInitTask), + _documentMetaStoreInitTask(documentMetaStoreInitTask), + _documentMetaStore(documentMetaStore), + _attributesResult(attributesResult) +{ } + +AttributeInitializerTasksBuilder::~AttributeInitializerTasksBuilder() {} + +void +AttributeInitializerTasksBuilder::add(AttributeInitializer::UP initializer) { + InitializerTask::SP attributeInitTask = + std::make_shared<AttributeInitializerTask>(std::move(initializer), + _documentMetaStore, + _attributesResult); + attributeInitTask->addDependency(_documentMetaStoreInitTask); + _attrMgrInitTask.addDependency(attributeInitTask); +} + } AttributeCollectionSpec::UP diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp index 3ab81dadc96..b19792bef61 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.cpp @@ -195,6 +195,8 @@ AttributeWriter::AttributeWriter(const proton::IAttributeManager::SP &mgr) { } +AttributeWriter::~AttributeWriter() {} + std::vector<search::AttributeVector *> AttributeWriter::getWritableAttributes() const { diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.h b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.h index e0db78bcbcd..32b23d93e4c 100644 --- a/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.h +++ b/searchcore/src/vespa/searchcore/proton/attribute/attribute_writer.h @@ -35,6 +35,7 @@ private: public: AttributeWriter(const proton::IAttributeManager::SP &mgr); + ~AttributeWriter(); /** * Implements IAttributeWriter. diff --git a/searchcore/src/vespa/searchcore/proton/common/schemautil.cpp b/searchcore/src/vespa/searchcore/proton/common/schemautil.cpp index da7e89d8f59..e28fe0d2290 100644 --- a/searchcore/src/vespa/searchcore/proton/common/schemautil.cpp +++ b/searchcore/src/vespa/searchcore/proton/common/schemautil.cpp @@ -1,5 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include "schemautil.h" #include <vespa/log/log.h> @@ -9,8 +8,7 @@ using namespace search::index; namespace proton { -namespace -{ +namespace { class FieldQuad { @@ -23,13 +21,8 @@ public: FieldQuad(const vespalib::string &name, const vespalib::string &dataType, const vespalib::string &collectionType, - const vespalib::string &location) - : _name(name), - _dataType(dataType), - _collectionType(collectionType), - _location(location) - { - } + const vespalib::string &location); + ~FieldQuad(); bool operator<(const FieldQuad &rhs) const @@ -44,6 +37,18 @@ public: } }; +FieldQuad::FieldQuad(const vespalib::string &name, + const vespalib::string &dataType, + const vespalib::string &collectionType, + const vespalib::string &location) + : _name(name), + _dataType(dataType), + _collectionType(collectionType), + _location(location) +{ +} +FieldQuad::~FieldQuad() {} + } diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.cpp index 37735d42e8c..27e5dda1358 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.cpp +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.cpp @@ -46,6 +46,8 @@ LidAllocator::LidAllocator(uint32_t size, } +LidAllocator::~LidAllocator() {} + LidAllocator::DocId LidAllocator::getFreeLid(DocId lidLimit) { diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.h b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.h index 49e8b0624a6..eddb010250a 100644 --- a/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.h +++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/lid_allocator.h @@ -37,6 +37,7 @@ public: uint32_t capacity, vespalib::GenerationHolder &genHolder, const search::GrowStrategy & grow); + ~LidAllocator(); DocId getFreeLid(DocId lidLimit); DocId peekFreeLid(DocId lidLimit); diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.cpp b/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.cpp index 7b1b8d967b5..d2df187deb6 100644 --- a/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.cpp +++ b/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.cpp @@ -34,12 +34,21 @@ findOldestFlushedSerial(const IFlushTarget::List &lst, } +FlushEngine::FlushMeta::FlushMeta(const vespalib::string & name, fastos::TimeStamp start, uint32_t id) : + _name(name), + _start(start), + _id(id) +{ } +FlushEngine::FlushMeta::~FlushMeta() { } + FlushEngine::FlushInfo::FlushInfo() : FlushMeta("", fastos::ClockSystem::now(), 0), _target() { } +FlushEngine::FlushInfo::~FlushInfo() { } + FlushEngine::FlushInfo::FlushInfo(uint32_t taskId, const IFlushTarget::SP &target, diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.h b/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.h index e76ec5e7e0c..8f6c8faeea5 100644 --- a/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.h +++ b/searchcore/src/vespa/searchcore/proton/flushengine/flushengine.h @@ -18,11 +18,8 @@ class FlushEngine : public FastOS_Runnable public: class FlushMeta { public: - FlushMeta(const vespalib::string & name, fastos::TimeStamp start, uint32_t id) : - _name(name), - _start(start), - _id(id) - { } + FlushMeta(const vespalib::string & name, fastos::TimeStamp start, uint32_t id); + ~FlushMeta(); const vespalib::string & getName() const { return _name; } fastos::TimeStamp getStart() const { return _start; } uint32_t getId() const { return _id; } @@ -40,6 +37,7 @@ private: FlushInfo(uint32_t taskId, const IFlushTarget::SP &target, const vespalib::string &destination); + ~FlushInfo(); IFlushTarget::SP _target; }; diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_loop_communicator.cpp b/searchcore/src/vespa/searchcore/proton/matching/match_loop_communicator.cpp index 52af7fa0f39..626305c7877 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/match_loop_communicator.cpp +++ b/searchcore/src/vespa/searchcore/proton/matching/match_loop_communicator.cpp @@ -6,6 +6,13 @@ namespace proton { namespace matching { +MatchLoopCommunicator::MatchLoopCommunicator(size_t threads, size_t topN) + : _estimate_match_frequency(threads), + _selectBest(threads, topN), + _rangeCover(threads) +{} +MatchLoopCommunicator::~MatchLoopCommunicator() {} + void MatchLoopCommunicator::EstimateMatchFrequency::mingle() { diff --git a/searchcore/src/vespa/searchcore/proton/matching/match_loop_communicator.h b/searchcore/src/vespa/searchcore/proton/matching/match_loop_communicator.h index 61ec70c2a96..08ac92d6f04 100644 --- a/searchcore/src/vespa/searchcore/proton/matching/match_loop_communicator.h +++ b/searchcore/src/vespa/searchcore/proton/matching/match_loop_communicator.h @@ -42,8 +42,8 @@ private: RangeCover _rangeCover; public: - MatchLoopCommunicator(size_t threads, size_t topN) - : _estimate_match_frequency(threads), _selectBest(threads, topN), _rangeCover(threads) {} + MatchLoopCommunicator(size_t threads, size_t topN); + ~MatchLoopCommunicator(); virtual double estimate_match_frequency(const Matches &matches) { return _estimate_match_frequency.rendezvous(matches); diff --git a/searchcore/src/vespa/searchcore/proton/metrics/content_proton_metrics.cpp b/searchcore/src/vespa/searchcore/proton/metrics/content_proton_metrics.cpp index ba86b563f61..208be7df405 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/content_proton_metrics.cpp +++ b/searchcore/src/vespa/searchcore/proton/metrics/content_proton_metrics.cpp @@ -1,8 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.metrics.content_proton_metrics"); #include "content_proton_metrics.h" namespace proton { @@ -14,4 +11,6 @@ ContentProtonMetrics::ContentProtonMetrics() { } +ContentProtonMetrics::~ContentProtonMetrics() {} + } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/metrics/content_proton_metrics.h b/searchcore/src/vespa/searchcore/proton/metrics/content_proton_metrics.h index bf720d59a36..55c0bacc2cf 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/content_proton_metrics.h +++ b/searchcore/src/vespa/searchcore/proton/metrics/content_proton_metrics.h @@ -22,6 +22,7 @@ struct ContentProtonMetrics : metrics::MetricSet ResourceUsageMetrics resourceUsage; ContentProtonMetrics(); + ~ContentProtonMetrics(); }; diff --git a/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.cpp b/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.cpp index 213c869a8e4..22649d43dd3 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.cpp +++ b/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.cpp @@ -1,8 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.metrics.documentdb_tagged_metrics"); #include "documentdb_tagged_metrics.h" #include <vespa/vespalib/util/stringfmt.h> @@ -28,8 +25,9 @@ DocumentDBTaggedMetrics::JobMetrics::JobMetrics(metrics::MetricSet* parent) { } -DocumentDBTaggedMetrics::SubDBMetrics::SubDBMetrics(const vespalib::string &name, - MetricSet *parent) +DocumentDBTaggedMetrics::JobMetrics::~JobMetrics() {} + +DocumentDBTaggedMetrics::SubDBMetrics::SubDBMetrics(const vespalib::string &name, MetricSet *parent) : MetricSet(name, "", "Sub database metrics", parent), lidSpace(this), documentStore(this), @@ -37,6 +35,8 @@ DocumentDBTaggedMetrics::SubDBMetrics::SubDBMetrics(const vespalib::string &name { } +DocumentDBTaggedMetrics::SubDBMetrics::~SubDBMetrics() { } + DocumentDBTaggedMetrics::SubDBMetrics::LidSpaceMetrics::LidSpaceMetrics(MetricSet *parent) : MetricSet("lid_space", "", "Local document id (lid) space metrics for this document sub DB", parent), lidLimit("lid_limit", "", "The size of the allocated lid space", this), @@ -51,6 +51,8 @@ DocumentDBTaggedMetrics::SubDBMetrics::LidSpaceMetrics::LidSpaceMetrics(MetricSe { } +DocumentDBTaggedMetrics::SubDBMetrics::LidSpaceMetrics::~LidSpaceMetrics() { } + DocumentDBTaggedMetrics::SubDBMetrics::DocumentStoreMetrics::DocumentStoreMetrics(MetricSet *parent) : MetricSet("document_store", "", "document store metrics for this document sub DB", parent), diskUsage("disk_usage", "", "Disk space usage in bytes", this), @@ -60,12 +62,16 @@ DocumentDBTaggedMetrics::SubDBMetrics::DocumentStoreMetrics::DocumentStoreMetric { } +DocumentDBTaggedMetrics::SubDBMetrics::DocumentStoreMetrics::~DocumentStoreMetrics() {} + DocumentDBTaggedMetrics::AttributeMetrics::AttributeMetrics(MetricSet *parent) : MetricSet("attribute", "", "Attribute vector metrics for this document db", parent), resourceUsage(this) { } +DocumentDBTaggedMetrics::AttributeMetrics::~AttributeMetrics() {} + DocumentDBTaggedMetrics::AttributeMetrics::ResourceUsageMetrics::ResourceUsageMetrics(MetricSet *parent) : MetricSet("resource_usage", "", "Usage metrics for various attribute vector resources", parent), enumStore("enum_store", "", "The highest relative amount of enum store address space used among " @@ -82,6 +88,8 @@ DocumentDBTaggedMetrics::IndexMetrics::IndexMetrics(MetricSet *parent) { } +DocumentDBTaggedMetrics::IndexMetrics::~IndexMetrics() {} + DocumentDBTaggedMetrics::DocumentDBTaggedMetrics(const vespalib::string &docTypeName) : MetricSet("documentdb", {{"documenttype", docTypeName}}, "Document DB metrics", nullptr), job(this), @@ -93,4 +101,6 @@ DocumentDBTaggedMetrics::DocumentDBTaggedMetrics(const vespalib::string &docType { } +DocumentDBTaggedMetrics::~DocumentDBTaggedMetrics() {} + } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.h b/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.h index 323d0766e6f..e9cd00e7553 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.h +++ b/searchcore/src/vespa/searchcore/proton/metrics/documentdb_tagged_metrics.h @@ -27,6 +27,7 @@ struct DocumentDBTaggedMetrics : metrics::MetricSet metrics::DoubleAverageMetric total; JobMetrics(metrics::MetricSet *parent); + ~JobMetrics(); }; struct SubDBMetrics : metrics::MetricSet @@ -41,6 +42,7 @@ struct DocumentDBTaggedMetrics : metrics::MetricSet metrics::DoubleValueMetric lidFragmentationFactor; LidSpaceMetrics(metrics::MetricSet *parent); + ~LidSpaceMetrics(); }; struct DocumentStoreMetrics : metrics::MetricSet @@ -51,6 +53,7 @@ struct DocumentDBTaggedMetrics : metrics::MetricSet MemoryUsageMetrics memoryUsage; DocumentStoreMetrics(metrics::MetricSet *parent); + ~DocumentStoreMetrics(); }; LidSpaceMetrics lidSpace; @@ -58,6 +61,7 @@ struct DocumentDBTaggedMetrics : metrics::MetricSet proton::AttributeMetrics attributes; SubDBMetrics(const vespalib::string &name, metrics::MetricSet *parent); + ~SubDBMetrics(); }; struct AttributeMetrics : metrics::MetricSet @@ -69,11 +73,13 @@ struct DocumentDBTaggedMetrics : metrics::MetricSet metrics::LongValueMetric feedingBlocked; ResourceUsageMetrics(metrics::MetricSet *parent); + ~ResourceUsageMetrics(); }; ResourceUsageMetrics resourceUsage; AttributeMetrics(metrics::MetricSet *parent); + ~AttributeMetrics(); }; struct IndexMetrics : metrics::MetricSet @@ -81,6 +87,7 @@ struct DocumentDBTaggedMetrics : metrics::MetricSet MemoryUsageMetrics memoryUsage; IndexMetrics(metrics::MetricSet *parent); + ~IndexMetrics(); }; JobMetrics job; @@ -91,6 +98,7 @@ struct DocumentDBTaggedMetrics : metrics::MetricSet SubDBMetrics removed; DocumentDBTaggedMetrics(const vespalib::string &docTypeName); + ~DocumentDBTaggedMetrics(); }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/metrics/executor_metrics.cpp b/searchcore/src/vespa/searchcore/proton/metrics/executor_metrics.cpp index 30be90d637a..99583afbbca 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/executor_metrics.cpp +++ b/searchcore/src/vespa/searchcore/proton/metrics/executor_metrics.cpp @@ -1,8 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.server.executormetrics"); #include "executor_metrics.h" namespace proton { @@ -23,4 +20,6 @@ ExecutorMetrics::ExecutorMetrics(const std::string &name, metrics::MetricSet *pa { } +ExecutorMetrics::~ExecutorMetrics() {} + } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/metrics/executor_metrics.h b/searchcore/src/vespa/searchcore/proton/metrics/executor_metrics.h index 526c4fd6985..e0514edf39e 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/executor_metrics.h +++ b/searchcore/src/vespa/searchcore/proton/metrics/executor_metrics.h @@ -15,6 +15,7 @@ struct ExecutorMetrics : metrics::MetricSet void update(const vespalib::ThreadStackExecutorBase::Stats &stats); ExecutorMetrics(const std::string &name, metrics::MetricSet *parent); + ~ExecutorMetrics(); }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/metrics/feed_metrics.cpp b/searchcore/src/vespa/searchcore/proton/metrics/feed_metrics.cpp index bb6e1fdf50d..9f60951393c 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/feed_metrics.cpp +++ b/searchcore/src/vespa/searchcore/proton/metrics/feed_metrics.cpp @@ -17,6 +17,8 @@ FeedMetrics::FeedMetrics() { } +FeedMetrics::~FeedMetrics() {} + PerDocTypeFeedMetrics::PerDocTypeFeedMetrics(MetricSet *parent) : MetricSet("feedmetrics", "", "Feed metrics", parent), _update_lock(), @@ -31,6 +33,8 @@ PerDocTypeFeedMetrics::PerDocTypeFeedMetrics(MetricSet *parent) { } +PerDocTypeFeedMetrics::~PerDocTypeFeedMetrics() {} + void PerDocTypeFeedMetrics::RegisterPut(const FastOS_Time &start_time) { LockGuard lock(_update_lock); _puts.inc(1); diff --git a/searchcore/src/vespa/searchcore/proton/metrics/feed_metrics.h b/searchcore/src/vespa/searchcore/proton/metrics/feed_metrics.h index 541a9cec548..aee2647c681 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/feed_metrics.h +++ b/searchcore/src/vespa/searchcore/proton/metrics/feed_metrics.h @@ -14,6 +14,7 @@ struct FeedMetrics : metrics::MetricSet metrics::DoubleAverageMetric latency; FeedMetrics(); + ~FeedMetrics(); }; class PerDocTypeFeedMetrics : metrics::MetricSet { @@ -29,6 +30,7 @@ class PerDocTypeFeedMetrics : metrics::MetricSet { public: PerDocTypeFeedMetrics(metrics::MetricSet *parent); + ~PerDocTypeFeedMetrics(); void RegisterPut(const FastOS_Time &start_time); void RegisterUpdate(const FastOS_Time &start_time); void RegisterRemove(const FastOS_Time &start_time); diff --git a/searchcore/src/vespa/searchcore/proton/metrics/legacy_attribute_metrics.cpp b/searchcore/src/vespa/searchcore/proton/metrics/legacy_attribute_metrics.cpp index aa5a637dee0..c56cc3f3223 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/legacy_attribute_metrics.cpp +++ b/searchcore/src/vespa/searchcore/proton/metrics/legacy_attribute_metrics.cpp @@ -63,6 +63,8 @@ LegacyAttributeMetrics::List::List(metrics::MetricSet *parent) { } +LegacyAttributeMetrics::List::~List() {} + LegacyAttributeMetrics::LegacyAttributeMetrics(metrics::MetricSet *parent) : metrics::MetricSet("attributes", "", "Attribute metrics", parent), list(this), @@ -71,4 +73,6 @@ LegacyAttributeMetrics::LegacyAttributeMetrics(metrics::MetricSet *parent) { } +LegacyAttributeMetrics::~LegacyAttributeMetrics() {} + } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/metrics/legacy_attribute_metrics.h b/searchcore/src/vespa/searchcore/proton/metrics/legacy_attribute_metrics.h index 05085f758cf..116d0c2b2ea 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/legacy_attribute_metrics.h +++ b/searchcore/src/vespa/searchcore/proton/metrics/legacy_attribute_metrics.h @@ -28,6 +28,7 @@ struct LegacyAttributeMetrics : metrics::MetricSet { // per attribute metrics will be wired in here (by the metrics engine) List(metrics::MetricSet *parent); + ~List(); private: std::map<std::string, Entry::LP> metrics; @@ -38,6 +39,7 @@ struct LegacyAttributeMetrics : metrics::MetricSet { metrics::LongValueMetric bitVectors; LegacyAttributeMetrics(metrics::MetricSet *parent); + ~LegacyAttributeMetrics(); }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/metrics/legacy_documentdb_metrics.cpp b/searchcore/src/vespa/searchcore/proton/metrics/legacy_documentdb_metrics.cpp index 1cc20a95315..f1a65b18084 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/legacy_documentdb_metrics.cpp +++ b/searchcore/src/vespa/searchcore/proton/metrics/legacy_documentdb_metrics.cpp @@ -19,6 +19,8 @@ LegacyDocumentDBMetrics::IndexMetrics::IndexMetrics(MetricSet *parent) diskUsage("diskusage", "", "Disk usage for disk indexes", this) { } +LegacyDocumentDBMetrics::IndexMetrics::~IndexMetrics() {} + LegacyDocumentDBMetrics::DocstoreMetrics::DocstoreMetrics(MetricSet *parent) : MetricSet("docstore", "", "Document store metrics", parent), memoryUsage("memoryusage", "", "Memory usage for docstore", this), @@ -29,6 +31,8 @@ LegacyDocumentDBMetrics::DocstoreMetrics::DocstoreMetrics(MetricSet *parent) cacheMemoryUsed("cachememoryused", "", "Memory used by summary cache", this) { } +LegacyDocumentDBMetrics::DocstoreMetrics::~DocstoreMetrics() {} + void LegacyDocumentDBMetrics::MatchingMetrics::update(const MatchingStats &stats) { @@ -52,6 +56,8 @@ LegacyDocumentDBMetrics::MatchingMetrics::MatchingMetrics(MetricSet *parent) queryLatency("querylatency", "", "Average latency when matching a query", this) { } +LegacyDocumentDBMetrics::MatchingMetrics::~MatchingMetrics() {} + LegacyDocumentDBMetrics::MatchingMetrics::RankProfileMetrics::RankProfileMetrics( const std::string &name, size_t numDocIdPartitions, MetricSet *parent) : MetricSet(name, "", "Rank profile metrics", parent), @@ -67,6 +73,8 @@ LegacyDocumentDBMetrics::MatchingMetrics::RankProfileMetrics::RankProfileMetrics } } +LegacyDocumentDBMetrics::MatchingMetrics::RankProfileMetrics::~RankProfileMetrics() {} + LegacyDocumentDBMetrics::MatchingMetrics::RankProfileMetrics::DocIdPartition::DocIdPartition(const std::string &name, MetricSet *parent) : MetricSet(name, "", "DocId Partition profile metrics", parent), docsMatched("docsmatched", "", "Number of documents matched", this), @@ -76,6 +84,8 @@ LegacyDocumentDBMetrics::MatchingMetrics::RankProfileMetrics::DocIdPartition::Do wait_time("waittime", "", "Time spent waiting for other external threads and resources", this) { } +LegacyDocumentDBMetrics::MatchingMetrics::RankProfileMetrics::DocIdPartition::~DocIdPartition() {} + void LegacyDocumentDBMetrics::MatchingMetrics::RankProfileMetrics::DocIdPartition::update(const MatchingStats::Partition &stats) { @@ -109,8 +119,7 @@ LegacyDocumentDBMetrics::MatchingMetrics::RankProfileMetrics::update(const Match } } -LegacyDocumentDBMetrics::SubDBMetrics::DocumentMetaStoreMetrics:: -DocumentMetaStoreMetrics(MetricSet *parent) +LegacyDocumentDBMetrics::SubDBMetrics::DocumentMetaStoreMetrics::DocumentMetaStoreMetrics(MetricSet *parent) : MetricSet("docmetastore", "", "Document meta store metrics", parent), lidLimit("lidlimit", "", "The size of the allocated lid space", this), usedLids("usedlids", "", "The number of lids used", this), @@ -124,12 +133,16 @@ DocumentMetaStoreMetrics(MetricSet *parent) { } +LegacyDocumentDBMetrics::SubDBMetrics::DocumentMetaStoreMetrics::~DocumentMetaStoreMetrics() {} + LegacyDocumentDBMetrics::SubDBMetrics::SubDBMetrics(const vespalib::string &name, MetricSet *parent) : MetricSet(name, "", "Sub database metrics", parent), attributes(this), docMetaStore(this) { } +LegacyDocumentDBMetrics::SubDBMetrics::~SubDBMetrics() {} + LegacyDocumentDBMetrics::LegacyDocumentDBMetrics(const std::string &docTypeName, size_t maxNumThreads) : MetricSet(make_string("%s", docTypeName.c_str()), "", "Document DB Metrics", 0), index(this), @@ -157,4 +170,6 @@ LegacyDocumentDBMetrics::LegacyDocumentDBMetrics(const std::string &docTypeName, memoryUsage.addMetricToSum(docstore.memoryUsage); } +LegacyDocumentDBMetrics::~LegacyDocumentDBMetrics() { } + } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/metrics/legacy_documentdb_metrics.h b/searchcore/src/vespa/searchcore/proton/metrics/legacy_documentdb_metrics.h index 16cc176e377..dd246443ae4 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/legacy_documentdb_metrics.h +++ b/searchcore/src/vespa/searchcore/proton/metrics/legacy_documentdb_metrics.h @@ -27,6 +27,7 @@ struct LegacyDocumentDBMetrics : metrics::MetricSet metrics::LongValueMetric diskUsage; IndexMetrics(metrics::MetricSet *parent); + ~IndexMetrics(); }; struct DocstoreMetrics : metrics::MetricSet { @@ -38,6 +39,7 @@ struct LegacyDocumentDBMetrics : metrics::MetricSet metrics::LongValueMetric cacheMemoryUsed; DocstoreMetrics(metrics::MetricSet *parent); + ~DocstoreMetrics(); }; struct MatchingMetrics : metrics::MetricSet { @@ -59,6 +61,7 @@ struct LegacyDocumentDBMetrics : metrics::MetricSet typedef vespalib::LinkedPtr<DocIdPartition> LP; DocIdPartition(const std::string &name, metrics::MetricSet *parent); + ~DocIdPartition(); void update(const matching::MatchingStats::Partition &stats); }; typedef std::vector<DocIdPartition::LP> DocIdPartitions; @@ -75,6 +78,7 @@ struct LegacyDocumentDBMetrics : metrics::MetricSet RankProfileMetrics(const std::string &name, size_t numDocIdPartitions, metrics::MetricSet *parent); + ~RankProfileMetrics(); void update(const matching::MatchingStats &stats); }; @@ -83,6 +87,7 @@ struct LegacyDocumentDBMetrics : metrics::MetricSet void update(const matching::MatchingStats &stats); MatchingMetrics(metrics::MetricSet *parent); + ~MatchingMetrics(); }; struct SubDBMetrics : metrics::MetricSet @@ -97,11 +102,13 @@ struct LegacyDocumentDBMetrics : metrics::MetricSet metrics::DoubleValueMetric lidFragmentationFactor; DocumentMetaStoreMetrics(metrics::MetricSet *parent); + ~DocumentMetaStoreMetrics(); }; LegacyAttributeMetrics attributes; DocumentMetaStoreMetrics docMetaStore; SubDBMetrics(const vespalib::string &name, metrics::MetricSet *parent); + ~SubDBMetrics(); }; IndexMetrics index; @@ -125,6 +132,7 @@ struct LegacyDocumentDBMetrics : metrics::MetricSet size_t _maxNumThreads; LegacyDocumentDBMetrics(const std::string &docTypeName, size_t maxNumThreads); + ~LegacyDocumentDBMetrics(); }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/metrics/legacy_proton_metrics.cpp b/searchcore/src/vespa/searchcore/proton/metrics/legacy_proton_metrics.cpp index dc16d324d98..8ae757698eb 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/legacy_proton_metrics.cpp +++ b/searchcore/src/vespa/searchcore/proton/metrics/legacy_proton_metrics.cpp @@ -1,8 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.metrics.legacy_proton_metrics"); #include "legacy_proton_metrics.h" namespace proton { @@ -12,6 +9,8 @@ LegacyProtonMetrics::DocumentTypeMetrics::DocumentTypeMetrics(metrics::MetricSet { } +LegacyProtonMetrics::DocumentTypeMetrics::~DocumentTypeMetrics() { } + LegacyProtonMetrics::LegacyProtonMetrics() : metrics::MetricSet("proton", "", "Search engine metrics", 0), docTypes(this), @@ -44,4 +43,6 @@ LegacyProtonMetrics::LegacyProtonMetrics() numRemovedDocs.setStartValue(start); } +LegacyProtonMetrics::~LegacyProtonMetrics() {} + } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/metrics/legacy_proton_metrics.h b/searchcore/src/vespa/searchcore/proton/metrics/legacy_proton_metrics.h index 81df510ec18..9591e875139 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/legacy_proton_metrics.h +++ b/searchcore/src/vespa/searchcore/proton/metrics/legacy_proton_metrics.h @@ -17,6 +17,7 @@ struct LegacyProtonMetrics : metrics::MetricSet struct DocumentTypeMetrics : metrics::MetricSet { // documentdb metrics will be wired in here (by the metrics engine) DocumentTypeMetrics(metrics::MetricSet *parent); + ~DocumentTypeMetrics(); }; DocumentTypeMetrics docTypes; @@ -35,6 +36,7 @@ struct LegacyProtonMetrics : metrics::MetricSet // transport metrics will be wired in here LegacyProtonMetrics(); + ~LegacyProtonMetrics(); }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/metrics/memory_usage_metrics.cpp b/searchcore/src/vespa/searchcore/proton/metrics/memory_usage_metrics.cpp index 8bcb4ee31d6..8a702f0c920 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/memory_usage_metrics.cpp +++ b/searchcore/src/vespa/searchcore/proton/metrics/memory_usage_metrics.cpp @@ -1,6 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include "memory_usage_metrics.h" #include <vespa/searchlib/util/memoryusage.h> @@ -15,6 +14,8 @@ MemoryUsageMetrics::MemoryUsageMetrics(metrics::MetricSet *parent) { } +MemoryUsageMetrics::~MemoryUsageMetrics() {} + void MemoryUsageMetrics::update(const search::MemoryUsage &usage) { diff --git a/searchcore/src/vespa/searchcore/proton/metrics/memory_usage_metrics.h b/searchcore/src/vespa/searchcore/proton/metrics/memory_usage_metrics.h index c63e11ac6df..109d1d66de1 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/memory_usage_metrics.h +++ b/searchcore/src/vespa/searchcore/proton/metrics/memory_usage_metrics.h @@ -21,6 +21,7 @@ private: public: MemoryUsageMetrics(metrics::MetricSet *parent); + ~MemoryUsageMetrics(); void update(const search::MemoryUsage &usage); }; diff --git a/searchcore/src/vespa/searchcore/proton/metrics/resource_usage_metrics.cpp b/searchcore/src/vespa/searchcore/proton/metrics/resource_usage_metrics.cpp index 643a9a778ba..9321b6b071d 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/resource_usage_metrics.cpp +++ b/searchcore/src/vespa/searchcore/proton/metrics/resource_usage_metrics.cpp @@ -1,6 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include "resource_usage_metrics.h" namespace proton { @@ -15,4 +14,6 @@ ResourceUsageMetrics::ResourceUsageMetrics(metrics::MetricSet *parent) { } +ResourceUsageMetrics::~ResourceUsageMetrics() {} + } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/metrics/resource_usage_metrics.h b/searchcore/src/vespa/searchcore/proton/metrics/resource_usage_metrics.h index d60b25c247a..a96aee20b06 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/resource_usage_metrics.h +++ b/searchcore/src/vespa/searchcore/proton/metrics/resource_usage_metrics.h @@ -18,6 +18,7 @@ struct ResourceUsageMetrics : metrics::MetricSet metrics::LongValueMetric feedingBlocked; ResourceUsageMetrics(metrics::MetricSet *parent); + ~ResourceUsageMetrics(); }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.cpp b/searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.cpp index 61c1c970b4c..bc7414f828b 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.cpp +++ b/searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.cpp @@ -1,8 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".grouping.sessionmanagermetrics"); #include "sessionmanager_metrics.h" namespace search { @@ -20,6 +17,8 @@ SessionManagerMetrics::SessionManagerMetrics(metrics::MetricSet *parent) { } +SessionManagerMetrics::~SessionManagerMetrics() {} + void SessionManagerMetrics::update( const proton::matching::SessionManager::Stats &stats) diff --git a/searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.h b/searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.h index 9978db818ec..d142de22498 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.h +++ b/searchcore/src/vespa/searchcore/proton/metrics/sessionmanager_metrics.h @@ -18,6 +18,7 @@ struct SessionManagerMetrics : metrics::MetricSet void update(const proton::matching::SessionManager::Stats &stats); SessionManagerMetrics(metrics::MetricSet *parent); + ~SessionManagerMetrics(); }; } // namespace grouping diff --git a/searchcore/src/vespa/searchcore/proton/metrics/trans_log_server_metrics.cpp b/searchcore/src/vespa/searchcore/proton/metrics/trans_log_server_metrics.cpp index 06a20e8da78..392342bdd07 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/trans_log_server_metrics.cpp +++ b/searchcore/src/vespa/searchcore/proton/metrics/trans_log_server_metrics.cpp @@ -1,6 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include "trans_log_server_metrics.h" using search::transactionlog::DomainInfo; @@ -17,6 +16,8 @@ TransLogServerMetrics::DomainMetrics::DomainMetrics(metrics::MetricSet *parent, { } +TransLogServerMetrics::DomainMetrics::~DomainMetrics() {} + void TransLogServerMetrics::DomainMetrics::update(const DomainInfo &stats) { @@ -62,6 +63,8 @@ TransLogServerMetrics::TransLogServerMetrics(metrics::MetricSet *parent) { } +TransLogServerMetrics::~TransLogServerMetrics() { } + void TransLogServerMetrics::update(const DomainStats &stats) { diff --git a/searchcore/src/vespa/searchcore/proton/metrics/trans_log_server_metrics.h b/searchcore/src/vespa/searchcore/proton/metrics/trans_log_server_metrics.h index 4a7241bbef7..c5a4c569e95 100644 --- a/searchcore/src/vespa/searchcore/proton/metrics/trans_log_server_metrics.h +++ b/searchcore/src/vespa/searchcore/proton/metrics/trans_log_server_metrics.h @@ -20,6 +20,7 @@ public: typedef std::unique_ptr<DomainMetrics> UP; DomainMetrics(metrics::MetricSet *parent, const vespalib::string &documentType); + ~DomainMetrics(); void update(const search::transactionlog::DomainInfo &stats); }; @@ -33,6 +34,7 @@ private: public: TransLogServerMetrics(metrics::MetricSet *parent); + ~TransLogServerMetrics(); void update(const search::transactionlog::DomainStats &stats); }; diff --git a/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.cpp b/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.cpp index 581933efcb7..5b7b038922a 100644 --- a/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.cpp +++ b/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.cpp @@ -42,10 +42,16 @@ protected: vespalib::Lock _lock; vespalib::CountDownLatch _latch; public: - ResultHandlerBase(uint32_t waitCnt) : _lock(), _latch(waitCnt) {} + ResultHandlerBase(uint32_t waitCnt); + ~ResultHandlerBase(); void await() { _latch.await(); } }; +ResultHandlerBase::ResultHandlerBase(uint32_t waitCnt) + : _lock(), + _latch(waitCnt) +{} +ResultHandlerBase::~ResultHandlerBase() { } class GenericResultHandler : public ResultHandlerBase, public IGenericResultHandler { private: @@ -55,7 +61,8 @@ public: ResultHandlerBase(waitCnt), _result() { } - virtual void handle(const Result &result) { + ~GenericResultHandler(); + void handle(const Result &result) override { if (result.hasError()) { vespalib::LockGuard guard(_lock); if (_result.hasError()) { @@ -69,6 +76,7 @@ public: const Result &getResult() const { return _result; } }; +GenericResultHandler::~GenericResultHandler() {} class BucketIdListResultHandler : public IBucketIdListResultHandler { @@ -79,6 +87,7 @@ public: BucketIdListResultHandler() : _bucketSet() { } + ~BucketIdListResultHandler(); virtual void handle(const BucketIdListResult &result) { const BucketIdListResult::List &buckets = result.getList(); for (size_t i = 0; i < buckets.size(); ++i) { @@ -96,6 +105,8 @@ public: }; +BucketIdListResultHandler::~BucketIdListResultHandler() {} + class SynchronizedBucketIdListResultHandler : public ResultHandlerBase, public BucketIdListResultHandler { @@ -104,6 +115,7 @@ public: : ResultHandlerBase(waitCnt), BucketIdListResultHandler() { } + ~SynchronizedBucketIdListResultHandler(); virtual void handle(const BucketIdListResult &result) { { vespalib::LockGuard guard(_lock); @@ -113,6 +125,7 @@ public: } }; +SynchronizedBucketIdListResultHandler::~SynchronizedBucketIdListResultHandler() {} class BucketInfoResultHandler : public IBucketInfoResultHandler { private: @@ -124,6 +137,7 @@ public: _first(true) { } + ~BucketInfoResultHandler(); virtual void handle(const BucketInfoResult &result) { if (_first) { _result = result; @@ -149,6 +163,8 @@ public: const BucketInfoResult &getResult() const { return _result; } }; +BucketInfoResultHandler::~BucketInfoResultHandler() {} + } #define NOT_YET throw vespalib::IllegalArgumentException("Not implemented yet") diff --git a/searchcore/src/vespa/searchcore/proton/persistenceengine/transport_latch.cpp b/searchcore/src/vespa/searchcore/proton/persistenceengine/transport_latch.cpp index 55062b3c201..78eb1cfb3f6 100644 --- a/searchcore/src/vespa/searchcore/proton/persistenceengine/transport_latch.cpp +++ b/searchcore/src/vespa/searchcore/proton/persistenceengine/transport_latch.cpp @@ -1,9 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".proton.persistenceengine.transportlatch"); - #include "transport_latch.h" using storage::spi::Result; @@ -16,6 +12,8 @@ TransportLatch::TransportLatch(uint32_t cnt) _result() {} +TransportLatch::~TransportLatch() {} + void TransportLatch::send(mbus::Reply::UP reply, ResultUP result, diff --git a/searchcore/src/vespa/searchcore/proton/persistenceengine/transport_latch.h b/searchcore/src/vespa/searchcore/proton/persistenceengine/transport_latch.h index 49b721edd23..fcc9c362306 100644 --- a/searchcore/src/vespa/searchcore/proton/persistenceengine/transport_latch.h +++ b/searchcore/src/vespa/searchcore/proton/persistenceengine/transport_latch.h @@ -19,6 +19,7 @@ private: public: TransportLatch(uint32_t cnt); + ~TransportLatch(); virtual void send(mbus::Reply::UP reply, ResultUP result, bool documentWasFound, diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp index 7659a428fa3..5d16b0ba331 100644 --- a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp +++ b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.cpp @@ -92,6 +92,7 @@ public: : _caller(std::move(closure)), _index(index) { } + ~DiskIndexWithDestructorClosure(); const IDiskIndex &getWrapped() const { return *_index; } /** @@ -129,6 +130,8 @@ public: }; +DiskIndexWithDestructorClosure::~DiskIndexWithDestructorClosure() {} + } // namespace uint32_t @@ -409,6 +412,33 @@ IndexMaintainer::createNewSourceCollection(const LockGuard &newSearchLock) return ISearchableIndexCollection::UP(new IndexCollection(_selector, *currentLeaf)); } +IndexMaintainer::FlushArgs::FlushArgs() + : old_index(), + old_absolute_id(0), + old_source_list(), + save_info(), + flush_serial_num(), + stats(NULL), + _skippedEmptyLast(false), + _extraIndexes(), + _changeGens(), + _wtSchema() +{ +} +IndexMaintainer::FlushArgs::~FlushArgs() { } +IndexMaintainer::FlushArgs::FlushArgs(FlushArgs &&) = default; +IndexMaintainer::FlushArgs & IndexMaintainer::FlushArgs::operator=(FlushArgs &&) = default; + +IndexMaintainer::WipeHistoryArgs::WipeHistoryArgs() + : _old_source_list(), + _new_source_list() +{ } + +IndexMaintainer::WipeHistoryArgs::WipeHistoryArgs(WipeHistoryArgs &&) = default; +IndexMaintainer::WipeHistoryArgs & IndexMaintainer::WipeHistoryArgs::operator=(WipeHistoryArgs &&) = default; + +IndexMaintainer::WipeHistoryArgs::~WipeHistoryArgs() { } + bool IndexMaintainer::doneInitFlush(FlushArgs *args, IMemoryIndex::SP *new_index) { diff --git a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h index c7e0a304db6..dbab3e40028 100644 --- a/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h +++ b/searchcorespi/src/vespa/searchcorespi/index/indexmaintainer.h @@ -211,19 +211,12 @@ class IndexMaintainer : public IIndexManager, ChangeGens _changeGens; Schema::SP _wtSchema; - FlushArgs(void) - : old_index(), - old_absolute_id(0), - old_source_list(), - save_info(), - flush_serial_num(), - stats(NULL), - _skippedEmptyLast(false), - _extraIndexes(), - _changeGens(), - _wtSchema() - { - } + FlushArgs(); + FlushArgs(const FlushArgs &) = delete; + FlushArgs & operator=(const FlushArgs &) = delete; + FlushArgs(FlushArgs &&); + FlushArgs & operator=(FlushArgs &&); + ~FlushArgs(); }; bool doneInitFlush(FlushArgs *args, IMemoryIndex::SP *new_index); @@ -288,17 +281,18 @@ class IndexMaintainer : public IIndexManager, ISearchableIndexCollection::SP _old_source_list; ISearchableIndexCollection::SP _new_source_list; - WipeHistoryArgs() - : _old_source_list(), - _new_source_list() - { } + WipeHistoryArgs(); + WipeHistoryArgs(WipeHistoryArgs &&); + WipeHistoryArgs & operator=(WipeHistoryArgs &&); + + ~WipeHistoryArgs(); }; bool doneWipeHistory(WipeHistoryArgs &args); Schema getSchema(void) const; - Schema::SP getActiveFusionWipeTimeSchema(void) const; - search::TuneFileAttributes getAttrTune(void); - ChangeGens getChangeGens(void); + Schema::SP getActiveFusionWipeTimeSchema() const; + search::TuneFileAttributes getAttrTune(); + ChangeGens getChangeGens(); /* * Schedule document db executor task to use reconfigurer to diff --git a/searchlib/src/vespa/searchlib/attribute/CMakeLists.txt b/searchlib/src/vespa/searchlib/attribute/CMakeLists.txt index 35303d03b91..66a614379a8 100644 --- a/searchlib/src/vespa/searchlib/attribute/CMakeLists.txt +++ b/searchlib/src/vespa/searchlib/attribute/CMakeLists.txt @@ -29,6 +29,7 @@ vespa_add_library(searchlib_attribute OBJECT createsinglefastsearch.cpp createsinglestd.cpp defines.cpp + diversity.cpp dociditerator.cpp enumattribute.cpp enumattributesaver.cpp diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.cpp b/searchlib/src/vespa/searchlib/attribute/attributevector.cpp index 318eab5d96e..8d4b437e8b5 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributevector.cpp +++ b/searchlib/src/vespa/searchlib/attribute/attributevector.cpp @@ -70,6 +70,8 @@ AttributeVector::BaseName::BaseName(const vespalib::stringref &base, append(name); } +AttributeVector::BaseName::~BaseName() { } + AttributeVector::BaseName::string AttributeVector::BaseName::getIndexName() const diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.h b/searchlib/src/vespa/searchlib/attribute/attributevector.h index b01c06e7c75..496b6cdfbf5 100644 --- a/searchlib/src/vespa/searchlib/attribute/attributevector.h +++ b/searchlib/src/vespa/searchlib/attribute/attributevector.h @@ -136,6 +136,7 @@ public: BaseName(const vespalib::stringref &base, const vespalib::stringref &snap, const vespalib::stringref &name); + ~BaseName(); string getIndexName() const; string getSnapshotName() const; diff --git a/searchlib/src/vespa/searchlib/attribute/diversity.cpp b/searchlib/src/vespa/searchlib/attribute/diversity.cpp new file mode 100644 index 00000000000..93b8fa5ee83 --- /dev/null +++ b/searchlib/src/vespa/searchlib/attribute/diversity.cpp @@ -0,0 +1,11 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#include "diversity.hpp" + +namespace search { +namespace attribute { +namespace diversity { + +} +} +} diff --git a/searchlib/src/vespa/searchlib/attribute/diversity.h b/searchlib/src/vespa/searchlib/attribute/diversity.h index e1914b344a7..9fd0e7c31ad 100644 --- a/searchlib/src/vespa/searchlib/attribute/diversity.h +++ b/searchlib/src/vespa/searchlib/attribute/diversity.h @@ -34,7 +34,9 @@ public: const ITR &get() const { return _lower; } ~Next() { ++_lower; } }; - ForwardRange(const ITR &lower, const ITR &upper) : _lower(lower), _upper(upper) {} + ForwardRange(const ForwardRange &); + ForwardRange(const ITR &lower, const ITR &upper); + ~ForwardRange(); bool has_next() const { return _lower != _upper; } }; @@ -53,7 +55,9 @@ public: explicit Next(ReverseRange &range) : _upper(range._upper) { --_upper; } const ITR &get() const { return _upper; } }; - ReverseRange(const ITR &lower, const ITR &upper) : _lower(lower), _upper(upper) {} + ReverseRange(const ReverseRange &); + ReverseRange(const ITR &lower, const ITR &upper); + ~ReverseRange(); bool has_next() const { return _lower != _upper; } }; diff --git a/searchlib/src/vespa/searchlib/attribute/diversity.hpp b/searchlib/src/vespa/searchlib/attribute/diversity.hpp new file mode 100644 index 00000000000..e857ac8eb73 --- /dev/null +++ b/searchlib/src/vespa/searchlib/attribute/diversity.hpp @@ -0,0 +1,38 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#pragma once + +#include "diversity.h" + +namespace search { +namespace attribute { +namespace diversity { + +template <typename ITR> +ForwardRange<ITR>::ForwardRange(const ForwardRange &) = default; + +template <typename ITR> +ForwardRange<ITR>::ForwardRange(const ITR &lower, const ITR &upper) + : _lower(lower), + _upper(upper) +{} + +template <typename ITR> +ForwardRange<ITR>::~ForwardRange() { } + +template <typename ITR> +ReverseRange<ITR>::ReverseRange(const ReverseRange &) = default; + +template <typename ITR> +ReverseRange<ITR>::ReverseRange(const ITR &lower, const ITR &upper) + : _lower(lower), + _upper(upper) +{} + + +template <typename ITR> +ReverseRange<ITR>::~ReverseRange() { } + +} +} +} diff --git a/searchlib/src/vespa/searchlib/attribute/integerbase.cpp b/searchlib/src/vespa/searchlib/attribute/integerbase.cpp index 34c73737825..c41600803f2 100644 --- a/searchlib/src/vespa/searchlib/attribute/integerbase.cpp +++ b/searchlib/src/vespa/searchlib/attribute/integerbase.cpp @@ -2,7 +2,6 @@ #include "integerbase.hpp" #include "attributevector.hpp" -#include <vespa/searchlib/common/sort.h> #include <vespa/document/fieldvalue/fieldvalue.h> namespace search { @@ -15,6 +14,8 @@ IntegerAttribute::IntegerAttribute(const vespalib::string & name, const Config & { } +IntegerAttribute::~IntegerAttribute() { } + uint32_t IntegerAttribute::clearDoc(DocId doc) { uint32_t removed(0); diff --git a/searchlib/src/vespa/searchlib/attribute/integerbase.h b/searchlib/src/vespa/searchlib/attribute/integerbase.h index aef139fe8a3..e5a9dbe1e48 100644 --- a/searchlib/src/vespa/searchlib/attribute/integerbase.h +++ b/searchlib/src/vespa/searchlib/attribute/integerbase.h @@ -15,6 +15,7 @@ class NumericEntryType; class IntegerAttribute : public NumericAttribute { public: + ~IntegerAttribute(); DECLARE_IDENTIFIABLE_ABSTRACT(IntegerAttribute); bool update(DocId doc, largeint_t v) { return AttributeVector::update(_changes, doc, NumericChangeData<largeint_t>(v)); diff --git a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.cpp b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.cpp index 6108060ed70..3d03bedab50 100644 --- a/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.cpp +++ b/searchlib/src/vespa/searchlib/attribute/postinglistsearchcontext.cpp @@ -2,9 +2,10 @@ #include "postinglistsearchcontext.h" #include "postinglistsearchcontext.hpp" -#include <vespa/searchlib/btree/btreeiterator.hpp> -#include <vespa/searchlib/btree/btreenode.hpp> #include "attributeiterators.hpp" +#include "diversity.hpp" +#include <vespa/searchlib/btree/btreeiterator.hpp> + namespace search { @@ -41,7 +42,7 @@ PostingListSearchContext(const Dictionary &dictionary, } -PostingListSearchContext::~PostingListSearchContext(void) +PostingListSearchContext::~PostingListSearchContext() { } @@ -72,7 +73,7 @@ PostingListSearchContext::lookupRange(const EnumStoreComparator &low, void -PostingListSearchContext::lookupSingle(void) +PostingListSearchContext::lookupSingle() { if (_lowerDictItr.valid()) { _pidx = _lowerDictItr.getData(); diff --git a/searchlib/src/vespa/searchlib/bitcompression/compression.cpp b/searchlib/src/vespa/searchlib/bitcompression/compression.cpp index 49be44c33b0..968f3916c7e 100644 --- a/searchlib/src/vespa/searchlib/bitcompression/compression.cpp +++ b/searchlib/src/vespa/searchlib/bitcompression/compression.cpp @@ -430,6 +430,30 @@ getParams(PostingListParams ¶ms) const params.clear(); } +template <> +void +EncodeContext64EBase<true>::writeBits(uint64_t data, uint32_t length) +{ + // While there are enough bits remaining in "data", + // fill the cacheInt and flush it to vector + if (length >= _cacheFree) { + // Shift new bits into cacheInt + _cacheInt |= ((data >> (length - _cacheFree)) & + CodingTables::_intMask64[_cacheFree]); + *_valI++ = bswap(_cacheInt); + + // Initialize variables for receiving new bits + length -= _cacheFree; + _cacheInt = 0; + _cacheFree = 64; + } + + if (length > 0) { + uint64_t dataFragment = (data & CodingTables::_intMask64[length]); + _cacheInt |= (dataFragment << (_cacheFree - length)); + _cacheFree -= length; + } +} template class FeatureDecodeContext<true>; template class FeatureDecodeContext<false>; diff --git a/searchlib/src/vespa/searchlib/bitcompression/compression.h b/searchlib/src/vespa/searchlib/bitcompression/compression.h index 08b9547f740..7975c2724f9 100644 --- a/searchlib/src/vespa/searchlib/bitcompression/compression.h +++ b/searchlib/src/vespa/searchlib/bitcompression/compression.h @@ -892,7 +892,7 @@ public: * @param data The bits to be written to file. * @param length The number of bits to be written to file. */ - void inline + void writeBits(uint64_t data, uint32_t length); /** @@ -961,32 +961,6 @@ EncodeContext64EBase<true>::bswap(uint64_t val) template <> -inline void -EncodeContext64EBase<true>::writeBits(uint64_t data, uint32_t length) -{ - // While there are enough bits remaining in "data", - // fill the cacheInt and flush it to vector - if (length >= _cacheFree) { - // Shift new bits into cacheInt - _cacheInt |= ((data >> (length - _cacheFree)) & - CodingTables::_intMask64[_cacheFree]); - *_valI++ = bswap(_cacheInt); - - // Initialize variables for receiving new bits - length -= _cacheFree; - _cacheInt = 0; - _cacheFree = 64; - } - - if (length > 0) { - uint64_t dataFragment = (data & CodingTables::_intMask64[length]); - _cacheInt |= (dataFragment << (_cacheFree - length)); - _cacheFree -= length; - } -} - - -template <> inline uint64_t EncodeContext64EBase<false>::bswap(uint64_t val) { diff --git a/searchlib/src/vespa/searchlib/bitcompression/countcompression.h b/searchlib/src/vespa/searchlib/bitcompression/countcompression.h index 284b441aa3b..3dfb16b6250 100644 --- a/searchlib/src/vespa/searchlib/bitcompression/countcompression.h +++ b/searchlib/src/vespa/searchlib/bitcompression/countcompression.h @@ -4,16 +4,15 @@ #pragma once -#include <limits> +#include "compression.h" #include <vespa/searchlib/index/postinglistcounts.h> +#include <limits> #define K_VALUE_COUNTFILE_POSOCCBITS 6 -namespace search -{ +namespace search { -namespace bitcompression -{ +namespace bitcompression { class PostingListCountFileDecodeContext : public FeatureDecodeContext<true> { diff --git a/searchlib/src/vespa/searchlib/bitcompression/pagedict4.cpp b/searchlib/src/vespa/searchlib/bitcompression/pagedict4.cpp index bef3f276b55..2fc1a1a071b 100644 --- a/searchlib/src/vespa/searchlib/bitcompression/pagedict4.cpp +++ b/searchlib/src/vespa/searchlib/bitcompression/pagedict4.cpp @@ -1,28 +1,21 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> +#include "pagedict4.h" #include "compression.h" #include "countcompression.h" #include <vespa/searchlib/index/postinglistcounts.h> #include <vespa/searchlib/index/dictionaryfile.h> -#include "pagedict4.h" -#include <map> -#include <string> -#include <iostream> -#include <sstream> #include <vespa/vespalib/objects/nbostream.h> +#include <sstream> +#include <vespa/log/log.h> LOG_SETUP(".pagedict4"); -namespace search -{ +namespace search { -namespace bitcompression -{ +namespace bitcompression { -namespace -{ +namespace { void setDecoderPositionHelper(PostingListCountFileDecodeContext &ctx, diff --git a/searchlib/src/vespa/searchlib/common/fslimits.h b/searchlib/src/vespa/searchlib/common/fslimits.h index 64de5e3be37..b252e16277c 100644 --- a/searchlib/src/vespa/searchlib/common/fslimits.h +++ b/searchlib/src/vespa/searchlib/common/fslimits.h @@ -1,6 +1,4 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -// Copyright (C) 1999-2003 Fast Search & Transfer ASA -// Copyright (C) 2003 Overture Services Norway AS #pragma once diff --git a/searchlib/src/vespa/searchlib/diskindex/diskindex.cpp b/searchlib/src/vespa/searchlib/diskindex/diskindex.cpp index a12fb219b91..9bc5f473e27 100644 --- a/searchlib/src/vespa/searchlib/diskindex/diskindex.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/diskindex.cpp @@ -37,6 +37,13 @@ DiskIndex::LookupResult::LookupResult() { } +DiskIndex::Key::Key() : _indexes() { } +DiskIndex::Key::Key(const IndexList & indexes, vespalib::stringref word) : + _word(word), + _indexes(indexes) +{ } +DiskIndex::Key::~Key() { } + DiskIndex::DiskIndex(const vespalib::string &indexDir, size_t cacheSize) : _indexDir(indexDir), _cacheSize(cacheSize), diff --git a/searchlib/src/vespa/searchlib/diskindex/diskindex.h b/searchlib/src/vespa/searchlib/diskindex/diskindex.h index c48a88970e9..552efe35c51 100644 --- a/searchlib/src/vespa/searchlib/diskindex/diskindex.h +++ b/searchlib/src/vespa/searchlib/diskindex/diskindex.h @@ -46,11 +46,9 @@ public: class Key { public: - Key() : _indexes() { } - Key(const IndexList & indexes, vespalib::stringref word) : - _word(word), - _indexes(indexes) - { } + Key(); + Key(const IndexList & indexes, vespalib::stringref word); + ~Key(); uint32_t hash() const { return vespalib::hashValue(_word.c_str(), _word.size()); } diff --git a/searchlib/src/vespa/searchlib/diskindex/fieldwriter.cpp b/searchlib/src/vespa/searchlib/diskindex/fieldwriter.cpp index 7449a946286..ac1f80be6af 100644 --- a/searchlib/src/vespa/searchlib/diskindex/fieldwriter.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/fieldwriter.cpp @@ -36,6 +36,7 @@ FieldWriter::FieldWriter(uint32_t docIdLimit, { } +FieldWriter::~FieldWriter() { } void FieldWriter::earlyOpen(const vespalib::string &prefix, diff --git a/searchlib/src/vespa/searchlib/diskindex/fieldwriter.h b/searchlib/src/vespa/searchlib/diskindex/fieldwriter.h index dfed6036405..46d5ce85383 100644 --- a/searchlib/src/vespa/searchlib/diskindex/fieldwriter.h +++ b/searchlib/src/vespa/searchlib/diskindex/fieldwriter.h @@ -1,25 +1,18 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #pragma once +#include "bitvectorfile.h" #include <vespa/searchlib/index/dictionaryfile.h> #include <vespa/searchlib/index/postinglistfile.h> #include <vespa/searchlib/bitcompression/compression.h> #include <vespa/searchlib/bitcompression/countcompression.h> #include <vespa/searchlib/bitcompression/posocccompression.h> -#include "bitvectorfile.h" - -namespace vespalib -{ -class nbostream; +namespace vespalib { class nbostream; } -} +namespace search { -namespace search -{ - -namespace diskindex -{ +namespace diskindex { /* * FieldWriter is used to write a dictionary and posting list file @@ -39,11 +32,7 @@ private: uint64_t _wordNum; uint32_t _prevDocId; - static uint64_t - noWordNum(void) - { - return 0u; - } + static uint64_t noWordNum(void) { return 0u; } public: using DictionaryFileSeqWrite = index::DictionaryFileSeqWrite; @@ -65,22 +54,16 @@ private: uint64_t _compactWordNum; vespalib::string _word; - void - flush(void); + void flush(); public: - FieldWriter(uint32_t docIdLimit, - uint64_t numWordIds); - - void - newWord(uint64_t wordNum, const vespalib::stringref &word); + FieldWriter(uint32_t docIdLimit, uint64_t numWordIds); + ~FieldWriter(); - void - newWord(const vespalib::stringref &word); + void newWord(uint64_t wordNum, const vespalib::stringref &word); + void newWord(const vespalib::stringref &word); - void - add(const DocIdAndFeatures &features) - { + void add(const DocIdAndFeatures &features) { assert(features._docId < _docIdLimit); assert(features._docId > _prevDocId); _posoccfile->writeDocIdAndFeatures(features); @@ -88,48 +71,29 @@ public: _prevDocId = features._docId; } - uint64_t - getSparseWordNum() const - { - return _wordNum; - } + uint64_t getSparseWordNum() const { return _wordNum; } - void - earlyOpen(const vespalib::string &prefix, - uint32_t minSkipDocs, - uint32_t minChunkDocs, - bool dynamicKPosOccFormat, - const Schema &schema, - uint32_t indexId, - const TuneFileSeqWrite &tuneFileWrite); + void earlyOpen(const vespalib::string &prefix, uint32_t minSkipDocs, uint32_t minChunkDocs, + bool dynamicKPosOccFormat, const Schema &schema, uint32_t indexId, + const TuneFileSeqWrite &tuneFileWrite); - bool - lateOpen(const TuneFileSeqWrite &tuneFileWrite, - const search::common::FileHeaderContext &fileHeaderContext); + bool lateOpen(const TuneFileSeqWrite &tuneFileWrite, + const search::common::FileHeaderContext &fileHeaderContext); - bool - close(void); + bool close(); /* * To be called between words, not in the middle of one. */ - void - checkPointWrite(vespalib::nbostream &out); + void checkPointWrite(vespalib::nbostream &out); /* * To be called after earlyOpen() but before afterOpen(). */ - void - checkPointRead(vespalib::nbostream &in); - - void - setFeatureParams(const PostingListParams ¶ms); - - void - getFeatureParams(PostingListParams ¶ms); - - static void - remove(const vespalib::string &prefix); + void checkPointRead(vespalib::nbostream &in); + void setFeatureParams(const PostingListParams ¶ms); + void getFeatureParams(PostingListParams ¶ms); + static void remove(const vespalib::string &prefix); }; } // namespace diskindex diff --git a/searchlib/src/vespa/searchlib/docstore/visitcache.cpp b/searchlib/src/vespa/searchlib/docstore/visitcache.cpp index 9ef7219b661..25875d3621d 100644 --- a/searchlib/src/vespa/searchlib/docstore/visitcache.cpp +++ b/searchlib/src/vespa/searchlib/docstore/visitcache.cpp @@ -76,6 +76,9 @@ CompressedBlobSet::CompressedBlobSet() : { } +CompressedBlobSet::~CompressedBlobSet() { } + + CompressedBlobSet::CompressedBlobSet(const document::CompressionConfig &compression, const BlobSet & uncompressed) : _compression(compression.type), _positions(uncompressed.getPositions()), diff --git a/searchlib/src/vespa/searchlib/docstore/visitcache.h b/searchlib/src/vespa/searchlib/docstore/visitcache.h index 22b20f75355..fd61544ecc5 100644 --- a/searchlib/src/vespa/searchlib/docstore/visitcache.h +++ b/searchlib/src/vespa/searchlib/docstore/visitcache.h @@ -74,6 +74,7 @@ public: CompressedBlobSet & operator=(CompressedBlobSet && rhs) = default; CompressedBlobSet(const CompressedBlobSet & rhs) = default; CompressedBlobSet & operator=(const CompressedBlobSet & rhs) = default; + ~CompressedBlobSet(); size_t size() const; bool empty() const { return _positions.empty(); } BlobSet getBlobSet() const; diff --git a/searchlib/src/vespa/searchlib/engine/transport_metrics.cpp b/searchlib/src/vespa/searchlib/engine/transport_metrics.cpp index 7efbf172e4f..9f933180265 100644 --- a/searchlib/src/vespa/searchlib/engine/transport_metrics.cpp +++ b/searchlib/src/vespa/searchlib/engine/transport_metrics.cpp @@ -12,6 +12,8 @@ TransportMetrics::QueryMetrics::QueryMetrics(metrics::MetricSet *parent) { } +TransportMetrics::QueryMetrics::~QueryMetrics() { } + TransportMetrics::DocsumMetrics::DocsumMetrics(metrics::MetricSet *parent) : metrics::MetricSet("docsum", "", "Docsum metrics", parent), count("count", "logdefault", "Docsum requests handled", this), @@ -20,6 +22,8 @@ TransportMetrics::DocsumMetrics::DocsumMetrics(metrics::MetricSet *parent) { } +TransportMetrics::DocsumMetrics::~DocsumMetrics() { } + TransportMetrics::TransportMetrics() : metrics::MetricSet("transport", "", "Transport server metrics", 0), updateLock(), @@ -28,5 +32,7 @@ TransportMetrics::TransportMetrics() { } +TransportMetrics::~TransportMetrics() { } + } // namespace engine } // namespace search diff --git a/searchlib/src/vespa/searchlib/engine/transport_metrics.h b/searchlib/src/vespa/searchlib/engine/transport_metrics.h index fa62460434c..87312a0971c 100644 --- a/searchlib/src/vespa/searchlib/engine/transport_metrics.h +++ b/searchlib/src/vespa/searchlib/engine/transport_metrics.h @@ -15,6 +15,7 @@ struct TransportMetrics : metrics::MetricSet metrics::DoubleAverageMetric latency; QueryMetrics(metrics::MetricSet *parent); + ~QueryMetrics(); }; struct DocsumMetrics : metrics::MetricSet { @@ -23,6 +24,7 @@ struct TransportMetrics : metrics::MetricSet metrics::DoubleAverageMetric latency; DocsumMetrics(metrics::MetricSet *parent); + ~DocsumMetrics(); }; vespalib::Lock updateLock; @@ -30,6 +32,7 @@ struct TransportMetrics : metrics::MetricSet DocsumMetrics docsum; TransportMetrics(); + ~TransportMetrics(); }; } // namespace engine diff --git a/searchlib/src/vespa/searchlib/features/dotproductfeature.cpp b/searchlib/src/vespa/searchlib/features/dotproductfeature.cpp index fafd1955a80..394ea6d6dca 100644 --- a/searchlib/src/vespa/searchlib/features/dotproductfeature.cpp +++ b/searchlib/src/vespa/searchlib/features/dotproductfeature.cpp @@ -1,19 +1,16 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".features.dotproduct"); -#include <vespa/searchcommon/attribute/attributecontent.h> -#include <vespa/searchlib/fef/properties.h> - #include "dotproductfeature.h" -#include "array_parser.hpp" -#include "utils.h" #include "valuefeature.h" #include "weighted_set_parser.hpp" +#include "array_parser.hpp" +#include <vespa/searchlib/fef/properties.h> #include <vespa/searchlib/attribute/integerbase.h> #include <vespa/searchlib/attribute/floatbase.h> +#include <vespa/log/log.h> +LOG_SETUP(".features.dotproduct"); + using namespace search::attribute; using namespace search::fef; using vespalib::hwaccelrated::IAccelrated; @@ -23,6 +20,12 @@ namespace features { namespace dotproduct { namespace wset { +template <typename DimensionVType, typename DimensionHType, typename ComponentType, typename HashMapComparator> +VectorBase<DimensionVType, DimensionHType, ComponentType, HashMapComparator>::VectorBase() { } + +template <typename DimensionVType, typename DimensionHType, typename ComponentType, typename HashMapComparator> +VectorBase<DimensionVType, DimensionHType, ComponentType, HashMapComparator>::~VectorBase() { } + template <typename Vector, typename Buffer> DotProductExecutor<Vector, Buffer>::DotProductExecutor(const IAttributeVector * attribute, const Vector & vector) : FeatureExecutor(), @@ -65,6 +68,9 @@ DotProductExecutor<A>::DotProductExecutor(const A * attribute, const V & vector) } template <typename A> +DotProductExecutor<A>::~DotProductExecutor() { } + +template <typename A> size_t DotProductExecutor<A>::getAttributeValues(uint32_t docId, const AT * & values) { @@ -90,6 +96,9 @@ SparseDotProductExecutor<A>::SparseDotProductExecutor(const A * attribute, const } template <typename A> +SparseDotProductExecutor<A>::~SparseDotProductExecutor() { } + +template <typename A> size_t SparseDotProductExecutor<A>::getAttributeValues(uint32_t docId, const AT * & values) { @@ -111,6 +120,9 @@ DotProductByCopyExecutor<A>::DotProductByCopyExecutor(const A * attribute, const } template <typename A> +DotProductByCopyExecutor<A>::~DotProductByCopyExecutor() { } + +template <typename A> size_t DotProductByCopyExecutor<A>::getAttributeValues(uint32_t docId, const AT * & values) { @@ -131,6 +143,9 @@ SparseDotProductByCopyExecutor<A>::SparseDotProductByCopyExecutor(const A * attr } template <typename A> +SparseDotProductByCopyExecutor<A>::~SparseDotProductByCopyExecutor() { } + +template <typename A> size_t SparseDotProductByCopyExecutor<A>::getAttributeValues(uint32_t docId, const AT * & values) { diff --git a/searchlib/src/vespa/searchlib/features/dotproductfeature.h b/searchlib/src/vespa/searchlib/features/dotproductfeature.h index 5550f30bf2d..1801030acba 100644 --- a/searchlib/src/vespa/searchlib/features/dotproductfeature.h +++ b/searchlib/src/vespa/searchlib/features/dotproductfeature.h @@ -7,6 +7,7 @@ #include <vespa/searchlib/fef/featureexecutor.h> #include <vespa/searchlib/attribute/multivalue.h> #include <vespa/vespalib/hwaccelrated/iaccelrated.h> +#include <vespa/searchcommon/attribute/attributecontent.h> #include <vespa/vespalib/stllike/hash_map.hpp> namespace search { @@ -39,9 +40,11 @@ public: typedef std::vector<Element> Vector; typedef vespalib::hash_map<DimensionHType, ComponentType, vespalib::hash<DimensionHType>, HashMapComparator> HashMap; protected: + VectorBase(); Vector _vector; HashMap _dimMap; // dimension -> component public: + ~VectorBase(); const Vector & getVector() const { return _vector; } void syncMap() { Converter<DimensionVType, DimensionHType> conv; @@ -126,6 +129,7 @@ private: virtual size_t getAttributeValues(uint32_t docid, const AT * & count); public: DotProductExecutor(const A * attribute, const V & vector); + ~DotProductExecutor(); virtual void execute(uint32_t docId); }; @@ -134,6 +138,7 @@ class DotProductByCopyExecutor : public DotProductExecutor<A> { public: typedef typename DotProductExecutor<A>::V V; DotProductByCopyExecutor(const A * attribute, const V & vector); + ~DotProductByCopyExecutor(); private: typedef typename DotProductExecutor<A>::AT AT; virtual size_t getAttributeValues(uint32_t docid, const AT * & count); @@ -146,6 +151,7 @@ public: typedef std::vector<uint32_t> IV; typedef typename DotProductExecutor<A>::V V; SparseDotProductExecutor(const A * attribute, const V & vector, const IV & indexes); + ~SparseDotProductExecutor(); private: typedef typename DotProductExecutor<A>::AT AT; virtual size_t getAttributeValues(uint32_t docid, const AT * & count); @@ -160,6 +166,7 @@ public: typedef std::vector<uint32_t> IV; typedef typename DotProductExecutor<A>::V V; SparseDotProductByCopyExecutor(const A * attribute, const V & vector, const IV & indexes); + ~SparseDotProductByCopyExecutor(); private: typedef typename DotProductExecutor<A>::AT AT; virtual size_t getAttributeValues(uint32_t docid, const AT * & count); diff --git a/searchlib/src/vespa/searchlib/features/element_similarity_feature.cpp b/searchlib/src/vespa/searchlib/features/element_similarity_feature.cpp index 52e75a33fdf..39ecfe6447a 100644 --- a/searchlib/src/vespa/searchlib/features/element_similarity_feature.cpp +++ b/searchlib/src/vespa/searchlib/features/element_similarity_feature.cpp @@ -115,8 +115,11 @@ struct VectorizedQueryTerms { weights.push_back(terms[i].weight); } } + ~VectorizedQueryTerms(); }; +VectorizedQueryTerms::~VectorizedQueryTerms() { } + //----------------------------------------------------------------------------- struct State { diff --git a/searchlib/src/vespa/searchlib/fef/CMakeLists.txt b/searchlib/src/vespa/searchlib/fef/CMakeLists.txt index 98f254f298e..971fbd542e7 100644 --- a/searchlib/src/vespa/searchlib/fef/CMakeLists.txt +++ b/searchlib/src/vespa/searchlib/fef/CMakeLists.txt @@ -10,6 +10,7 @@ vespa_add_library(searchlib_fef OBJECT featurenamebuilder.cpp featurenameparser.cpp featureoverrider.cpp + feature_resolver.cpp fef.cpp fieldinfo.cpp fieldpositionsiterator.cpp diff --git a/searchlib/src/vespa/searchlib/fef/blueprintresolver.cpp b/searchlib/src/vespa/searchlib/fef/blueprintresolver.cpp index 505d7c102ce..10718b7588a 100644 --- a/searchlib/src/vespa/searchlib/fef/blueprintresolver.cpp +++ b/searchlib/src/vespa/searchlib/fef/blueprintresolver.cpp @@ -1,15 +1,14 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".fef.blueprintresolver"); #include "blueprintresolver.h" #include "blueprintfactory.h" #include "featurenameparser.h" -#include "featurenamebuilder.h" #include <stack> #include <vespa/vespalib/util/stringfmt.h> +#include <vespa/log/log.h> +LOG_SETUP(".fef.blueprintresolver"); + namespace search { namespace fef { @@ -172,6 +171,15 @@ struct Compiler : public Blueprint::DependencyHandler { } // namespace search::fef::<unnamed> +BlueprintResolver::ExecutorSpec::ExecutorSpec(Blueprint::SP blueprint_in) + : blueprint(blueprint_in), + inputs(), + output_types() +{ } + +BlueprintResolver::ExecutorSpec::~ExecutorSpec() { } +BlueprintResolver::~BlueprintResolver() { } + BlueprintResolver::BlueprintResolver(const BlueprintFactory &factory, const IIndexEnvironment &indexEnv) : _factory(factory), diff --git a/searchlib/src/vespa/searchlib/fef/blueprintresolver.h b/searchlib/src/vespa/searchlib/fef/blueprintresolver.h index ceab7125ba8..cde3e9b940d 100644 --- a/searchlib/src/vespa/searchlib/fef/blueprintresolver.h +++ b/searchlib/src/vespa/searchlib/fef/blueprintresolver.h @@ -57,8 +57,8 @@ public: std::vector<FeatureRef> inputs; std::vector<FeatureType> output_types; - ExecutorSpec(Blueprint::SP blueprint_in) - : blueprint(blueprint_in), inputs(), output_types() {} + ExecutorSpec(Blueprint::SP blueprint_in); + ~ExecutorSpec(); }; typedef std::vector<ExecutorSpec> ExecutorSpecList; @@ -82,6 +82,7 @@ private: public: BlueprintResolver(const BlueprintResolver &) = delete; BlueprintResolver &operator=(const BlueprintResolver &) = delete; + ~BlueprintResolver(); /** * Create a new blueprint resolver within the given index diff --git a/searchlib/src/vespa/searchlib/fef/feature_resolver.cpp b/searchlib/src/vespa/searchlib/fef/feature_resolver.cpp new file mode 100644 index 00000000000..8d42e8d8174 --- /dev/null +++ b/searchlib/src/vespa/searchlib/fef/feature_resolver.cpp @@ -0,0 +1,21 @@ +// Copyright 2017 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#include "feature_resolver.h" + +namespace search { +namespace fef { + +FeatureResolver::FeatureResolver(size_t size_hint) + : _names(), + _features(), + _is_object() +{ + _names.reserve(size_hint); + _features.reserve(size_hint); + _is_object.reserve(size_hint); +} + +FeatureResolver::~FeatureResolver() { } + +} // namespace fef +} // namespace search diff --git a/searchlib/src/vespa/searchlib/fef/feature_resolver.h b/searchlib/src/vespa/searchlib/fef/feature_resolver.h index 0280106b133..2dd85ecaf74 100644 --- a/searchlib/src/vespa/searchlib/fef/feature_resolver.h +++ b/searchlib/src/vespa/searchlib/fef/feature_resolver.h @@ -22,11 +22,8 @@ private: std::vector<LazyValue> _features; std::vector<bool> _is_object; public: - FeatureResolver(size_t size_hint) : _names(), _features(), _is_object() { - _names.reserve(size_hint); - _features.reserve(size_hint); - _is_object.reserve(size_hint); - } + FeatureResolver(size_t size_hint); + ~FeatureResolver(); void add(const vespalib::string &name, LazyValue feature, bool is_object) { _names.push_back(name); _features.push_back(feature); diff --git a/searchlib/src/vespa/searchlib/fef/featurenameparser.cpp b/searchlib/src/vespa/searchlib/fef/featurenameparser.cpp index 2d646de5a72..fca21041f87 100644 --- a/searchlib/src/vespa/searchlib/fef/featurenameparser.cpp +++ b/searchlib/src/vespa/searchlib/fef/featurenameparser.cpp @@ -495,5 +495,8 @@ FeatureNameParser::FeatureNameParser(const string &input) } } +FeatureNameParser::~FeatureNameParser() { } + + } // namespace fef } // namespace search diff --git a/searchlib/src/vespa/searchlib/fef/featurenameparser.h b/searchlib/src/vespa/searchlib/fef/featurenameparser.h index fea86479d0b..1d40d3a0306 100644 --- a/searchlib/src/vespa/searchlib/fef/featurenameparser.h +++ b/searchlib/src/vespa/searchlib/fef/featurenameparser.h @@ -36,6 +36,7 @@ public: * @param featureName feature name **/ FeatureNameParser(const vespalib::string &featureName); + ~FeatureNameParser(); /** * Does this object represent a valid feature name? diff --git a/searchlib/src/vespa/searchlib/fef/matchdatalayout.cpp b/searchlib/src/vespa/searchlib/fef/matchdatalayout.cpp index c2a258a5210..11e6c4a40c6 100644 --- a/searchlib/src/vespa/searchlib/fef/matchdatalayout.cpp +++ b/searchlib/src/vespa/searchlib/fef/matchdatalayout.cpp @@ -1,6 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> #include "matchdatalayout.h" namespace search { @@ -12,6 +11,9 @@ MatchDataLayout::MatchDataLayout() { } +MatchDataLayout::~MatchDataLayout() { } + + MatchData::UP MatchDataLayout::createMatchData() const { diff --git a/searchlib/src/vespa/searchlib/fef/matchdatalayout.h b/searchlib/src/vespa/searchlib/fef/matchdatalayout.h index 227a6611030..cb8523fadbd 100644 --- a/searchlib/src/vespa/searchlib/fef/matchdatalayout.h +++ b/searchlib/src/vespa/searchlib/fef/matchdatalayout.h @@ -23,6 +23,7 @@ public: * Create an empty object. **/ MatchDataLayout(); + ~MatchDataLayout(); /** * Allocate space for a term field match data structure. diff --git a/searchlib/src/vespa/searchlib/fef/parametervalidator.cpp b/searchlib/src/vespa/searchlib/fef/parametervalidator.cpp index 203de1ba8f0..8f6ea9db453 100644 --- a/searchlib/src/vespa/searchlib/fef/parametervalidator.cpp +++ b/searchlib/src/vespa/searchlib/fef/parametervalidator.cpp @@ -44,6 +44,8 @@ ParameterValidator::Result::Result(size_t tag) : { } +ParameterValidator::Result::~Result() { } + void ParameterValidator::validateField(ParameterType::Enum type, ParameterCollection::Enum collection, size_t i, Result & result) diff --git a/searchlib/src/vespa/searchlib/fef/parametervalidator.h b/searchlib/src/vespa/searchlib/fef/parametervalidator.h index e416ea1ecdf..94ad19ddc17 100644 --- a/searchlib/src/vespa/searchlib/fef/parametervalidator.h +++ b/searchlib/src/vespa/searchlib/fef/parametervalidator.h @@ -37,6 +37,7 @@ public: * Creates a result for the parameter description with the given tag. */ Result(size_t tag = 0); + ~Result(); Result & addParameter(const Parameter & param) { _params.push_back(param); return *this; } Result & setError(const vespalib::stringref & str) { _errorStr = str; diff --git a/searchlib/src/vespa/searchlib/fef/test/ftlib.cpp b/searchlib/src/vespa/searchlib/fef/test/ftlib.cpp index 8030d387362..17e405bef7e 100644 --- a/searchlib/src/vespa/searchlib/fef/test/ftlib.cpp +++ b/searchlib/src/vespa/searchlib/fef/test/ftlib.cpp @@ -29,6 +29,8 @@ FtQueryEnvironment::FtQueryEnvironment(search::fef::test::IndexEnvironment &env) // empty } +FtQueryEnvironment::~FtQueryEnvironment() { } + FtDumpFeatureVisitor::FtDumpFeatureVisitor() : _features() { diff --git a/searchlib/src/vespa/searchlib/fef/test/ftlib.h b/searchlib/src/vespa/searchlib/fef/test/ftlib.h index 288f70dbdd5..245d8bb4998 100644 --- a/searchlib/src/vespa/searchlib/fef/test/ftlib.h +++ b/searchlib/src/vespa/searchlib/fef/test/ftlib.h @@ -70,6 +70,7 @@ private: class FtQueryEnvironment : public search::fef::test::QueryEnvironment { public: FtQueryEnvironment(search::fef::test::IndexEnvironment &indexEnv); + ~FtQueryEnvironment(); search::fef::test::QueryEnvironmentBuilder &getBuilder() { return _builder; } search::fef::MatchDataLayout &getLayout() { return _layout; } diff --git a/searchlib/src/vespa/searchlib/fef/test/queryenvironment.cpp b/searchlib/src/vespa/searchlib/fef/test/queryenvironment.cpp index af68e2a5163..f2ce596dbea 100644 --- a/searchlib/src/vespa/searchlib/fef/test/queryenvironment.cpp +++ b/searchlib/src/vespa/searchlib/fef/test/queryenvironment.cpp @@ -1,5 +1,5 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> + #include "queryenvironment.h" namespace search { @@ -15,6 +15,8 @@ QueryEnvironment::QueryEnvironment(IndexEnvironment *env) { } +QueryEnvironment::~QueryEnvironment() { } + } // namespace test } // namespace fef } // namespace search diff --git a/searchlib/src/vespa/searchlib/fef/test/queryenvironment.h b/searchlib/src/vespa/searchlib/fef/test/queryenvironment.h index acb454bbfa7..047af1152d5 100644 --- a/searchlib/src/vespa/searchlib/fef/test/queryenvironment.h +++ b/searchlib/src/vespa/searchlib/fef/test/queryenvironment.h @@ -33,6 +33,7 @@ public: * @param indexEnv The index environment of this. */ QueryEnvironment(IndexEnvironment *indexEnv = NULL); + ~QueryEnvironment(); // Inherit doc from IQueryEnvironment. virtual const Properties &getProperties() const { return _properties; } diff --git a/searchlib/src/vespa/searchlib/fef/test/queryenvironmentbuilder.cpp b/searchlib/src/vespa/searchlib/fef/test/queryenvironmentbuilder.cpp index 8291a2b7ebd..7db5110e627 100644 --- a/searchlib/src/vespa/searchlib/fef/test/queryenvironmentbuilder.cpp +++ b/searchlib/src/vespa/searchlib/fef/test/queryenvironmentbuilder.cpp @@ -14,6 +14,8 @@ QueryEnvironmentBuilder::QueryEnvironmentBuilder(QueryEnvironment &env, // empty } +QueryEnvironmentBuilder::~QueryEnvironmentBuilder() { } + SimpleTermData & QueryEnvironmentBuilder::addAllFields() { diff --git a/searchlib/src/vespa/searchlib/fef/test/queryenvironmentbuilder.h b/searchlib/src/vespa/searchlib/fef/test/queryenvironmentbuilder.h index 2842e4d8ca5..564c8deed5a 100644 --- a/searchlib/src/vespa/searchlib/fef/test/queryenvironmentbuilder.h +++ b/searchlib/src/vespa/searchlib/fef/test/queryenvironmentbuilder.h @@ -17,6 +17,7 @@ public: * @param layout The layout of match data to simultaneously update. */ QueryEnvironmentBuilder(QueryEnvironment &queryEnv, MatchDataLayout &layout); + ~QueryEnvironmentBuilder(); /** * Add a term node searching all known fields to this query diff --git a/searchlib/src/vespa/searchlib/predicate/predicate_tree_analyzer.cpp b/searchlib/src/vespa/searchlib/predicate/predicate_tree_analyzer.cpp index 543d972e88b..41d754c6649 100644 --- a/searchlib/src/vespa/searchlib/predicate/predicate_tree_analyzer.cpp +++ b/searchlib/src/vespa/searchlib/predicate/predicate_tree_analyzer.cpp @@ -160,10 +160,15 @@ float PredicateTreeAnalyzer::findMinFeature(const Inspector &in) { return 0.0f; } -PredicateTreeAnalyzer::PredicateTreeAnalyzer(const Inspector &in) : _has_not(false), _negated(false) { +PredicateTreeAnalyzer::PredicateTreeAnalyzer(const Inspector &in) + : _has_not(false), + _negated(false) +{ traverseTree(in); _min_feature = static_cast<int>(std::ceil(float(findMinFeature(in)) + (_has_not? 1.0 : 0.0))); } +PredicateTreeAnalyzer::~PredicateTreeAnalyzer() { } + } // namespace predicate } // namespace search diff --git a/searchlib/src/vespa/searchlib/predicate/predicate_tree_analyzer.h b/searchlib/src/vespa/searchlib/predicate/predicate_tree_analyzer.h index 35e91db718c..123523c8d64 100644 --- a/searchlib/src/vespa/searchlib/predicate/predicate_tree_analyzer.h +++ b/searchlib/src/vespa/searchlib/predicate/predicate_tree_analyzer.h @@ -32,6 +32,7 @@ class PredicateTreeAnalyzer { public: PredicateTreeAnalyzer(const vespalib::slime::Inspector &in); + ~PredicateTreeAnalyzer(); int getMinFeature() const { return _min_feature; } int getSize() const { return _size; } diff --git a/searchlib/src/vespa/searchlib/query/query.cpp b/searchlib/src/vespa/searchlib/query/query.cpp index 13723fdcd1a..2c42a47ce38 100644 --- a/searchlib/src/vespa/searchlib/query/query.cpp +++ b/searchlib/src/vespa/searchlib/query/query.cpp @@ -31,6 +31,8 @@ QueryConnector::QueryConnector(const char * opName) : { } +QueryConnector::~QueryConnector() { } + const HitList & QueryConnector::evaluateHits(HitList & hl) const { if (evaluate()) { diff --git a/searchlib/src/vespa/searchlib/query/query.h b/searchlib/src/vespa/searchlib/query/query.h index 5da46d3b4b1..401febac202 100644 --- a/searchlib/src/vespa/searchlib/query/query.h +++ b/searchlib/src/vespa/searchlib/query/query.h @@ -17,6 +17,7 @@ class QueryConnector : public QueryNode, public QueryNodeList public: DECLARE_IDENTIFIABLE_ABSTRACT_NS(search, QueryConnector); QueryConnector(const char * opName); + ~QueryConnector(); virtual const HitList & evaluateHits(HitList & hl) const; /// Will clear the results from the querytree. virtual void reset(); diff --git a/searchlib/src/vespa/searchlib/queryeval/blueprint.cpp b/searchlib/src/vespa/searchlib/queryeval/blueprint.cpp index d27e89e6246..c9bdea68c06 100644 --- a/searchlib/src/vespa/searchlib/queryeval/blueprint.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/blueprint.cpp @@ -1,11 +1,11 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. #include "blueprint.h" -#include <vespa/vespalib/objects/visit.hpp> -#include <vespa/vespalib/objects/objectdumper.h> #include "leaf_blueprints.h" #include "intermediate_blueprints.h" #include "equiv_blueprint.h" +#include <vespa/vespalib/objects/visit.hpp> +#include <vespa/vespalib/objects/objectdumper.h> #include <vespa/vespalib/util/classname.h> #include <vespa/log/log.h> @@ -61,6 +61,16 @@ Blueprint::min(const std::vector<HitEstimate> &data) return est; } +Blueprint::State::State(const FieldSpecBaseList &fields_in) + : _fields(fields_in), + _estimate(), + _tree_size(1), + _allow_termwise_eval(true) +{ +} + +Blueprint::State::~State() { } + Blueprint::Blueprint() : _parent(0), _sourceId(0xffffffff), @@ -452,6 +462,14 @@ IntermediateBlueprint::calculateUnpackInfo(const fef::MatchData & md) const //----------------------------------------------------------------------------- +LeafBlueprint::LeafBlueprint(const FieldSpecBaseList &fields, bool allow_termwise_eval) + : _state(fields) +{ + _state.allow_termwise_eval(allow_termwise_eval); +} + +LeafBlueprint::~LeafBlueprint() { } + void LeafBlueprint::fetchPostings(bool strict) { diff --git a/searchlib/src/vespa/searchlib/queryeval/blueprint.h b/searchlib/src/vespa/searchlib/queryeval/blueprint.h index c1b1f1311eb..b317c9094f1 100644 --- a/searchlib/src/vespa/searchlib/queryeval/blueprint.h +++ b/searchlib/src/vespa/searchlib/queryeval/blueprint.h @@ -62,13 +62,8 @@ public: bool _allow_termwise_eval; public: - State(const FieldSpecBaseList &fields_in) - : _fields(fields_in), - _estimate(), - _tree_size(1), - _allow_termwise_eval(true) - { - } + State(const FieldSpecBaseList &fields_in); + ~State(); void swap(State & rhs) { _fields.swap(rhs._fields); std::swap(_estimate, rhs._estimate); @@ -292,11 +287,9 @@ protected: void set_allow_termwise_eval(bool value); void set_tree_size(uint32_t value); - LeafBlueprint(const FieldSpecBaseList &fields, bool allow_termwise_eval) : _state(fields) { - _state.allow_termwise_eval(allow_termwise_eval); - } - + LeafBlueprint(const FieldSpecBaseList &fields, bool allow_termwise_eval); public: + ~LeafBlueprint(); const State &getState() const override final { return _state; } void setDocIdLimit(uint32_t limit) override final { Blueprint::setDocIdLimit(limit); } void fetchPostings(bool strict) override; diff --git a/searchlib/src/vespa/searchlib/queryeval/fake_result.cpp b/searchlib/src/vespa/searchlib/queryeval/fake_result.cpp index 6c152376803..2fd4776749e 100644 --- a/searchlib/src/vespa/searchlib/queryeval/fake_result.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/fake_result.cpp @@ -1,13 +1,13 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".fakeresult"); #include "fake_result.h" +#include <ostream> namespace search { namespace queryeval { +FakeResult::~FakeResult() { } + std::ostream &operator << (std::ostream &out, const FakeResult &result) { const std::vector<FakeResult::Document> &doc = result.inspect(); if (doc.size() == 0) { diff --git a/searchlib/src/vespa/searchlib/queryeval/fake_result.h b/searchlib/src/vespa/searchlib/queryeval/fake_result.h index d47cbcf8763..93f833f2d9a 100644 --- a/searchlib/src/vespa/searchlib/queryeval/fake_result.h +++ b/searchlib/src/vespa/searchlib/queryeval/fake_result.h @@ -47,6 +47,7 @@ private: public: FakeResult() : _documents(), _minMaxPostingInfo() {} + ~FakeResult(); FakeResult &doc(uint32_t docId) { _documents.push_back(Document(docId)); diff --git a/searchlib/src/vespa/searchlib/queryeval/fake_searchable.cpp b/searchlib/src/vespa/searchlib/queryeval/fake_searchable.cpp index c9f088f9039..283c15fd970 100644 --- a/searchlib/src/vespa/searchlib/queryeval/fake_searchable.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/fake_searchable.cpp @@ -1,16 +1,9 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".searchlib.queryeval.fake_searchable"); - #include "fake_searchable.h" #include "leaf_blueprints.h" #include "termasstring.h" - #include "create_blueprint_visitor_helper.h" -#include <vespa/searchlib/fef/termfieldmatchdata.h> -#include <vespa/searchlib/queryeval/searchiterator.h> #include <vespa/vespalib/objects/visit.h> using search::query::NumberTerm; @@ -54,28 +47,12 @@ class LookupVisitor : public CreateBlueprintVisitorHelper const vespalib::string _tag; public: - LookupVisitor(Searchable &searchable, - const IRequestContext & requestContext, - const Map &map, const vespalib::string &tag, - const FieldSpec &field) - : CreateBlueprintVisitorHelper(searchable, field, requestContext), - _map(map), _tag(tag) {} + LookupVisitor(Searchable &searchable, const IRequestContext & requestContext, + const Map &map, const vespalib::string &tag, const FieldSpec &field); + ~LookupVisitor(); template <class TermNode> - void visitTerm(TermNode &n) { - const vespalib::string term_string = termAsString(n); - - FakeResult result; - typename Map::const_iterator pos = - _map.find(typename Map::key_type(getField().getName(), term_string)); - if (pos != _map.end()) { - result = pos->second; - } - FakeBlueprint *fake = new FakeBlueprint(getField(), result); - Blueprint::UP b(fake); - fake->tag(_tag).term(term_string); - setResult(std::move(b)); - } + void visitTerm(TermNode &n); virtual void visit(NumberTerm &n) { visitTerm(n); } virtual void visit(LocationTerm &n) { visitTerm(n); } @@ -88,6 +65,35 @@ public: virtual void visit(RegExpTerm &n) { visitTerm(n); } }; +template <class Map> +LookupVisitor<Map>::LookupVisitor(Searchable &searchable, const IRequestContext & requestContext, + const Map &map, const vespalib::string &tag, const FieldSpec &field) + : CreateBlueprintVisitorHelper(searchable, field, requestContext), + _map(map), + _tag(tag) +{} + +template <class Map> +LookupVisitor<Map>::~LookupVisitor() { } + +template <class Map> +template <class TermNode> +void +LookupVisitor<Map>::visitTerm(TermNode &n) { + const vespalib::string term_string = termAsString(n); + + FakeResult result; + typename Map::const_iterator pos = + _map.find(typename Map::key_type(getField().getName(), term_string)); + if (pos != _map.end()) { + result = pos->second; + } + FakeBlueprint *fake = new FakeBlueprint(getField(), result); + Blueprint::UP b(fake); + fake->tag(_tag).term(term_string); + setResult(std::move(b)); +} + } // namespace search::queryeval::<unnamed> Blueprint::UP diff --git a/searchlib/src/vespa/searchlib/queryeval/iterator_pack.cpp b/searchlib/src/vespa/searchlib/queryeval/iterator_pack.cpp index 0ed8499a48a..45778bc0cf5 100644 --- a/searchlib/src/vespa/searchlib/queryeval/iterator_pack.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/iterator_pack.cpp @@ -15,7 +15,7 @@ SearchIteratorPack::SearchIteratorPack(SearchIteratorPack &&rhs) : _children(std::move(rhs._children)), _childMatch(std::move(rhs._childMatch)), _md(std::move(rhs._md)) -{ } +{} SearchIteratorPack & SearchIteratorPack::operator=(SearchIteratorPack &&rhs) { @@ -44,7 +44,6 @@ SearchIteratorPack::SearchIteratorPack(const std::vector<SearchIterator*> &child : SearchIteratorPack(children, std::vector<fef::TermFieldMatchData*>(), MatchDataUP()) { } - std::unique_ptr<BitVector> SearchIteratorPack::get_hits(uint32_t begin_id, uint32_t end_id) const { diff --git a/searchlib/src/vespa/searchlib/queryeval/posting_info.h b/searchlib/src/vespa/searchlib/queryeval/posting_info.h index e8d463c45bc..fbdf76e9ad5 100644 --- a/searchlib/src/vespa/searchlib/queryeval/posting_info.h +++ b/searchlib/src/vespa/searchlib/queryeval/posting_info.h @@ -44,4 +44,3 @@ public: } // namespace queryeval } // namespace search - diff --git a/searchlib/src/vespa/searchlib/queryeval/termwise_blueprint_helper.cpp b/searchlib/src/vespa/searchlib/queryeval/termwise_blueprint_helper.cpp index 45d975e5e77..a6ce2c50196 100644 --- a/searchlib/src/vespa/searchlib/queryeval/termwise_blueprint_helper.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/termwise_blueprint_helper.cpp @@ -32,6 +32,8 @@ TermwiseBlueprintHelper::TermwiseBlueprintHelper(const IntermediateBlueprint &se } } +TermwiseBlueprintHelper::~TermwiseBlueprintHelper() { } + void TermwiseBlueprintHelper::insert_termwise(SearchIterator::UP search, bool strict) { diff --git a/searchlib/src/vespa/searchlib/queryeval/termwise_blueprint_helper.h b/searchlib/src/vespa/searchlib/queryeval/termwise_blueprint_helper.h index c99fedd4921..f376520151e 100644 --- a/searchlib/src/vespa/searchlib/queryeval/termwise_blueprint_helper.h +++ b/searchlib/src/vespa/searchlib/queryeval/termwise_blueprint_helper.h @@ -23,6 +23,7 @@ struct TermwiseBlueprintHelper { TermwiseBlueprintHelper(const IntermediateBlueprint &self, const MultiSearch::Children &subSearches, UnpackInfo &unpackInfo); + ~TermwiseBlueprintHelper(); void insert_termwise(SearchIterator::UP search, bool strict); }; diff --git a/searchlib/src/vespa/searchlib/queryeval/wand/wand_parts.cpp b/searchlib/src/vespa/searchlib/queryeval/wand/wand_parts.cpp index 00bb4eda04d..5da3204e2a8 100644 --- a/searchlib/src/vespa/searchlib/queryeval/wand/wand_parts.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/wand/wand_parts.cpp @@ -12,6 +12,10 @@ VectorizedIteratorTerms::visit_members(vespalib::ObjectVisitor &visitor) const { visit(visitor, "children", _terms); } +VectorizedIteratorTerms::VectorizedIteratorTerms(VectorizedIteratorTerms &&) = default; +VectorizedIteratorTerms & VectorizedIteratorTerms::operator=(VectorizedIteratorTerms &&) = default; +VectorizedIteratorTerms::~VectorizedIteratorTerms() { } + } // namespace wand } // namespace queryeval } // namespace search diff --git a/searchlib/src/vespa/searchlib/queryeval/wand/wand_parts.h b/searchlib/src/vespa/searchlib/queryeval/wand/wand_parts.h index ac75047952b..6198b13b38b 100644 --- a/searchlib/src/vespa/searchlib/queryeval/wand/wand_parts.h +++ b/searchlib/src/vespa/searchlib/queryeval/wand/wand_parts.h @@ -158,24 +158,13 @@ private: IteratorPack _iteratorPack; public: - VectorizedState() : _docId(), _weight(), _maxScore(), _iteratorPack() {} + VectorizedState(); + VectorizedState(VectorizedState &&); + VectorizedState & operator=(VectorizedState &&); + ~VectorizedState(); template <typename Scorer, typename Input> - std::vector<ref_t> init_state(const Input &input, uint32_t docIdLimit) { - std::vector<ref_t> order; - std::vector<score_t> max_scores; - order.reserve(input.size()); - max_scores.reserve(input.size()); - for (size_t i = 0; i < input.size(); ++i) { - order.push_back(i); - max_scores.push_back(Scorer::calculate_max_score(input, i)); - } - std::sort(order.begin(), order.end(), MaxSkipOrder<Input>(docIdLimit, input, max_scores)); - _docId = assemble([&input](ref_t ref){ return input.get_initial_docid(ref); }, order); - _weight = assemble([&input](ref_t ref){ return input.get_weight(ref); }, order); - _maxScore = assemble([&max_scores](ref_t ref){ return max_scores[ref]; }, order); - return order; - } + std::vector<ref_t> init_state(const Input &input, uint32_t docIdLimit); docid_t *docId() { return &(_docId[0]); } const int32_t *weight() const { return &(_weight[0]); } @@ -191,16 +180,56 @@ public: uint32_t seek(uint16_t ref, uint32_t docid) { return _iteratorPack.seek(ref, docid); } int32_t get_weight(uint16_t ref, uint32_t docid) { return _iteratorPack.get_weight(ref, docid); } - vespalib::string stringify_docid() const { - auto range = assemble(Ident(), NumericOrder(_docId.size())); - return do_stringify("state{docid}", range.begin(), range.end(), - [this](ref_t ref) - { - return vespalib::make_string("%u:%u/%u", ref, _docId[ref], _iteratorPack.get_docid(ref)); - }); - } + vespalib::string stringify_docid() const; }; +template <typename IteratorPack> +VectorizedState<IteratorPack>::VectorizedState() + : _docId(), + _weight(), + _maxScore(), + _iteratorPack() +{} +template <typename IteratorPack> +VectorizedState<IteratorPack>::~VectorizedState() { } + +template <typename IteratorPack> +VectorizedState<IteratorPack>::VectorizedState(VectorizedState &&) = default; + +template <typename IteratorPack> +VectorizedState<IteratorPack> & +VectorizedState<IteratorPack>::operator=(VectorizedState &&) = default; + +template <typename IteratorPack> +template <typename Scorer, typename Input> +std::vector<ref_t> +VectorizedState<IteratorPack>::init_state(const Input &input, uint32_t docIdLimit) { + std::vector<ref_t> order; + std::vector<score_t> max_scores; + order.reserve(input.size()); + max_scores.reserve(input.size()); + for (size_t i = 0; i < input.size(); ++i) { + order.push_back(i); + max_scores.push_back(Scorer::calculate_max_score(input, i)); + } + std::sort(order.begin(), order.end(), MaxSkipOrder<Input>(docIdLimit, input, max_scores)); + _docId = assemble([&input](ref_t ref){ return input.get_initial_docid(ref); }, order); + _weight = assemble([&input](ref_t ref){ return input.get_weight(ref); }, order); + _maxScore = assemble([&max_scores](ref_t ref){ return max_scores[ref]; }, order); + return order; +} + +template <typename IteratorPack> +vespalib::string +VectorizedState<IteratorPack>::stringify_docid() const { + auto range = assemble(Ident(), NumericOrder(_docId.size())); + return do_stringify("state{docid}", range.begin(), range.end(), + [this](ref_t ref) + { + return vespalib::make_string("%u:%u/%u", ref, _docId[ref], _iteratorPack.get_docid(ref)); + }); +} + //----------------------------------------------------------------------------- class VectorizedIteratorTerms : public VectorizedState<SearchIteratorPack> @@ -211,20 +240,28 @@ private: public: template <typename Scorer> VectorizedIteratorTerms(const Terms &t, const Scorer &, uint32_t docIdLimit, - fef::MatchData::UP childrenMatchData) - : _terms() - { - std::vector<ref_t> order = init_state<Scorer>(TermInput(t), docIdLimit); - _terms = assemble([&t](ref_t ref){ return t[ref]; }, order); - iteratorPack() = SearchIteratorPack(assemble([&t](ref_t ref){ return t[ref].search; }, order), - assemble([&t](ref_t ref){ return t[ref].matchData; }, order), - std::move(childrenMatchData)); - } + fef::MatchData::UP childrenMatchData); + VectorizedIteratorTerms(VectorizedIteratorTerms &&); + VectorizedIteratorTerms & operator=(VectorizedIteratorTerms &&); + + ~VectorizedIteratorTerms(); void unpack(uint16_t ref, uint32_t docid) { iteratorPack().unpack(ref, docid); } void visit_members(vespalib::ObjectVisitor &visitor) const; const Terms &input_terms() const { return _terms; } }; +template <typename Scorer> +VectorizedIteratorTerms::VectorizedIteratorTerms(const Terms &t, const Scorer &, uint32_t docIdLimit, + fef::MatchData::UP childrenMatchData) + : _terms() +{ + std::vector<ref_t> order = init_state<Scorer>(TermInput(t), docIdLimit); + _terms = assemble([&t](ref_t ref){ return t[ref]; }, order); + iteratorPack() = SearchIteratorPack(assemble([&t](ref_t ref){ return t[ref].search; }, order), + assemble([&t](ref_t ref){ return t[ref].matchData; }, order), + std::move(childrenMatchData)); +} + //----------------------------------------------------------------------------- struct VectorizedAttributeTerms : VectorizedState<AttributeIteratorPack> { @@ -278,28 +315,9 @@ private: size_t _size; public: - DualHeap(const DocIdOrder &futureCmp, size_t size) - : _futureCmp(futureCmp), _space(), _future(nullptr), _present(nullptr), _past(nullptr), _trash(nullptr), _size(size) - { - FutureHeap::require_left_heap(); - PastHeap::require_right_heap(); - _space.reserve(size); - init(); - } - void init() { - _space.clear(); - _future = &(_space[0]); - _present = _future; - for (size_t i = 0; i < _size; ++i) { - if (!_futureCmp.at_end(i)) { - _space.push_back(i); - FutureHeap::push(_future, ++_present, _futureCmp); - } - } - _past = _present; - _trash = _past; - assert(_future == &(_space[0])); // space has not moved - } + DualHeap(const DocIdOrder &futureCmp, size_t size); + ~DualHeap(); + void init(); bool has_future() const { return (_future != _present);} bool has_present() const { return (_present != _past);} bool has_past() const { return (_past != _trash);} @@ -320,17 +338,56 @@ public: } ref_t *present_begin() const { return _present; } ref_t *present_end() const { return _past; } - vespalib::string stringify() const { - return "Heaps: " - + do_stringify("future", _future, _present, - [this](ref_t ref){ return vespalib::make_string("%u@%u", ref, _futureCmp.get_pos(ref)); }) - + " " + do_stringify("present", _present, _past, - [this](ref_t ref){ return vespalib::make_string("%u@%u", ref, _futureCmp.get_pos(ref)); }) - + " " + do_stringify("past", _past, _trash, - [this](ref_t ref){ return vespalib::make_string("%u@%u", ref, _futureCmp.get_pos(ref)); }); - } + vespalib::string stringify() const; }; +template <typename FutureHeap, typename PastHeap> +DualHeap<FutureHeap, PastHeap>::DualHeap(const DocIdOrder &futureCmp, size_t size) + : _futureCmp(futureCmp), + _space(), + _future(nullptr), + _present(nullptr), + _past(nullptr), + _trash(nullptr), + _size(size) +{ + FutureHeap::require_left_heap(); + PastHeap::require_right_heap(); + _space.reserve(size); + init(); +} + +template <typename FutureHeap, typename PastHeap> +DualHeap<FutureHeap, PastHeap>::~DualHeap() { } + +template <typename FutureHeap, typename PastHeap> +void +DualHeap<FutureHeap, PastHeap>::init() { + _space.clear(); + _future = &(_space[0]); + _present = _future; + for (size_t i = 0; i < _size; ++i) { + if (!_futureCmp.at_end(i)) { + _space.push_back(i); + FutureHeap::push(_future, ++_present, _futureCmp); + } + } + _past = _present; + _trash = _past; + assert(_future == &(_space[0])); // space has not moved +} + +template <typename FutureHeap, typename PastHeap> +vespalib::string +DualHeap<FutureHeap, PastHeap>::stringify() const { + return "Heaps: " + + do_stringify("future", _future, _present, + [this](ref_t ref){ return vespalib::make_string("%u@%u", ref, _futureCmp.get_pos(ref)); }) + + " " + do_stringify("present", _present, _past, + [this](ref_t ref){ return vespalib::make_string("%u@%u", ref, _futureCmp.get_pos(ref)); }) + + " " + do_stringify("past", _past, _trash, + [this](ref_t ref){ return vespalib::make_string("%u@%u", ref, _futureCmp.get_pos(ref)); }); +} //----------------------------------------------------------------------------- #define TermFrequencyScorer_TERM_SCORE_FACTOR 1000000.0 diff --git a/searchlib/src/vespa/searchlib/queryeval/wand/weak_and_heap.cpp b/searchlib/src/vespa/searchlib/queryeval/wand/weak_and_heap.cpp index e8e149da476..d61019692f8 100644 --- a/searchlib/src/vespa/searchlib/queryeval/wand/weak_and_heap.cpp +++ b/searchlib/src/vespa/searchlib/queryeval/wand/weak_and_heap.cpp @@ -1,9 +1,6 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> -#include <vespa/log/log.h> -LOG_SETUP(".queryeval.weak_and_heap"); + #include "weak_and_heap.h" -#include <limits> namespace search { namespace queryeval { @@ -16,6 +13,8 @@ SharedWeakAndPriorityQueue::SharedWeakAndPriorityQueue(uint32_t scoresToTrack) : _bestScores.reserve(scoresToTrack); } +SharedWeakAndPriorityQueue::~SharedWeakAndPriorityQueue() { } + void SharedWeakAndPriorityQueue::adjust(score_t *begin, score_t *end) { diff --git a/searchlib/src/vespa/searchlib/queryeval/wand/weak_and_heap.h b/searchlib/src/vespa/searchlib/queryeval/wand/weak_and_heap.h index 7208dca2dbe..a5bc894ce0d 100644 --- a/searchlib/src/vespa/searchlib/queryeval/wand/weak_and_heap.h +++ b/searchlib/src/vespa/searchlib/queryeval/wand/weak_and_heap.h @@ -58,6 +58,7 @@ private: public: SharedWeakAndPriorityQueue(uint32_t scoresToTrack); + ~SharedWeakAndPriorityQueue(); Scores &getScores() { return _bestScores; } void adjust(score_t *begin, score_t *end) override; }; diff --git a/searchlib/src/vespa/searchlib/tensor/dense_tensor_attribute.cpp b/searchlib/src/vespa/searchlib/tensor/dense_tensor_attribute.cpp index 31e0c547a7a..7a395e04c09 100644 --- a/searchlib/src/vespa/searchlib/tensor/dense_tensor_attribute.cpp +++ b/searchlib/src/vespa/searchlib/tensor/dense_tensor_attribute.cpp @@ -32,48 +32,55 @@ private: size_t _numBoundCells; std::vector<uint32_t> _unboundDimSizes; public: - TensorReader(AttributeVector &attr) - : ReaderBase(attr), - _tensorType(vespalib::eval::ValueType::from_spec(getDatHeader().getTag(tensorTypeTag).asString())), - _numUnboundDims(0), - _numBoundCells(1), - _unboundDimSizes() - { - for (const auto & dim : _tensorType.dimensions()) { - if (dim.is_bound()) { - _numBoundCells *= dim.size; - } else { - ++_numUnboundDims; - } - } - _unboundDimSizes.resize(_numUnboundDims); - } - size_t getNumCells() { - unsigned char detect; - _datFile->ReadBuf(&detect, sizeof(detect)); - if (detect == tensorIsNotPresent) { - return 0u; - } - if (detect != tensorIsPresent) { - abort(); - } - size_t numCells = _numBoundCells; - if (_numUnboundDims != 0) { - _datFile->ReadBuf(&_unboundDimSizes[0], - _numUnboundDims * sizeof(uint32_t)); - for (auto i = 0u; i < _numUnboundDims; ++i) { - assert(_unboundDimSizes[i] != 0u); - numCells *= _unboundDimSizes[i]; - // TODO: sanity check numCells - } - } - return numCells; - } + TensorReader(AttributeVector &attr); + ~TensorReader(); + size_t getNumCells(); const vespalib::eval::ValueType &tensorType() const { return _tensorType; } const std::vector<uint32_t> &getUnboundDimSizes() const { return _unboundDimSizes; } void readTensor(void *buf, size_t len) { _datFile->ReadBuf(buf, len); } }; +TensorReader::TensorReader(AttributeVector &attr) + : ReaderBase(attr), + _tensorType(vespalib::eval::ValueType::from_spec(getDatHeader().getTag(tensorTypeTag).asString())), + _numUnboundDims(0), + _numBoundCells(1), + _unboundDimSizes() +{ + for (const auto & dim : _tensorType.dimensions()) { + if (dim.is_bound()) { + _numBoundCells *= dim.size; + } else { + ++_numUnboundDims; + } + } + _unboundDimSizes.resize(_numUnboundDims); +} +TensorReader::~TensorReader() { } + +size_t +TensorReader::getNumCells() { + unsigned char detect; + _datFile->ReadBuf(&detect, sizeof(detect)); + if (detect == tensorIsNotPresent) { + return 0u; + } + if (detect != tensorIsPresent) { + abort(); + } + size_t numCells = _numBoundCells; + if (_numUnboundDims != 0) { + _datFile->ReadBuf(&_unboundDimSizes[0], + _numUnboundDims * sizeof(uint32_t)); + for (auto i = 0u; i < _numUnboundDims; ++i) { + assert(_unboundDimSizes[i] != 0u); + numCells *= _unboundDimSizes[i]; + // TODO: sanity check numCells + } + } + return numCells; +} + } DenseTensorAttribute::DenseTensorAttribute(const vespalib::stringref &baseFileName, diff --git a/searchsummary/src/vespa/searchsummary/docsummary/summaryfieldconverter.cpp b/searchsummary/src/vespa/searchsummary/docsummary/summaryfieldconverter.cpp index ded7db38fed..0fa34cf2e16 100644 --- a/searchsummary/src/vespa/searchsummary/docsummary/summaryfieldconverter.cpp +++ b/searchsummary/src/vespa/searchsummary/docsummary/summaryfieldconverter.cpp @@ -318,10 +318,8 @@ class SummaryFieldValueConverter : protected ConstFieldValueVisitor } public: - SummaryFieldValueConverter(bool tokenize, FieldValueConverter &subConverter) - : _str(), _tokenize(tokenize), - _structuredFieldConverter(subConverter) - {} + SummaryFieldValueConverter(bool tokenize, FieldValueConverter &subConverter); + ~SummaryFieldValueConverter(); FieldValue::UP convert(const FieldValue &input) { input.accept(*this); @@ -332,7 +330,11 @@ public: } }; - +SummaryFieldValueConverter::SummaryFieldValueConverter(bool tokenize, FieldValueConverter &subConverter) + : _str(), _tokenize(tokenize), + _structuredFieldConverter(subConverter) +{} +SummaryFieldValueConverter::~SummaryFieldValueConverter() {} using namespace vespalib::slime::convenience; diff --git a/slobrok/src/vespa/slobrok/server/visible_map.cpp b/slobrok/src/vespa/slobrok/server/visible_map.cpp index 6d9ce1b4c19..b041736a2ed 100644 --- a/slobrok/src/vespa/slobrok/server/visible_map.cpp +++ b/slobrok/src/vespa/slobrok/server/visible_map.cpp @@ -1,12 +1,10 @@ // Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include <vespa/fastos/fastos.h> + +#include "visible_map.h" #include <vespa/log/log.h> LOG_SETUP(".vismap"); -#include "visible_map.h" -#include "named_service.h" - namespace slobrok { void @@ -144,7 +142,15 @@ VisibleMap::history(const vespalib::GenCnt& gen) const return retval; } +VisibleMap::MapDiff::MapDiff() {} +VisibleMap::MapDiff::~MapDiff() {} +VisibleMap::VisibleMap() + : _map(NULL), + _waitList(), + _genCnt(1) +{ +} VisibleMap::~VisibleMap() { aborted(); diff --git a/slobrok/src/vespa/slobrok/server/visible_map.h b/slobrok/src/vespa/slobrok/server/visible_map.h index d67cb9ace70..11702ddb92a 100644 --- a/slobrok/src/vespa/slobrok/server/visible_map.h +++ b/slobrok/src/vespa/slobrok/server/visible_map.h @@ -44,6 +44,8 @@ public: struct MapDiff { + MapDiff(); + ~MapDiff(); std::vector<std::string> removed; RpcSrvlist updated; }; @@ -83,12 +85,7 @@ public: MapDiff history(const vespalib::GenCnt& gen) const; - VisibleMap() - : _map(NULL), - _waitList(), - _genCnt(1) - { - } + VisibleMap(); ~VisibleMap(); }; diff --git a/staging_vespalib/src/vespa/vespalib/util/xmlserializable.cpp b/staging_vespalib/src/vespa/vespalib/util/xmlserializable.cpp index d7f482fdf26..58a5489647d 100644 --- a/staging_vespalib/src/vespa/vespalib/util/xmlserializable.cpp +++ b/staging_vespalib/src/vespa/vespalib/util/xmlserializable.cpp @@ -354,6 +354,8 @@ XmlTag::XmlTag(const XmlTag& tag) { } +XmlTag::~XmlTag() {} + XmlTag::XmlTag(const std::string& name, XmlTagFlags flags) : _name(name), _attributes(), @@ -377,9 +379,9 @@ XmlAttribute::XmlAttribute(const XmlAttribute& attribute) } XmlAttribute::XmlAttribute(const std::string& name, const char * value, uint32_t flags) - : _name(name), - _value(), - _next() + : _name(name), + _value(), + _next() { vespalib::asciistream ost; if (flags & HEX) ost << vespalib::hex << "0x"; diff --git a/staging_vespalib/src/vespa/vespalib/util/xmlserializable.h b/staging_vespalib/src/vespa/vespalib/util/xmlserializable.h index 69a48596115..b688c699d76 100644 --- a/staging_vespalib/src/vespa/vespalib/util/xmlserializable.h +++ b/staging_vespalib/src/vespa/vespalib/util/xmlserializable.h @@ -57,6 +57,7 @@ class XmlTag { public: XmlTag(const XmlTag&); XmlTag(const std::string& name, XmlTagFlags = NONE); + ~XmlTag(); const std::string& getName() const { return _name; } }; diff --git a/storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.cpp b/storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.cpp index abe14abe4c5..79dde3f839a 100644 --- a/storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.cpp +++ b/storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.cpp @@ -106,6 +106,8 @@ StorageBucketDBInitializer::Metrics::Metrics(framework::Component& component) component.registerMetric(*this); } +StorageBucketDBInitializer::Metrics::~Metrics() {} + StorageBucketDBInitializer::GlobalState::GlobalState() : _insertedCount(0), _infoReadCount(0), _infoSetByLoad(0), _dirsListed(0), _dirsToList(0), diff --git a/storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.h b/storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.h index a0f4345a2a6..5190be426a5 100644 --- a/storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.h +++ b/storage/src/vespa/storage/bucketdb/storagebucketdbinitializer.h @@ -98,6 +98,7 @@ class StorageBucketDBInitializer : public StorageLink, metrics::LongAverageMetric _initLatency; Metrics(framework::Component&); + ~Metrics(); }; struct GlobalState { vespalib::hash_map<api::StorageMessage::Id, ReadBucketList::SP> _lists; diff --git a/storage/src/vespa/storage/persistence/splitbitdetector.cpp b/storage/src/vespa/storage/persistence/splitbitdetector.cpp index 1d32a751f34..1749df09d28 100644 --- a/storage/src/vespa/storage/persistence/splitbitdetector.cpp +++ b/storage/src/vespa/storage/persistence/splitbitdetector.cpp @@ -53,18 +53,8 @@ struct BucketVisitor : public BucketProcessor::EntryProcessor { }; std::vector<DocInfo> _firstDocs; - BucketVisitor(const document::BucketIdFactory& factory) - : _factory(factory), _splitBit(58), - _splitMask(0), _refId(), _refBucket(), - _conflictId(), _conflictBucket(), - _docCount(0), _docSize(0), _firstDocs() - { - _firstDocs.reserve(keepFirstCount); - // LOG(spam, "Checking out meta entries in bucket"); - for (uint32_t i=0; i<_splitBit; ++i) { - _splitMask = (_splitMask << 1) | 1; - } - } + BucketVisitor(const document::BucketIdFactory& factory); + ~BucketVisitor(); void process(spi::DocEntry& slot) { assert(slot.getDocumentId()); @@ -106,6 +96,20 @@ struct BucketVisitor : public BucketProcessor::EntryProcessor { }; +BucketVisitor::BucketVisitor(const document::BucketIdFactory& factory) + : _factory(factory), _splitBit(58), + _splitMask(0), _refId(), _refBucket(), + _conflictId(), _conflictBucket(), + _docCount(0), _docSize(0), _firstDocs() +{ + _firstDocs.reserve(keepFirstCount); + // LOG(spam, "Checking out meta entries in bucket"); + for (uint32_t i=0; i<_splitBit; ++i) { + _splitMask = (_splitMask << 1) | 1; + } +} +BucketVisitor::~BucketVisitor() { } + bool smallerThanSizeLimit(uint32_t minCount, uint32_t minSize, diff --git a/storage/src/vespa/storage/visiting/visitor.cpp b/storage/src/vespa/storage/visiting/visitor.cpp index 9419f9e2034..30bf3fe9757 100644 --- a/storage/src/vespa/storage/visiting/visitor.cpp +++ b/storage/src/vespa/storage/visiting/visitor.cpp @@ -229,6 +229,8 @@ Visitor::VisitorTarget::VisitorTarget() { } +Visitor::VisitorTarget::~VisitorTarget() {} + Visitor::Visitor(StorageComponent& component) : _component(component), _visitorOptions(), diff --git a/storage/src/vespa/storage/visiting/visitor.h b/storage/src/vespa/storage/visiting/visitor.h index b4686c8f7f0..87b894a6d2c 100644 --- a/storage/src/vespa/storage/visiting/visitor.h +++ b/storage/src/vespa/storage/visiting/visitor.h @@ -272,6 +272,7 @@ private: } VisitorTarget(); + ~VisitorTarget(); }; protected: diff --git a/storageapi/src/vespa/storageapi/message/persistence.cpp b/storageapi/src/vespa/storageapi/message/persistence.cpp index 95466138e18..6de53d9db82 100644 --- a/storageapi/src/vespa/storageapi/message/persistence.cpp +++ b/storageapi/src/vespa/storageapi/message/persistence.cpp @@ -4,7 +4,6 @@ #include <vespa/vespalib/util/exceptions.h> #include <vespa/vespalib/stllike/asciistream.h> - namespace storage { namespace api { @@ -19,6 +18,11 @@ IMPLEMENT_REPLY(RemoveReply) IMPLEMENT_COMMAND(RevertCommand, RevertReply) IMPLEMENT_REPLY(RevertReply) +TestAndSetCommand::TestAndSetCommand(const MessageType & messageType, const document::BucketId & id) + : BucketInfoCommand(messageType, id) +{} +TestAndSetCommand::~TestAndSetCommand() { } + PutCommand::PutCommand(const document::BucketId& id, const document::Document::SP& doc, Timestamp time) : TestAndSetCommand(MessageType::PUT, id), @@ -32,6 +36,8 @@ PutCommand::PutCommand(const document::BucketId& id, } } +PutCommand::~PutCommand() {} + StorageCommand::UP PutCommand::createCopyToForward( const document::BucketId& bucket, uint64_t timestamp) const @@ -78,6 +84,8 @@ PutReply::PutReply(const PutCommand& cmd, bool wasFoundFlag) { } +PutReply::~PutReply() {} + void PutReply::print(std::ostream& out, bool verbose, const std::string& indent) const @@ -111,6 +119,8 @@ UpdateCommand::UpdateCommand(const document::BucketId& id, } } +UpdateCommand::~UpdateCommand() {} + vespalib::string UpdateCommand::getSummary() const { vespalib::asciistream stream; @@ -161,6 +171,8 @@ UpdateReply::UpdateReply(const UpdateCommand& cmd, Timestamp oldTimestamp) { } +UpdateReply::~UpdateReply() {} + void UpdateReply::print(std::ostream& out, bool verbose, const std::string& indent) const @@ -191,6 +203,8 @@ GetCommand::GetCommand(const document::BucketId& bid, { } +GetCommand::~GetCommand() {} + StorageCommand::UP GetCommand::createCopyToForward( const document::BucketId& bucket, uint64_t timestamp) const @@ -237,6 +251,8 @@ GetReply::GetReply(const GetCommand& cmd, { } +GetReply::~GetReply() {} + void GetReply::print(std::ostream& out, bool verbose, const std::string& indent) const @@ -258,6 +274,8 @@ RemoveCommand::RemoveCommand(const document::BucketId& bid, { } +RemoveCommand::~RemoveCommand() {} + StorageCommand::UP RemoveCommand::createCopyToForward( const document::BucketId& bucket, uint64_t timestamp) const @@ -294,6 +312,8 @@ RemoveReply::RemoveReply(const RemoveCommand& cmd, Timestamp oldTimestamp) { } +RemoveReply::~RemoveReply() {} + void RemoveReply::print(std::ostream& out, bool verbose, const std::string& indent) const @@ -319,6 +339,8 @@ RevertCommand::RevertCommand(const document::BucketId& id, { } +RevertCommand::~RevertCommand() {} + void RevertCommand::print(std::ostream& out, bool verbose, const std::string& indent) const @@ -343,6 +365,8 @@ RevertReply::RevertReply(const RevertCommand& cmd) { } +RevertReply::~RevertReply() {} + void RevertReply::print(std::ostream& out, bool verbose, const std::string& indent) const diff --git a/storageapi/src/vespa/storageapi/message/persistence.h b/storageapi/src/vespa/storageapi/message/persistence.h index acccb3f9deb..d0961266cfe 100644 --- a/storageapi/src/vespa/storageapi/message/persistence.h +++ b/storageapi/src/vespa/storageapi/message/persistence.h @@ -22,8 +22,8 @@ class TestAndSetCommand : public BucketInfoCommand { TestAndSetCondition _condition; public: - TestAndSetCommand(const MessageType & messageType, const document::BucketId & id) - : BucketInfoCommand(messageType, id) {} + TestAndSetCommand(const MessageType & messageType, const document::BucketId & id); + ~TestAndSetCommand(); void setCondition(const TestAndSetCondition & condition) { _condition = condition; } const TestAndSetCondition & getCondition() const { return _condition; } @@ -47,8 +47,8 @@ class PutCommand : public TestAndSetCommand { Timestamp _updateTimestamp; public: - PutCommand(const document::BucketId&, const document::Document::SP&, - Timestamp); + PutCommand(const document::BucketId&, const document::Document::SP&, Timestamp); + ~PutCommand(); void setTimestamp(Timestamp ts) { _timestamp = ts; } @@ -94,6 +94,7 @@ class PutReply : public BucketInfoReply { public: explicit PutReply(const PutCommand& cmd, bool wasFound = true); + ~PutReply(); const document::DocumentId& getDocumentId() const { return _docId; } bool hasDocument() const { return _document.get(); } @@ -124,6 +125,7 @@ class UpdateCommand : public TestAndSetCommand { public: UpdateCommand(const document::BucketId&, const document::DocumentUpdate::SP&, Timestamp); + ~UpdateCommand(); void setTimestamp(Timestamp ts) { _timestamp = ts; } void setOldTimestamp(Timestamp ts) { _oldTimestamp = ts; } @@ -163,6 +165,7 @@ class UpdateReply : public BucketInfoReply { public: UpdateReply(const UpdateCommand& cmd, Timestamp oldTimestamp = 0); + ~UpdateReply(); void setOldTimestamp(Timestamp ts) { _oldTimestamp = ts; } @@ -205,6 +208,7 @@ class GetCommand : public BucketInfoCommand { public: GetCommand(const document::BucketId&, const document::DocumentId&, const vespalib::stringref & fieldSet, Timestamp before = MAX_TIMESTAMP); + ~GetCommand(); void setBeforeTimestamp(Timestamp ts) { _beforeTimestamp = ts; } @@ -240,6 +244,7 @@ public: GetReply(const GetCommand& cmd, const document::Document::SP& doc = document::Document::SP(), Timestamp lastModified = 0); + ~GetReply(); const document::Document::SP& getDocument() const { return _doc; } const document::DocumentId& getDocumentId() const { return _docId; } @@ -273,6 +278,7 @@ class RemoveCommand : public TestAndSetCommand { public: RemoveCommand(const document::BucketId&, const document::DocumentId& docId, Timestamp timestamp); + ~RemoveCommand(); void setTimestamp(Timestamp ts) { _timestamp = ts; } @@ -302,6 +308,7 @@ class RemoveReply : public BucketInfoReply { public: explicit RemoveReply(const RemoveCommand& cmd, Timestamp oldTimestamp = 0); + ~RemoveReply(); const document::DocumentId& getDocumentId() const { return _docId; } Timestamp getTimestamp() { return _timestamp; }; @@ -329,6 +336,7 @@ class RevertCommand : public BucketInfoCommand { public: RevertCommand(const document::BucketId& bucket, const std::vector<Timestamp>& revertTokens); + ~RevertCommand(); const std::vector<Timestamp>& getRevertTokens() const { return _tokens; } @@ -349,6 +357,7 @@ class RevertReply : public BucketInfoReply { public: explicit RevertReply(const RevertCommand& cmd); + ~RevertReply(); const std::vector<Timestamp>& getRevertTokens() const { return _tokens; } diff --git a/storageframework/src/vespa/storageframework/generic/status/httpurlpath.cpp b/storageframework/src/vespa/storageframework/generic/status/httpurlpath.cpp index 645a745a310..e29c66a8865 100644 --- a/storageframework/src/vespa/storageframework/generic/status/httpurlpath.cpp +++ b/storageframework/src/vespa/storageframework/generic/status/httpurlpath.cpp @@ -24,6 +24,8 @@ HttpUrlPath::HttpUrlPath(const vespalib::string& urlpath, init(); } +HttpUrlPath::~HttpUrlPath() {} + void HttpUrlPath::init() { diff --git a/storageframework/src/vespa/storageframework/generic/status/httpurlpath.h b/storageframework/src/vespa/storageframework/generic/status/httpurlpath.h index a535edb5180..f73fdc752ed 100644 --- a/storageframework/src/vespa/storageframework/generic/status/httpurlpath.h +++ b/storageframework/src/vespa/storageframework/generic/status/httpurlpath.h @@ -26,6 +26,7 @@ class HttpUrlPath : public vespalib::Printable { public: HttpUrlPath(const vespalib::string& urlpath); HttpUrlPath(const vespalib::string& urlpath, const vespalib::string& serverSpec); + ~HttpUrlPath(); const vespalib::string& getPath() const { return _path; } const std::map<vespalib::string, vespalib::string>& getAttributes() const diff --git a/vdslib/src/vespa/vdslib/container/documentsummary.cpp b/vdslib/src/vespa/vdslib/container/documentsummary.cpp index 3c0ff157fc3..fcb687179f0 100644 --- a/vdslib/src/vespa/vdslib/container/documentsummary.cpp +++ b/vdslib/src/vespa/vdslib/container/documentsummary.cpp @@ -20,6 +20,8 @@ DocumentSummary::DocumentSummary(document::ByteBuffer& buf) : deserialize(buf); } +DocumentSummary::~DocumentSummary() {} + void DocumentSummary::deserialize(document::ByteBuffer& buf) { int32_t tmp; diff --git a/vdslib/src/vespa/vdslib/container/documentsummary.h b/vdslib/src/vespa/vdslib/container/documentsummary.h index 2b97a90ae1d..a14082d1ca6 100644 --- a/vdslib/src/vespa/vdslib/container/documentsummary.h +++ b/vdslib/src/vespa/vdslib/container/documentsummary.h @@ -10,6 +10,8 @@ namespace vdslib { class DocumentSummary { public: DocumentSummary(); + ~DocumentSummary(); + /** * Constructs a new message from a byte buffer. diff --git a/vdslib/src/vespa/vdslib/container/searchresult.cpp b/vdslib/src/vespa/vdslib/container/searchresult.cpp index a6c71c3d9e3..7a627a34095 100644 --- a/vdslib/src/vespa/vdslib/container/searchresult.cpp +++ b/vdslib/src/vespa/vdslib/container/searchresult.cpp @@ -50,7 +50,9 @@ BlobContainer::BlobContainer(size_t reserve) : _offsets.push_back(0); } -size_t BlobContainer::BlobContainer::append(const void * v, size_t sz) +BlobContainer::~BlobContainer() {} + +size_t BlobContainer::append(const void * v, size_t sz) { const size_t index(getCount()); _offsets.push_back(_offsets.back() + sz); @@ -113,6 +115,8 @@ SearchResult::SearchResult(document::ByteBuffer & buf) : deserialize(buf); } +SearchResult::~SearchResult() {} + void SearchResult::deserialize(document::ByteBuffer & buf) { int32_t tmp; diff --git a/vdslib/src/vespa/vdslib/container/searchresult.h b/vdslib/src/vespa/vdslib/container/searchresult.h index 7d19c97122a..9cdb85b3c89 100644 --- a/vdslib/src/vespa/vdslib/container/searchresult.h +++ b/vdslib/src/vespa/vdslib/container/searchresult.h @@ -23,6 +23,7 @@ class BlobContainer { public: BlobContainer(size_t reserve=4096); + ~BlobContainer(); size_t append(const void * v, size_t sz); void getBlob(size_t index, const void * & blob, size_t & sz) const; size_t getCount() const { return _offsets.size() - 1; } @@ -50,6 +51,7 @@ public: * @param buf A byte buffer that contains a serialized message. */ SearchResult(document::ByteBuffer & buf); + ~SearchResult(); AggregatorList & getGroupingList() { return _groupingList; } const AggregatorList & getGroupingList() const { return _groupingList; } diff --git a/vdslib/src/vespa/vdslib/state/nodestate.cpp b/vdslib/src/vespa/vdslib/state/nodestate.cpp index 53be2a8da1d..d4fdfb35993 100644 --- a/vdslib/src/vespa/vdslib/state/nodestate.cpp +++ b/vdslib/src/vespa/vdslib/state/nodestate.cpp @@ -17,6 +17,12 @@ LOG_SETUP(".vdslib.nodestate"); namespace storage { namespace lib { +NodeState::NodeState(const NodeState &) = default; +NodeState & NodeState::operator = (const NodeState &) = default; +NodeState::NodeState(NodeState &&) = default; +NodeState & NodeState::operator = (NodeState &&) = default; +NodeState::~NodeState() { } + NodeState::NodeState() : _type(0), _state(0), diff --git a/vdslib/src/vespa/vdslib/state/nodestate.h b/vdslib/src/vespa/vdslib/state/nodestate.h index e9b7de56851..275e8d5658c 100644 --- a/vdslib/src/vespa/vdslib/state/nodestate.h +++ b/vdslib/src/vespa/vdslib/state/nodestate.h @@ -43,12 +43,16 @@ public: static double getListingBucketsInitProgressLimit() { return 0.01; } NodeState(); + NodeState(const NodeState &); + NodeState & operator = (const NodeState &); + NodeState(NodeState &&); + NodeState & operator = (NodeState &&); NodeState(const NodeType& nodeType, const State&, const vespalib::stringref & description = "", double capacity = 1.0, uint16_t reliability = 1); /** Set type if you want to verify that content fit with the given type. */ NodeState(const vespalib::stringref & serialized, const NodeType* nodeType = 0); - virtual ~NodeState() {} + ~NodeState(); /** * Setting prefix to something implies using this function to write a diff --git a/vespalib/src/tests/delegatelist/delegatelist.cpp b/vespalib/src/tests/delegatelist/delegatelist.cpp index 2efb08e22df..475d4e24551 100644 --- a/vespalib/src/tests/delegatelist/delegatelist.cpp +++ b/vespalib/src/tests/delegatelist/delegatelist.cpp @@ -213,17 +213,21 @@ private: void doneOp(const Command &cmd); int perform(int cnt, int start, const CmdList &cmdList); public: - Actor(int id, History *hist) - : _id(id), _hist(hist), _queue(), _cond(), _state(STATE_INIT), - _waitCnt(0), _opCnt(0), _exit(false) {} + Actor(int id, History *hist); + ~Actor(); int getOpCnt() const { return _opCnt; } int getState() const { return _state; } void doIt(const CmdList &cmdList); void doIt(const Command &cmd); void waitState(int state); - void Run(FastOS_ThreadInterface *, void *); + void Run(FastOS_ThreadInterface *, void *) override; }; +Actor::Actor(int id, History *hist) + : _id(id), _hist(hist), _queue(), _cond(), _state(STATE_INIT), + _waitCnt(0), _opCnt(0), _exit(false) +{} +Actor::~Actor() {} void Actor::setState(int state, MonitorGuard &guard) { diff --git a/vespalib/src/tests/dotproduct/dotproductbenchmark.cpp b/vespalib/src/tests/dotproduct/dotproductbenchmark.cpp index 9ef3d959f3b..b04aa802098 100644 --- a/vespalib/src/tests/dotproduct/dotproductbenchmark.cpp +++ b/vespalib/src/tests/dotproduct/dotproductbenchmark.cpp @@ -28,20 +28,8 @@ template <typename T> class FullBenchmark : public Benchmark { public: - FullBenchmark(size_t numDocs, size_t numValues) : - _values(numDocs*numValues), - _query(numValues), - _dp(IAccelrated::getAccelrator()) - { - for (size_t i(0); i < numDocs; i++) { - for (size_t j(0); j < numValues; j++) { - _values[i*numValues + j] = j; - } - } - for (size_t j(0); j < numValues; j++) { - _query[j] = j; - } - } + FullBenchmark(size_t numDocs, size_t numValue); + ~FullBenchmark(); virtual void compute(size_t docId) const { _dp->dotProduct(&_query[0], &_values[docId * _query.size()], _query.size()); } @@ -51,20 +39,30 @@ private: IAccelrated::UP _dp; }; -class SparseBenchmark : public Benchmark +template <typename T> +FullBenchmark<T>::FullBenchmark(size_t numDocs, size_t numValues) + : _values(numDocs*numValues), + _query(numValues), + _dp(IAccelrated::getAccelrator()) { -public: - SparseBenchmark(size_t numDocs, size_t numValues, size_t numQueryValues) : - _numValues(numValues), - _values(numDocs*numValues) - { - for (size_t i(0); i < numDocs; i++) { - for (size_t j(0); j < numValues; j++) { - size_t k(numValues < numQueryValues ? (j*numQueryValues)/numValues : j); - _values[i*numValues + j] = P(k, k); - } + for (size_t i(0); i < numDocs; i++) { + for (size_t j(0); j < numValues; j++) { + _values[i*numValues + j] = j; } } + for (size_t j(0); j < numValues; j++) { + _query[j] = j; + } +} + +template <typename T> +FullBenchmark<T>::~FullBenchmark() { } + +class SparseBenchmark : public Benchmark +{ +public: + SparseBenchmark(size_t numDocs, size_t numValues, size_t numQueryValues); + ~SparseBenchmark(); protected: struct P { P(uint32_t key=0, int32_t value=0) : @@ -78,18 +76,26 @@ protected: std::vector<P> _values; }; +SparseBenchmark::SparseBenchmark(size_t numDocs, size_t numValues, size_t numQueryValues) + : _numValues(numValues), + _values(numDocs*numValues) +{ + for (size_t i(0); i < numDocs; i++) { + for (size_t j(0); j < numValues; j++) { + size_t k(numValues < numQueryValues ? (j*numQueryValues)/numValues : j); + _values[i*numValues + j] = P(k, k); + } + } +} +SparseBenchmark::~SparseBenchmark() { } + class UnorderedSparseBenchmark : public SparseBenchmark { private: typedef hash_map<uint32_t, int32_t> map; public: - UnorderedSparseBenchmark(size_t numDocs, size_t numValues, size_t numQueryValues) : - SparseBenchmark(numDocs, numValues, numQueryValues) - { - for (size_t j(0); j < numQueryValues; j++) { - _query[j] = j; - } - } + UnorderedSparseBenchmark(size_t numDocs, size_t numValues, size_t numQueryValues); + ~UnorderedSparseBenchmark(); private: virtual void compute(size_t docId) const { int64_t sum(0); @@ -105,19 +111,21 @@ private: map _query; }; +UnorderedSparseBenchmark::UnorderedSparseBenchmark(size_t numDocs, size_t numValues, size_t numQueryValues) + : SparseBenchmark(numDocs, numValues, numQueryValues) +{ + for (size_t j(0); j < numQueryValues; j++) { + _query[j] = j; + } +} +UnorderedSparseBenchmark::~UnorderedSparseBenchmark() {} + class OrderedSparseBenchmark : public SparseBenchmark { private: public: - OrderedSparseBenchmark(size_t numDocs, size_t numValues, size_t numQueryValues) : - SparseBenchmark(numDocs, numValues, numQueryValues), - _query(numQueryValues) - { - for (size_t j(0); j < numQueryValues; j++) { - size_t k(numValues > numQueryValues ? j*numValues/numQueryValues : j); - _query[j] = P(k, k); - } - } + OrderedSparseBenchmark(size_t numDocs, size_t numValues, size_t numQueryValues); + ~OrderedSparseBenchmark(); private: virtual void compute(size_t docId) const { int64_t sum(0); @@ -133,6 +141,17 @@ private: std::vector<P> _query; }; +OrderedSparseBenchmark::OrderedSparseBenchmark(size_t numDocs, size_t numValues, size_t numQueryValues) + : SparseBenchmark(numDocs, numValues, numQueryValues), + _query(numQueryValues) +{ + for (size_t j(0); j < numQueryValues; j++) { + size_t k(numValues > numQueryValues ? j*numValues/numQueryValues : j); + _query[j] = P(k, k); + } +} +OrderedSparseBenchmark::~OrderedSparseBenchmark() { } + int main(int argc, char *argv[]) { size_t numDocs(1); diff --git a/vespalib/src/tests/dual_merge_director/dual_merge_director_test.cpp b/vespalib/src/tests/dual_merge_director/dual_merge_director_test.cpp index 72fd17e76d5..b6621a75b84 100644 --- a/vespalib/src/tests/dual_merge_director/dual_merge_director_test.cpp +++ b/vespalib/src/tests/dual_merge_director/dual_merge_director_test.cpp @@ -10,16 +10,8 @@ struct MySource : public DualMergeDirector::Source { std::string data; std::string diff; - MySource(bool a, size_t num_sources, size_t source_id) - : typeA(a), - data(num_sources, '0'), - diff(num_sources, '5') - { - if (source_id < num_sources) { - data[source_id] = '1'; - diff[source_id] = '6'; - } - } + MySource(bool a, size_t num_sources, size_t source_id); + ~MySource(); virtual void merge(Source &mt) { MySource &rhs = static_cast<MySource&>(mt); ASSERT_EQUAL(typeA, rhs.typeA); @@ -40,6 +32,18 @@ struct MySource : public DualMergeDirector::Source { } }; +MySource::MySource(bool a, size_t num_sources, size_t source_id) + : typeA(a), + data(num_sources, '0'), + diff(num_sources, '5') +{ + if (source_id < num_sources) { + data[source_id] = '1'; + diff[source_id] = '6'; + } +} +MySource::~MySource() {} + TEST_MT_F("require that merging works", 64, std::unique_ptr<DualMergeDirector>()) { for (size_t use_threads = 1; use_threads <= num_threads; ++use_threads) { MySource sourceA(true, use_threads, thread_id); diff --git a/vespalib/src/tests/left_right_heap/left_right_heap_bench.cpp b/vespalib/src/tests/left_right_heap/left_right_heap_bench.cpp index 114786bf2eb..5699adfb760 100644 --- a/vespalib/src/tests/left_right_heap/left_right_heap_bench.cpp +++ b/vespalib/src/tests/left_right_heap/left_right_heap_bench.cpp @@ -74,26 +74,32 @@ struct Data32p { size_t size; std::vector<uint32_t> values; std::vector<uint16_t> data; - Data32p(size_t s) : cmp(0), size(s), values(), data() {} + Data32p(size_t s); + ~Data32p(); static const char *name() { return "uint32_t[uint16_t]"; } - void init(bool inv) { - values.resize(size); - data.resize(size); - srandom(42); - for (size_t i = 0; i < size; ++i) { - if (inv) { - values[size - i - 1] = random(); - data[size - i - 1] = (size - i - 1); - } else { - values[i] = random(); - data[i] = i; - } + void init(bool inv); +}; + +Data32p::Data32p(size_t s) : cmp(0), size(s), values(), data() {} +Data32p::~Data32p() {} +void +Data32p::init(bool inv) { + values.resize(size); + data.resize(size); + srandom(42); + for (size_t i = 0; i < size; ++i) { + if (inv) { + values[size - i - 1] = random(); + data[size - i - 1] = (size - i - 1); + } else { + values[i] = random(); + data[i] = i; } - ASSERT_EQUAL(size, values.size()); - ASSERT_EQUAL(size, data.size()); - cmp = MyCmp(&values[0]); } -}; + ASSERT_EQUAL(size, values.size()); + ASSERT_EQUAL(size, data.size()); + cmp = MyCmp(&values[0]); +} template <typename T, typename C> bool verifyOrder(T *begin, T *end, const C &cmp, bool inv) { diff --git a/vespalib/src/vespa/vespalib/component/versionspecification.cpp b/vespalib/src/vespa/vespalib/component/versionspecification.cpp index e54550a7fc8..71137835187 100644 --- a/vespalib/src/vespa/vespalib/component/versionspecification.cpp +++ b/vespalib/src/vespa/vespalib/component/versionspecification.cpp @@ -20,6 +20,8 @@ VersionSpecification::VersionSpecification(int major, int minor, int micro, cons initialize(); } +VersionSpecification::VersionSpecification(const VersionSpecification &) = default; + VersionSpecification::~VersionSpecification() { } void diff --git a/vespalib/src/vespa/vespalib/component/versionspecification.h b/vespalib/src/vespa/vespalib/component/versionspecification.h index 547b140c701..a0052b46b4f 100644 --- a/vespalib/src/vespa/vespalib/component/versionspecification.h +++ b/vespalib/src/vespa/vespalib/component/versionspecification.h @@ -67,6 +67,7 @@ public: VersionSpecification(int major = UNSPECIFIED, int minor = UNSPECIFIED, int micro = UNSPECIFIED, const string & qualifier = ""); + VersionSpecification(const VersionSpecification &); ~VersionSpecification(); /** diff --git a/vespalib/src/vespa/vespalib/data/writable_memory.h b/vespalib/src/vespa/vespalib/data/writable_memory.h index fdcc8e07803..73bbff9dec7 100644 --- a/vespalib/src/vespa/vespalib/data/writable_memory.h +++ b/vespalib/src/vespa/vespalib/data/writable_memory.h @@ -2,6 +2,8 @@ #pragma once +#include <cstddef> + namespace vespalib { /** |