summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp2
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp10
-rw-r--r--searchcore/src/vespa/searchcore/proton/flushengine/shrink_lid_space_flush_target.cpp5
-rw-r--r--searchcore/src/vespa/searchcore/proton/flushengine/shrink_lid_space_flush_target.h2
-rw-r--r--searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp1
5 files changed, 14 insertions, 6 deletions
diff --git a/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp b/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp
index e8484f1bf4d..fc22a629f23 100644
--- a/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp
+++ b/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp
@@ -1877,7 +1877,7 @@ TEST("requireThatShrinkViaFlushTargetWorks")
using Type = IFlushTarget::Type;
using Component = IFlushTarget::Component;
IFlushTarget::SP ft(std::make_shared<ShrinkLidSpaceFlushTarget>
- ("documentmetastore.shrink", Type::GC, Component::ATTRIBUTE, 0, dms));
+ ("documentmetastore.shrink", Type::GC, Component::ATTRIBUTE, 0, IFlushTarget::Time(), dms));
populate(10, *dms);
uint32_t shrinkTarget = 5;
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp
index f5014f9c944..5385063e17f 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp
+++ b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp
@@ -1,6 +1,7 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#include "attribute_factory.h"
+#include "attribute_directory.h"
#include "attributedisklayout.h"
#include "attributemanager.h"
#include "i_attribute_functor.h"
@@ -72,15 +73,16 @@ search::SerialNum estimateShrinkSerialNum(const AttributeVector &attr)
return std::max(attr.getStatus().getLastSyncToken(), serialNum);
}
-std::shared_ptr<ShrinkLidSpaceFlushTarget> allocShrinker(const AttributeVector::SP &attr, search::ISequencedTaskExecutor &attributeFieldWriter)
+std::shared_ptr<ShrinkLidSpaceFlushTarget> allocShrinker(const AttributeVector::SP &attr, search::ISequencedTaskExecutor &attributeFieldWriter, AttributeDiskLayout &diskLayout)
{
using Type = IFlushTarget::Type;
using Component = IFlushTarget::Component;
const vespalib::string &name = attr->getName();
auto shrinkwrap = std::make_shared<ThreadedCompactableLidSpace>(attr, attributeFieldWriter, attributeFieldWriter.getExecutorId(name));
+ auto dir = diskLayout.createAttributeDir(name);
search::SerialNum shrinkSerialNum = estimateShrinkSerialNum(*attr);
- return std::make_shared<ShrinkLidSpaceFlushTarget>("attribute.shrink." + name, Type::GC, Component::ATTRIBUTE, shrinkSerialNum, shrinkwrap);
+ return std::make_shared<ShrinkLidSpaceFlushTarget>("attribute.shrink." + name, Type::GC, Component::ATTRIBUTE, shrinkSerialNum, dir->getLastFlushTime(), shrinkwrap);
}
}
@@ -139,7 +141,7 @@ AttributeManager::internalAddAttribute(const AttributeSpec &spec,
AttributeInitializerResult result = initializer.init();
if (result) {
result.getAttribute()->setInterlock(_interlock);
- auto shrinker = allocShrinker(result.getAttribute(), _attributeFieldWriter);
+ auto shrinker = allocShrinker(result.getAttribute(), _attributeFieldWriter, *_diskLayout);
addAttribute(AttributeWrap::normalAttribute(result.getAttribute()), shrinker);
}
return result.getAttribute();
@@ -322,7 +324,7 @@ AttributeManager::addInitializedAttributes(const std::vector<AttributeInitialize
assert(result);
auto attr = result.getAttribute();
attr->setInterlock(_interlock);
- auto shrinker = allocShrinker(attr, _attributeFieldWriter);
+ auto shrinker = allocShrinker(attr, _attributeFieldWriter, *_diskLayout);
addAttribute(AttributeWrap::normalAttribute(attr), shrinker);
}
}
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 3b12dbbf3aa..a2c154e8192 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
@@ -34,6 +34,7 @@ void
ShrinkLidSpaceFlushTarget::Flusher::run()
{
_target._flushedSerialNum = _flushSerialNum;
+ _target._lastFlushTime = fastos::ClockSystem::now();
}
search::SerialNum
@@ -46,11 +47,13 @@ ShrinkLidSpaceFlushTarget::ShrinkLidSpaceFlushTarget(const vespalib::string &nam
Type type,
Component component,
SerialNum flushedSerialNum,
+ Time lastFlushTime,
std::shared_ptr<ICompactableLidSpace> target)
: IFlushTarget(name, type, component),
_target(std::move(target)),
_flushedSerialNum(flushedSerialNum),
+ _lastFlushTime(lastFlushTime),
_lastStats()
{
}
@@ -77,7 +80,7 @@ ShrinkLidSpaceFlushTarget::getFlushedSerialNum() const
IFlushTarget::Time
ShrinkLidSpaceFlushTarget::getLastFlushTime() const
{
- return fastos::ClockSystem::now();
+ return _lastFlushTime;
}
bool
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 9dcfd592ed7..18bda6bda4e 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
@@ -21,6 +21,7 @@ class ShrinkLidSpaceFlushTarget : public searchcorespi::IFlushTarget
using FlushStats = searchcorespi::FlushStats;
std::shared_ptr<ICompactableLidSpace> _target;
SerialNum _flushedSerialNum;
+ Time _lastFlushTime;
FlushStats _lastStats;
public:
@@ -37,6 +38,7 @@ public:
Type type,
Component component,
SerialNum flushedSerialNum,
+ Time lastFlushTime,
std::shared_ptr<ICompactableLidSpace> target);
// Implements IFlushTarget.
diff --git a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp
index b8a8e03ee66..2649fac23c1 100644
--- a/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp
+++ b/searchcore/src/vespa/searchcore/proton/server/storeonlydocsubdb.cpp
@@ -292,6 +292,7 @@ StoreOnlyDocSubDB::setupDocumentMetaStore(DocumentMetaStoreInitializerResult::SP
("documentmetastore.shrink",
Type::GC, Component::ATTRIBUTE,
_flushedDocumentMetaStoreSerialNum,
+ _dmsFlushTarget->getLastFlushTime(),
dms);
}