diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-10-18 20:07:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-18 20:07:24 +0200 |
commit | 618c83762420e2824f5dfa5011755ef8485be07a (patch) | |
tree | b783671e9bed035a7f9e1de4e6693b008e82bc26 | |
parent | f92740d98dda25445011fcc7f974d7a881d44683 (diff) | |
parent | c66fa90a083501cb3a736de5e545413a68e47ae8 (diff) |
Merge pull request #24493 from vespa-engine/balder/deinline-iflushtarget-destructor
Balder/deinline iflushtarget destructor
4 files changed, 42 insertions, 31 deletions
diff --git a/searchcore/src/tests/proton/metrics/documentdb_job_trackers/documentdb_job_trackers_test.cpp b/searchcore/src/tests/proton/metrics/documentdb_job_trackers/documentdb_job_trackers_test.cpp index c2937b3fcce..e5aa17f10a9 100644 --- a/searchcore/src/tests/proton/metrics/documentdb_job_trackers/documentdb_job_trackers_test.cpp +++ b/searchcore/src/tests/proton/metrics/documentdb_job_trackers/documentdb_job_trackers_test.cpp @@ -19,16 +19,16 @@ typedef IFlushTarget::Component FTC; struct MFT : public test::DummyFlushTarget { - MFT(FTT type, FTC component) : test::DummyFlushTarget("", type, component) {} + MFT(FTT type, FTC component) noexcept : test::DummyFlushTarget("", type, component) {} }; -struct AttributeFlush : public MFT { AttributeFlush() : MFT(FTT::SYNC, FTC::ATTRIBUTE) {} }; -struct AttributeShrink : public MFT { AttributeShrink() : MFT(FTT::GC, FTC::ATTRIBUTE) {} }; -struct MemoryIndexFlush : public MFT { MemoryIndexFlush() : MFT(FTT::FLUSH, FTC::INDEX) {} }; -struct DiskIndexFusion : public MFT { DiskIndexFusion() : MFT(FTT::GC, FTC::INDEX) {} }; -struct DocStoreFlush : public MFT { DocStoreFlush() : MFT(FTT::SYNC, FTC::DOCUMENT_STORE) {} }; -struct DocStoreCompaction : public MFT { DocStoreCompaction() : MFT(FTT::GC, FTC::DOCUMENT_STORE) {} }; -struct OtherFlush : public MFT { OtherFlush() : MFT(FTT::FLUSH, FTC::OTHER) {} }; +struct AttributeFlush : public MFT { AttributeFlush() noexcept : MFT(FTT::SYNC, FTC::ATTRIBUTE) {} }; +struct AttributeShrink : public MFT { AttributeShrink() noexcept : MFT(FTT::GC, FTC::ATTRIBUTE) {} }; +struct MemoryIndexFlush : public MFT { MemoryIndexFlush() noexcept : MFT(FTT::FLUSH, FTC::INDEX) {} }; +struct DiskIndexFusion : public MFT { DiskIndexFusion() noexcept : MFT(FTT::GC, FTC::INDEX) {} }; +struct DocStoreFlush : public MFT { DocStoreFlush() noexcept : MFT(FTT::SYNC, FTC::DOCUMENT_STORE) {} }; +struct DocStoreCompaction : public MFT { DocStoreCompaction() noexcept : MFT(FTT::GC, FTC::DOCUMENT_STORE) {} }; +struct OtherFlush : public MFT { OtherFlush() noexcept : MFT(FTT::FLUSH, FTC::OTHER) {} }; struct Fixture { @@ -80,8 +80,7 @@ TEST_F("require that job metrics are updated", Fixture) bool assertFlushTarget(const IJobTracker &tracker, const IFlushTarget &target) { - const JobTrackedFlushTarget *tracked = - dynamic_cast<const JobTrackedFlushTarget *>(&target); + const auto *tracked = dynamic_cast<const JobTrackedFlushTarget *>(&target); if (!EXPECT_TRUE(tracked != nullptr)) return false; if (!EXPECT_EQUAL(&tracker, &tracked->getTracker())) return false; return true; @@ -90,12 +89,12 @@ assertFlushTarget(const IJobTracker &tracker, const IFlushTarget &target) TEST_F("require that known flush targets are tracked", Fixture) { IFlushTarget::List input; - input.push_back(IFlushTarget::SP(new AttributeFlush())); - input.push_back(IFlushTarget::SP(new MemoryIndexFlush())); - input.push_back(IFlushTarget::SP(new DiskIndexFusion())); - input.push_back(IFlushTarget::SP(new DocStoreFlush())); - input.push_back(IFlushTarget::SP(new DocStoreCompaction())); - input.push_back(IFlushTarget::SP(new AttributeShrink())); + input.emplace_back(std::make_shared<AttributeFlush>()); + input.emplace_back(std::make_shared<MemoryIndexFlush>()); + input.emplace_back(std::make_shared<DiskIndexFusion>()); + input.emplace_back(std::make_shared<DocStoreFlush>()); + input.emplace_back(std::make_shared<DocStoreCompaction>()); + input.emplace_back(std::make_shared<AttributeShrink>()); IFlushTarget::List output = f._trackers.trackFlushTargets(input); EXPECT_EQUAL(6u, output.size()); @@ -110,7 +109,7 @@ TEST_F("require that known flush targets are tracked", Fixture) TEST_F("require that un-known flush targets are not tracked", Fixture) { IFlushTarget::List input; - input.push_back(IFlushTarget::SP(new OtherFlush())); + input.emplace_back(std::make_shared<OtherFlush>()); IFlushTarget::List output = f._trackers.trackFlushTargets(input); EXPECT_EQUAL(1u, output.size()); diff --git a/searchcore/src/vespa/searchcorespi/flush/CMakeLists.txt b/searchcore/src/vespa/searchcorespi/flush/CMakeLists.txt index b2777d4327a..f4c28cf4c5d 100644 --- a/searchcore/src/vespa/searchcorespi/flush/CMakeLists.txt +++ b/searchcore/src/vespa/searchcorespi/flush/CMakeLists.txt @@ -2,5 +2,6 @@ vespa_add_library(searchcorespi_flush STATIC OBJECT SOURCES flushstats.cpp + iflushtarget.cpp DEPENDS ) diff --git a/searchcore/src/vespa/searchcorespi/flush/iflushtarget.cpp b/searchcore/src/vespa/searchcorespi/flush/iflushtarget.cpp new file mode 100644 index 00000000000..d821e06a2a3 --- /dev/null +++ b/searchcore/src/vespa/searchcorespi/flush/iflushtarget.cpp @@ -0,0 +1,19 @@ +// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#include "iflushtarget.h" + +namespace searchcorespi { + +IFlushTarget::IFlushTarget(const vespalib::string &name) noexcept + : IFlushTarget(name, Type::OTHER, Component::OTHER) +{ } + +IFlushTarget::IFlushTarget(const vespalib::string &name, const Type &type, const Component &component) noexcept + : _name(name), + _type(type), + _component(component) +{ } + +IFlushTarget::~IFlushTarget() = default; + +} diff --git a/searchcore/src/vespa/searchcorespi/flush/iflushtarget.h b/searchcore/src/vespa/searchcorespi/flush/iflushtarget.h index dff6041d7d5..e3ddf98ce9f 100644 --- a/searchcore/src/vespa/searchcorespi/flush/iflushtarget.h +++ b/searchcore/src/vespa/searchcorespi/flush/iflushtarget.h @@ -67,20 +67,16 @@ public: /** * Convenience typedefs. */ - typedef std::shared_ptr<IFlushTarget> SP; - typedef std::vector<SP> List; - typedef FlushTask Task; + using SP = std::shared_ptr<IFlushTarget>; + using List = std::vector<SP>; + using Task = FlushTask; /** * Constructs a new instance of this class. * * @param name The handler-wide unique name of this target. */ - IFlushTarget(const vespalib::string &name) noexcept - : _name(name), - _type(Type::OTHER), - _component(Component::OTHER) - { } + IFlushTarget(const vespalib::string &name) noexcept; /** * Constructs a new instance of this class. @@ -91,16 +87,12 @@ public: */ IFlushTarget(const vespalib::string &name, const Type &type, - const Component &component) noexcept - : _name(name), - _type(type), - _component(component) - { } + const Component &component) noexcept; /** * Virtual destructor required for inheritance. */ - virtual ~IFlushTarget() = default; + virtual ~IFlushTarget(); /** * Returns the handler-wide unique name of this target. |