aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2023-05-04 18:07:21 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2023-05-04 18:07:21 +0000
commitd52a157beb169c73ddf594e9aa18c698acf37634 (patch)
treea71f33eeeb36994b6c8b25a750f802593b408f44 /searchcore
parent3f232b813f472aabcfff27e2a4540de86d08971e (diff)
- Introduce a LeafFlushTarget that all target not proxying should inherit from, and let the IFlushTarget have pure virtual methods.
- Fix wiring for get_replay_operation_cost through the proxy classes.
Diffstat (limited to 'searchcore')
-rw-r--r--searchcore/src/tests/proton/index/indexmanager_test.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.h18
-rw-r--r--searchcore/src/vespa/searchcore/proton/docsummary/summarycompacttarget.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/docsummary/summarycompacttarget.h2
-rw-r--r--searchcore/src/vespa/searchcore/proton/docsummary/summaryflushtarget.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/docsummary/summaryflushtarget.h2
-rw-r--r--searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.h20
-rw-r--r--searchcore/src/vespa/searchcore/proton/flushengine/cachedflushtarget.cpp8
-rw-r--r--searchcore/src/vespa/searchcore/proton/flushengine/cachedflushtarget.h4
-rw-r--r--searchcore/src/vespa/searchcore/proton/flushengine/flushtargetproxy.h1
-rw-r--r--searchcore/src/vespa/searchcore/proton/flushengine/shrink_lid_space_flush_target.cpp9
-rw-r--r--searchcore/src/vespa/searchcore/proton/flushengine/shrink_lid_space_flush_target.h3
-rw-r--r--searchcore/src/vespa/searchcore/proton/metrics/job_tracked_flush_target.cpp6
-rw-r--r--searchcore/src/vespa/searchcore/proton/metrics/job_tracked_flush_target.h10
-rw-r--r--searchcore/src/vespa/searchcore/proton/test/dummy_flush_target.cpp4
-rw-r--r--searchcore/src/vespa/searchcore/proton/test/dummy_flush_target.h3
-rw-r--r--searchcore/src/vespa/searchcorespi/flush/iflushtarget.cpp4
-rw-r--r--searchcore/src/vespa/searchcorespi/flush/iflushtarget.h18
-rw-r--r--searchcore/src/vespa/searchcorespi/index/indexflushtarget.cpp2
-rw-r--r--searchcore/src/vespa/searchcorespi/index/indexflushtarget.h2
-rw-r--r--searchcore/src/vespa/searchcorespi/index/indexfusiontarget.cpp2
-rw-r--r--searchcore/src/vespa/searchcorespi/index/indexfusiontarget.h2
25 files changed, 69 insertions, 65 deletions
diff --git a/searchcore/src/tests/proton/index/indexmanager_test.cpp b/searchcore/src/tests/proton/index/indexmanager_test.cpp
index 880bf8aa3e0..2f6ebcd967f 100644
--- a/searchcore/src/tests/proton/index/indexmanager_test.cpp
+++ b/searchcore/src/tests/proton/index/indexmanager_test.cpp
@@ -344,6 +344,10 @@ TEST_F(IndexManagerTest, require_that_large_memory_footprint_triggers_urgent_flu
EXPECT_TRUE(IndexFlushTarget(_index_manager->getMaintainer(), FlushStats(17_Gi)).needUrgentFlush());
}
+TEST_F(IndexManagerTest, require_that_flush_priority_is_high) {
+ EXPECT_EQ(IFlushTarget::Priority::HIGH, IndexFlushTarget(_index_manager->getMaintainer()).getPriority());
+}
+
TEST_F(IndexManagerTest, require_that_multiple_flushes_gives_multiple_indexes)
{
size_t flush_count = 10;
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.cpp b/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.cpp
index 8101b29d98c..401cc42de52 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.cpp
+++ b/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.cpp
@@ -155,7 +155,7 @@ FlushableAttribute::FlushableAttribute(AttributeVectorSP attr,
vespalib::ISequencedTaskExecutor &
attributeFieldWriter,
const HwInfo &hwInfo)
- : IFlushTarget(make_string("attribute.flush.%s", attr->getName().c_str()), Type::SYNC, Component::ATTRIBUTE),
+ : LeafFlushTarget(make_string("attribute.flush.%s", attr->getName().c_str()), Type::SYNC, Component::ATTRIBUTE),
_attr(attr),
_cleanUpAfterFlush(true),
_lastStats(),
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.h b/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.h
index 2ae63bef4db..56dd0e0dfec 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.h
+++ b/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.h
@@ -19,7 +19,7 @@ class TransientResourceUsage;
/**
* Implementation of IFlushTarget interface for attribute vectors.
*/
-class FlushableAttribute : public searchcorespi::IFlushTarget
+class FlushableAttribute : public searchcorespi::LeafFlushTarget
{
private:
/**
@@ -29,15 +29,15 @@ private:
using AttributeVectorSP = std::shared_ptr<search::AttributeVector>;
using FlushStats = searchcorespi::FlushStats;
- AttributeVectorSP _attr;
- bool _cleanUpAfterFlush;
- FlushStats _lastStats;
- const search::TuneFileAttributes _tuneFileAttributes;
+ AttributeVectorSP _attr;
+ bool _cleanUpAfterFlush;
+ FlushStats _lastStats;
+ const search::TuneFileAttributes _tuneFileAttributes;
const search::common::FileHeaderContext &_fileHeaderContext;
- vespalib::ISequencedTaskExecutor &_attributeFieldWriter;
- HwInfo _hwInfo;
- std::shared_ptr<AttributeDirectory> _attrDir;
- double _replay_operation_cost;
+ vespalib::ISequencedTaskExecutor &_attributeFieldWriter;
+ HwInfo _hwInfo;
+ std::shared_ptr<AttributeDirectory> _attrDir;
+ double _replay_operation_cost;
Task::UP internalInitFlush(SerialNum currentSerial);
diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/summarycompacttarget.cpp b/searchcore/src/vespa/searchcore/proton/docsummary/summarycompacttarget.cpp
index 06bf8d0a8a6..57435c91b5f 100644
--- a/searchcore/src/vespa/searchcore/proton/docsummary/summarycompacttarget.cpp
+++ b/searchcore/src/vespa/searchcore/proton/docsummary/summarycompacttarget.cpp
@@ -66,7 +66,7 @@ private:
}
SummaryGCTarget::SummaryGCTarget(const vespalib::string & name, vespalib::Executor & summaryService, IDocumentStore & docStore)
- : IFlushTarget(name, Type::GC, Component::DOCUMENT_STORE),
+ : LeafFlushTarget(name, Type::GC, Component::DOCUMENT_STORE),
_summaryService(summaryService),
_docStore(docStore),
_lastStats()
diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/summarycompacttarget.h b/searchcore/src/vespa/searchcore/proton/docsummary/summarycompacttarget.h
index 083f763d8e6..56e17d76210 100644
--- a/searchcore/src/vespa/searchcore/proton/docsummary/summarycompacttarget.h
+++ b/searchcore/src/vespa/searchcore/proton/docsummary/summarycompacttarget.h
@@ -12,7 +12,7 @@ namespace proton {
/**
* This class implements the IFlushTarget interface to proxy a summary manager.
*/
-class SummaryGCTarget : public searchcorespi::IFlushTarget {
+class SummaryGCTarget : public searchcorespi::LeafFlushTarget {
public:
using FlushStats = searchcorespi::FlushStats;
using IDocumentStore = search::IDocumentStore;
diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/summaryflushtarget.cpp b/searchcore/src/vespa/searchcore/proton/docsummary/summaryflushtarget.cpp
index 45fc23175bf..5cb60c907f1 100644
--- a/searchcore/src/vespa/searchcore/proton/docsummary/summaryflushtarget.cpp
+++ b/searchcore/src/vespa/searchcore/proton/docsummary/summaryflushtarget.cpp
@@ -43,7 +43,7 @@ public:
SummaryFlushTarget::SummaryFlushTarget(IDocumentStore & docStore,
vespalib::Executor & summaryService)
- : IFlushTarget("summary.flush", Type::SYNC, Component::DOCUMENT_STORE),
+ : LeafFlushTarget("summary.flush", Type::SYNC, Component::DOCUMENT_STORE),
_docStore(docStore),
_summaryService(summaryService),
_lastStats()
diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/summaryflushtarget.h b/searchcore/src/vespa/searchcore/proton/docsummary/summaryflushtarget.h
index f864b922af8..1ac7b6c9c0e 100644
--- a/searchcore/src/vespa/searchcore/proton/docsummary/summaryflushtarget.h
+++ b/searchcore/src/vespa/searchcore/proton/docsummary/summaryflushtarget.h
@@ -9,7 +9,7 @@ namespace proton {
/**
* This class implements the IFlushTarget interface to proxy a summary manager.
*/
-class SummaryFlushTarget : public searchcorespi::IFlushTarget {
+class SummaryFlushTarget : public searchcorespi::LeafFlushTarget {
private:
using FlushStats = searchcorespi::FlushStats;
search::IDocumentStore & _docStore;
diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.cpp b/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.cpp
index 543af05db45..d1e39628c83 100644
--- a/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.cpp
+++ b/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.cpp
@@ -42,7 +42,7 @@ namespace proton {
namespace {
-class ShrinkSummaryLidSpaceFlushTarget : public ShrinkLidSpaceFlushTarget
+class ShrinkSummaryLidSpaceFlushTarget : public ShrinkLidSpaceFlushTarget
{
using ICompactableLidSpace = search::common::ICompactableLidSpace;
vespalib::Executor & _summaryService;
diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.cpp b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.cpp
index a712035e9af..db3d8adfe26 100644
--- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.cpp
+++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.cpp
@@ -150,7 +150,7 @@ DocumentMetaStoreFlushTarget::
DocumentMetaStoreFlushTarget(const DocumentMetaStore::SP dms, ITlsSyncer &tlsSyncer,
const vespalib::string & baseDir, const TuneFileAttributes &tuneFileAttributes,
const FileHeaderContext &fileHeaderContext, const HwInfo &hwInfo)
- : IFlushTarget("documentmetastore.flush", Type::SYNC, Component::ATTRIBUTE),
+ : LeafFlushTarget("documentmetastore.flush", Type::SYNC, Component::ATTRIBUTE),
_dms(dms),
_tlsSyncer(tlsSyncer),
_baseDir(baseDir),
diff --git a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.h b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.h
index 777d7de1e17..5a3a671553c 100644
--- a/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.h
+++ b/searchcore/src/vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.h
@@ -19,7 +19,7 @@ class TransientResourceUsage;
/**
* Implementation of IFlushTarget interface for document meta store.
**/
-class DocumentMetaStoreFlushTarget : public searchcorespi::IFlushTarget
+class DocumentMetaStoreFlushTarget : public searchcorespi::LeafFlushTarget
{
private:
/**
@@ -29,16 +29,16 @@ private:
using DocumentMetaStoreSP = std::shared_ptr<DocumentMetaStore>;
using FlushStats = searchcorespi::FlushStats;
- DocumentMetaStoreSP _dms;
- ITlsSyncer &_tlsSyncer;
- vespalib::string _baseDir;
- bool _cleanUpAfterFlush;
- FlushStats _lastStats;
- const search::TuneFileAttributes _tuneFileAttributes;
+ DocumentMetaStoreSP _dms;
+ ITlsSyncer &_tlsSyncer;
+ vespalib::string _baseDir;
+ bool _cleanUpAfterFlush;
+ FlushStats _lastStats;
+ const search::TuneFileAttributes _tuneFileAttributes;
const search::common::FileHeaderContext &_fileHeaderContext;
- HwInfo _hwInfo;
- std::shared_ptr<AttributeDiskLayout> _diskLayout;
- std::shared_ptr<AttributeDirectory> _dmsDir;
+ HwInfo _hwInfo;
+ std::shared_ptr<AttributeDiskLayout> _diskLayout;
+ std::shared_ptr<AttributeDirectory> _dmsDir;
public:
using SP = std::shared_ptr<DocumentMetaStoreFlushTarget>;
diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/cachedflushtarget.cpp b/searchcore/src/vespa/searchcore/proton/flushengine/cachedflushtarget.cpp
index 86a9d6cb0df..9f212006234 100644
--- a/searchcore/src/vespa/searchcore/proton/flushengine/cachedflushtarget.cpp
+++ b/searchcore/src/vespa/searchcore/proton/flushengine/cachedflushtarget.cpp
@@ -12,15 +12,9 @@ CachedFlushTarget::CachedFlushTarget(const IFlushTarget::SP &target)
_memoryGain(target->getApproxMemoryGain()),
_diskGain(target->getApproxDiskGain()),
_approxBytesToWriteToDisk(target->getApproxBytesToWriteToDisk()),
+ _replay_operation_cost(target->get_replay_operation_cost()),
_needUrgentFlush(target->needUrgentFlush()),
_priority(target->getPriority())
{ }
-
-uint64_t
-CachedFlushTarget::getApproxBytesToWriteToDisk() const
-{
- return _approxBytesToWriteToDisk;
-}
-
} // namespace proton
diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/cachedflushtarget.h b/searchcore/src/vespa/searchcore/proton/flushengine/cachedflushtarget.h
index 222cab6ae41..a43c7c16217 100644
--- a/searchcore/src/vespa/searchcore/proton/flushengine/cachedflushtarget.h
+++ b/searchcore/src/vespa/searchcore/proton/flushengine/cachedflushtarget.h
@@ -20,6 +20,7 @@ private:
MemoryGain _memoryGain;
DiskGain _diskGain;
uint64_t _approxBytesToWriteToDisk;
+ double _replay_operation_cost;
bool _needUrgentFlush;
Priority _priority;
@@ -49,13 +50,14 @@ public:
Time getLastFlushTime() const override { return _lastFlushTime; }
bool needUrgentFlush() const override { return _needUrgentFlush; }
Priority getPriority() const override { return _priority; }
+ double get_replay_operation_cost() const override { return _replay_operation_cost; }
Task::UP initFlush(SerialNum currentSerial, std::shared_ptr<search::IFlushToken> flush_token) override {
return _target->initFlush(currentSerial, std::move(flush_token));
}
FlushStats getLastFlushStats() const override { return _target->getLastFlushStats(); }
- uint64_t getApproxBytesToWriteToDisk() const override;
+ uint64_t getApproxBytesToWriteToDisk() const override { return _approxBytesToWriteToDisk; }
};
} // namespace proton
diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/flushtargetproxy.h b/searchcore/src/vespa/searchcore/proton/flushengine/flushtargetproxy.h
index 79a217e1f05..e2ac832e023 100644
--- a/searchcore/src/vespa/searchcore/proton/flushengine/flushtargetproxy.h
+++ b/searchcore/src/vespa/searchcore/proton/flushengine/flushtargetproxy.h
@@ -49,6 +49,7 @@ public:
Priority getPriority() const override { return _target->getPriority(); }
uint64_t getApproxBytesToWriteToDisk() const override { return _target->getApproxBytesToWriteToDisk(); }
searchcorespi::FlushStats getLastFlushStats() const override { return _target->getLastFlushStats(); }
+ double get_replay_operation_cost() const override { return _target->get_replay_operation_cost(); }
Task::UP initFlush(SerialNum currentSerial, std::shared_ptr<search::IFlushToken> flush_token) override;
};
diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/shrink_lid_space_flush_target.cpp b/searchcore/src/vespa/searchcore/proton/flushengine/shrink_lid_space_flush_target.cpp
index b824f2a7c88..d292f8347a7 100644
--- a/searchcore/src/vespa/searchcore/proton/flushengine/shrink_lid_space_flush_target.cpp
+++ b/searchcore/src/vespa/searchcore/proton/flushengine/shrink_lid_space_flush_target.cpp
@@ -6,6 +6,7 @@
namespace proton {
using searchcorespi::IFlushTarget;
+using searchcorespi::LeafFlushTarget;
using searchcorespi::FlushStats;
using searchcorespi::FlushTask;
@@ -46,7 +47,7 @@ ShrinkLidSpaceFlushTarget::ShrinkLidSpaceFlushTarget(const vespalib::string &nam
SerialNum flushedSerialNum,
Time lastFlushTime,
std::shared_ptr<ICompactableLidSpace> target)
- : IFlushTarget(name, type, component),
+ : LeafFlushTarget(name, type, component),
_target(std::move(target)),
_flushedSerialNum(flushedSerialNum),
@@ -80,12 +81,6 @@ ShrinkLidSpaceFlushTarget::getLastFlushTime() const
return _lastFlushTime;
}
-bool
-ShrinkLidSpaceFlushTarget::needUrgentFlush() const
-{
- return false;
-}
-
IFlushTarget::Task::UP
ShrinkLidSpaceFlushTarget::initFlush(SerialNum currentSerial, std::shared_ptr<search::IFlushToken>)
{
diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/shrink_lid_space_flush_target.h b/searchcore/src/vespa/searchcore/proton/flushengine/shrink_lid_space_flush_target.h
index e3efbd9b273..13f221e40a7 100644
--- a/searchcore/src/vespa/searchcore/proton/flushengine/shrink_lid_space_flush_target.h
+++ b/searchcore/src/vespa/searchcore/proton/flushengine/shrink_lid_space_flush_target.h
@@ -11,7 +11,7 @@ namespace proton {
/**
* Implements a flush target that shrinks lid space in target.
*/
-class ShrinkLidSpaceFlushTarget : public searchcorespi::IFlushTarget
+class ShrinkLidSpaceFlushTarget : public searchcorespi::LeafFlushTarget
{
/**
* Task representing that shrinking has been performed.
@@ -46,7 +46,6 @@ public:
DiskGain getApproxDiskGain() const override;
SerialNum getFlushedSerialNum() const override;
Time getLastFlushTime() const override;
- bool needUrgentFlush() const override;
Task::UP initFlush(SerialNum currentSerial, std::shared_ptr<search::IFlushToken> flush_token) override;
searchcorespi::FlushStats getLastFlushStats() const override;
uint64_t getApproxBytesToWriteToDisk() const override;
diff --git a/searchcore/src/vespa/searchcore/proton/metrics/job_tracked_flush_target.cpp b/searchcore/src/vespa/searchcore/proton/metrics/job_tracked_flush_target.cpp
index 5b49c724c6f..852ed73dc74 100644
--- a/searchcore/src/vespa/searchcore/proton/metrics/job_tracked_flush_target.cpp
+++ b/searchcore/src/vespa/searchcore/proton/metrics/job_tracked_flush_target.cpp
@@ -30,10 +30,4 @@ JobTrackedFlushTarget::initFlush(SerialNum currentSerial, std::shared_ptr<search
return FlushTask::UP();
}
-uint64_t
-JobTrackedFlushTarget::getApproxBytesToWriteToDisk() const
-{
- return _target->getApproxBytesToWriteToDisk();
-}
-
} // namespace proton
diff --git a/searchcore/src/vespa/searchcore/proton/metrics/job_tracked_flush_target.h b/searchcore/src/vespa/searchcore/proton/metrics/job_tracked_flush_target.h
index d3a07b53b55..c09c1fac055 100644
--- a/searchcore/src/vespa/searchcore/proton/metrics/job_tracked_flush_target.h
+++ b/searchcore/src/vespa/searchcore/proton/metrics/job_tracked_flush_target.h
@@ -19,7 +19,7 @@ private:
public:
JobTrackedFlushTarget(std::shared_ptr<IJobTracker> tracker,
std::shared_ptr<searchcorespi::IFlushTarget> target);
- ~JobTrackedFlushTarget();
+ ~JobTrackedFlushTarget() override;
const IJobTracker &getTracker() const { return *_tracker; }
const searchcorespi::IFlushTarget &getTarget() const { return *_target; }
@@ -40,14 +40,18 @@ public:
bool needUrgentFlush() const override {
return _target->needUrgentFlush();
}
+ double get_replay_operation_cost() const override {
+ return _target->get_replay_operation_cost();
+ }
Priority getPriority() const override { return _target->getPriority(); }
searchcorespi::FlushTask::UP initFlush(SerialNum currentSerial, std::shared_ptr<search::IFlushToken> flush_token) override;
searchcorespi::FlushStats getLastFlushStats() const override {
return _target->getLastFlushStats();
}
- uint64_t getApproxBytesToWriteToDisk() const override;
+ uint64_t getApproxBytesToWriteToDisk() const override {
+ return _target->getApproxBytesToWriteToDisk();
+ }
};
} // namespace proton
-
diff --git a/searchcore/src/vespa/searchcore/proton/test/dummy_flush_target.cpp b/searchcore/src/vespa/searchcore/proton/test/dummy_flush_target.cpp
index 8915e3b367c..29b31dd2add 100644
--- a/searchcore/src/vespa/searchcore/proton/test/dummy_flush_target.cpp
+++ b/searchcore/src/vespa/searchcore/proton/test/dummy_flush_target.cpp
@@ -5,10 +5,10 @@
namespace proton::test {
DummyFlushTarget::DummyFlushTarget(const vespalib::string &name) noexcept
- : searchcorespi::IFlushTarget(name)
+ : searchcorespi::LeafFlushTarget(name, Type::OTHER, Component::OTHER)
{}
DummyFlushTarget::DummyFlushTarget(const vespalib::string &name, const Type &type, const Component &component) noexcept
- : searchcorespi::IFlushTarget(name, type, component)
+ : searchcorespi::LeafFlushTarget(name, type, component)
{}
DummyFlushTarget::~DummyFlushTarget() = default;
diff --git a/searchcore/src/vespa/searchcore/proton/test/dummy_flush_target.h b/searchcore/src/vespa/searchcore/proton/test/dummy_flush_target.h
index a9206233c9d..6b261f7bc4e 100644
--- a/searchcore/src/vespa/searchcore/proton/test/dummy_flush_target.h
+++ b/searchcore/src/vespa/searchcore/proton/test/dummy_flush_target.h
@@ -5,7 +5,7 @@
namespace proton::test {
-struct DummyFlushTarget : public searchcorespi::IFlushTarget
+struct DummyFlushTarget : public searchcorespi::LeafFlushTarget
{
DummyFlushTarget(const vespalib::string &name) noexcept;
DummyFlushTarget(const vespalib::string &name, const Type &type, const Component &component) noexcept;
@@ -14,7 +14,6 @@ struct DummyFlushTarget : public searchcorespi::IFlushTarget
DiskGain getApproxDiskGain() const override { return DiskGain(0, 0); }
SerialNum getFlushedSerialNum() const override { return 0; }
Time getLastFlushTime() const override { return Time(); }
- bool needUrgentFlush() const override { return false; }
searchcorespi::FlushTask::UP initFlush(SerialNum, std::shared_ptr<search::IFlushToken>) override {
return searchcorespi::FlushTask::UP();
}
diff --git a/searchcore/src/vespa/searchcorespi/flush/iflushtarget.cpp b/searchcore/src/vespa/searchcorespi/flush/iflushtarget.cpp
index d821e06a2a3..b31113e1abc 100644
--- a/searchcore/src/vespa/searchcorespi/flush/iflushtarget.cpp
+++ b/searchcore/src/vespa/searchcorespi/flush/iflushtarget.cpp
@@ -16,4 +16,8 @@ IFlushTarget::IFlushTarget(const vespalib::string &name, const Type &type, const
IFlushTarget::~IFlushTarget() = default;
+LeafFlushTarget::LeafFlushTarget(const vespalib::string &name, const Type &type, const Component &component) noexcept
+ : IFlushTarget(name, type, component)
+{}
+
}
diff --git a/searchcore/src/vespa/searchcorespi/flush/iflushtarget.h b/searchcore/src/vespa/searchcorespi/flush/iflushtarget.h
index 96907629dba..9e960757115 100644
--- a/searchcore/src/vespa/searchcorespi/flush/iflushtarget.h
+++ b/searchcore/src/vespa/searchcorespi/flush/iflushtarget.h
@@ -39,8 +39,8 @@ public:
};
enum class Priority {
- NORMAL,
- HIGH
+ NORMAL = 50,
+ HIGH = 100
};
private:
@@ -138,7 +138,7 @@ public:
/**
* Return cost of replaying a feed operation relative to cost of reading a feed operation from tls.
*/
- virtual double get_replay_operation_cost() const { return 0.0; }
+ virtual double get_replay_operation_cost() const = 0;
/**
* Returns the last serial number for the transaction applied to
@@ -161,9 +161,10 @@ public:
*
* @return true if an urgent flush is needed
*/
- virtual bool needUrgentFlush() const { return false; }
+ virtual bool needUrgentFlush() const = 0;
- virtual Priority getPriority() const { return Priority::NORMAL; }
+ /// Returns a priority for this target
+ virtual Priority getPriority() const = 0;
/**
* Initiates the flushing of temporary memory. This method must perform
@@ -182,7 +183,14 @@ public:
* @return The stats for the last flush.
*/
virtual FlushStats getLastFlushStats() const = 0;
+};
+class LeafFlushTarget : public IFlushTarget {
+public:
+ LeafFlushTarget(const vespalib::string &name, const Type &type, const Component &component) noexcept;
+ bool needUrgentFlush() const override { return false; }
+ Priority getPriority() const override { return Priority::NORMAL; }
+ double get_replay_operation_cost() const override { return 0.0; }
};
} // namespace searchcorespi
diff --git a/searchcore/src/vespa/searchcorespi/index/indexflushtarget.cpp b/searchcore/src/vespa/searchcorespi/index/indexflushtarget.cpp
index 53fb21bf1ed..b5a5e2c2843 100644
--- a/searchcore/src/vespa/searchcorespi/index/indexflushtarget.cpp
+++ b/searchcore/src/vespa/searchcorespi/index/indexflushtarget.cpp
@@ -10,7 +10,7 @@ LOG_SETUP(".searchcorespi.index.indexflushtarget");
namespace searchcorespi::index {
IndexFlushTarget::IndexFlushTarget(IndexMaintainer &indexMaintainer, IndexMaintainer::FlushStats flushStats)
- : IFlushTarget("memoryindex.flush", Type::FLUSH, Component::INDEX),
+ : LeafFlushTarget("memoryindex.flush", Type::FLUSH, Component::INDEX),
_indexMaintainer(indexMaintainer),
_flushStats(flushStats),
_numFrozenMemoryIndexes(indexMaintainer.getNumFrozenMemoryIndexes()),
diff --git a/searchcore/src/vespa/searchcorespi/index/indexflushtarget.h b/searchcore/src/vespa/searchcorespi/index/indexflushtarget.h
index 5fd6a1b9170..9f524bc341d 100644
--- a/searchcore/src/vespa/searchcorespi/index/indexflushtarget.h
+++ b/searchcore/src/vespa/searchcorespi/index/indexflushtarget.h
@@ -9,7 +9,7 @@ namespace searchcorespi::index {
/**
* Flush target for flushing a memory index in an IndexMaintainer.
**/
-class IndexFlushTarget : public IFlushTarget {
+class IndexFlushTarget : public LeafFlushTarget {
private:
IndexMaintainer &_indexMaintainer;
const IndexMaintainer::FlushStats _flushStats;
diff --git a/searchcore/src/vespa/searchcorespi/index/indexfusiontarget.cpp b/searchcore/src/vespa/searchcorespi/index/indexfusiontarget.cpp
index 6755976939b..562d49a4348 100644
--- a/searchcore/src/vespa/searchcorespi/index/indexfusiontarget.cpp
+++ b/searchcore/src/vespa/searchcorespi/index/indexfusiontarget.cpp
@@ -38,7 +38,7 @@ public:
}
IndexFusionTarget::IndexFusionTarget(IndexMaintainer &indexMaintainer)
- : IFlushTarget("memoryindex.fusion", Type::GC, Component::INDEX),
+ : LeafFlushTarget("memoryindex.fusion", Type::GC, Component::INDEX),
_indexMaintainer(indexMaintainer),
_fusionStats(indexMaintainer.getFusionStats()),
_lastStats()
diff --git a/searchcore/src/vespa/searchcorespi/index/indexfusiontarget.h b/searchcore/src/vespa/searchcorespi/index/indexfusiontarget.h
index 7a9f44e6612..2be7bcc33a9 100644
--- a/searchcore/src/vespa/searchcorespi/index/indexfusiontarget.h
+++ b/searchcore/src/vespa/searchcorespi/index/indexfusiontarget.h
@@ -9,7 +9,7 @@ namespace searchcorespi::index {
/**
* Flush target for doing fusion on disk indexes in an IndexMaintainer.
**/
-class IndexFusionTarget : public IFlushTarget {
+class IndexFusionTarget : public LeafFlushTarget {
private:
IndexMaintainer &_indexMaintainer;
IndexMaintainer::FusionStats _fusionStats;