summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2017-05-15 19:37:06 +0200
committerGitHub <noreply@github.com>2017-05-15 19:37:06 +0200
commitae77ebac3343e2fda414eef59145b15c0397062f (patch)
tree63a00a9ced817d8a3dbed0f6c0279a27fdc972b7
parent4e493944efc4989519b54d349aeb77780d68b01c (diff)
parentbed2084b5d15892e9834fd269d70475faf5b70d1 (diff)
Merge pull request #2465 from yahoo/revert-2451-toregge/add-shrink-lid-space-flush-target
Revert "Toregge/add shrink lid space flush target"
-rw-r--r--searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp40
-rw-r--r--searchcore/src/tests/proton/attribute/attribute_populator/attribute_populator_test.cpp1
-rw-r--r--searchcore/src/tests/proton/attribute/attribute_test.cpp5
-rw-r--r--searchcore/src/tests/proton/attribute/attributeflush_test.cpp9
-rw-r--r--searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp26
-rw-r--r--searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp36
-rw-r--r--searchcore/src/tests/proton/metrics/documentdb_job_trackers/documentdb_job_trackers_test.cpp5
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/CMakeLists.txt1
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp104
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/attributemanager.h22
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.cpp50
-rw-r--r--searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.cpp11
-rw-r--r--searchcore/src/vespa/searchcore/proton/common/eventlogger.cpp6
-rw-r--r--searchcore/src/vespa/searchcore/proton/flushengine/CMakeLists.txt1
-rw-r--r--searchcore/src/vespa/searchcore/proton/flushengine/shrink_lid_space_flush_target.cpp111
-rw-r--r--searchcore/src/vespa/searchcore/proton/flushengine/shrink_lid_space_flush_target.h53
-rw-r--r--searchcore/src/vespa/searchcore/proton/metrics/documentdb_job_trackers.cpp2
-rw-r--r--searchlib/src/vespa/searchlib/attribute/attributevector.cpp7
18 files changed, 83 insertions, 407 deletions
diff --git a/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp b/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp
index 8d128f67834..6bf9544b3ea 100644
--- a/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp
+++ b/searchcore/src/tests/proton/attribute/attribute_manager/attribute_manager_test.cpp
@@ -14,7 +14,6 @@ LOG_SETUP("attribute_manager_test");
#include <vespa/searchcore/proton/attribute/i_attribute_functor.h>
#include <vespa/searchcore/proton/attribute/imported_attributes_repo.h>
#include <vespa/searchcore/proton/attribute/sequential_attributes_initializer.h>
-#include <vespa/searchcore/proton/flushengine/shrink_lid_space_flush_target.h>
#include <vespa/searchcore/proton/common/hw_info.h>
#include <vespa/searchcore/proton/initializer/initializer_task.h>
#include <vespa/searchcore/proton/initializer/task_runner.h>
@@ -796,45 +795,6 @@ TEST_F("require that attribute vector of wrong type is dropped", BaseFixture)
TEST_DO(assertCreateSerialNum(am2.mgr, "a6", 20));
}
-void assertShrinkTargetSerial(proton::AttributeManager &mgr, const vespalib::string &name, search::SerialNum expSerialNum)
-{
- auto shrinker = mgr.getShrinker(name);
- EXPECT_EQUAL(expSerialNum, shrinker->getFlushedSerialNum());
-}
-
-TEST_F("require that we can guess flushed serial number for shrink flushtarget", BaseFixture)
-{
- auto am1(std::make_shared<proton::AttributeManager>
- (test_dir, "test.subdb", TuneFileAttributes(),
- f._fileHeaderContext, f._attributeFieldWriter, f._hwInfo));
- am1->addAttribute({"a1", INT32_SINGLE}, 1);
- am1->addAttribute({"a2", INT32_SINGLE}, 2);
- TEST_DO(assertShrinkTargetSerial(*am1, "a1", 0));
- TEST_DO(assertShrinkTargetSerial(*am1, "a2", 1));
- am1->flushAll(10);
- am1 = std::make_shared<proton::AttributeManager>
- (test_dir, "test.subdb", TuneFileAttributes(),
- f._fileHeaderContext, f._attributeFieldWriter, f._hwInfo);
- am1->addAttribute({"a1", INT32_SINGLE}, 1);
- am1->addAttribute({"a2", INT32_SINGLE}, 2);
- TEST_DO(assertShrinkTargetSerial(*am1, "a1", 10));
- TEST_DO(assertShrinkTargetSerial(*am1, "a2", 10));
-}
-
-TEST_F("require that shrink flushtarget is handed over to new attribute manager", BaseFixture)
-{
- auto am1(std::make_shared<proton::AttributeManager>
- (test_dir, "test.subdb", TuneFileAttributes(),
- f._fileHeaderContext, f._attributeFieldWriter, f._hwInfo));
- am1->addAttribute({"a1", INT32_SINGLE}, 4);
- AttrSpecList newSpec;
- newSpec.push_back(AttributeSpec("a1", INT32_SINGLE));
- auto am2 = am1->create(AttrMgrSpec(newSpec, 5, 20));
- auto am3 = std::dynamic_pointer_cast<AttributeManager>(am2);
- TEST_DO(assertShrinkTargetSerial(*am3, "a1", 3));
- EXPECT_EQUAL(am1->getShrinker("a1"), am3->getShrinker("a1"));
-}
-
TEST_MAIN()
{
vespalib::rmdir(test_dir, true);
diff --git a/searchcore/src/tests/proton/attribute/attribute_populator/attribute_populator_test.cpp b/searchcore/src/tests/proton/attribute/attribute_populator/attribute_populator_test.cpp
index 4a3f0eb09b7..41ff853047d 100644
--- a/searchcore/src/tests/proton/attribute/attribute_populator/attribute_populator_test.cpp
+++ b/searchcore/src/tests/proton/attribute/attribute_populator/attribute_populator_test.cpp
@@ -100,6 +100,5 @@ TEST_F("require that reprocess with document populates attribute", Fixture)
TEST_MAIN()
{
- vespalib::rmdir(TEST_DIR, true);
TEST_RUN_ALL();
}
diff --git a/searchcore/src/tests/proton/attribute/attribute_test.cpp b/searchcore/src/tests/proton/attribute/attribute_test.cpp
index b0752e82c56..173d8dd2a2a 100644
--- a/searchcore/src/tests/proton/attribute/attribute_test.cpp
+++ b/searchcore/src/tests/proton/attribute/attribute_test.cpp
@@ -13,7 +13,6 @@ LOG_SETUP("attribute_test");
#include <vespa/searchcore/proton/attribute/attributemanager.h>
#include <vespa/searchcore/proton/attribute/filter_attribute_manager.h>
#include <vespa/searchcore/proton/test/attribute_utils.h>
-#include <vespa/searchcorespi/flush/iflushtarget.h>
#include <vespa/searchlib/attribute/attributefactory.h>
#include <vespa/searchlib/attribute/integerbase.h>
#include <vespa/searchlib/common/idestructorcallback.h>
@@ -551,10 +550,6 @@ TEST_F("require that filter attribute manager can filter attributes", FilterFixt
f._filterMgr.getAttributeList(attrs);
EXPECT_EQUAL(1u, attrs.size());
EXPECT_EQUAL("a2", attrs[0]->getName());
- searchcorespi::IFlushTarget::List targets = f._filterMgr.getFlushTargets();
- EXPECT_EQUAL(2u, targets.size());
- EXPECT_EQUAL("attribute.flush.a2", targets[0]->getName());
- EXPECT_EQUAL("attribute.shrink.a2", targets[1]->getName());
}
TEST_F("require that filter attribute manager can return flushed serial number", FilterFixture)
diff --git a/searchcore/src/tests/proton/attribute/attributeflush_test.cpp b/searchcore/src/tests/proton/attribute/attributeflush_test.cpp
index 714e9076d16..5375f7817ec 100644
--- a/searchcore/src/tests/proton/attribute/attributeflush_test.cpp
+++ b/searchcore/src/tests/proton/attribute/attributeflush_test.cpp
@@ -6,7 +6,6 @@
#include <vespa/searchcore/proton/attribute/attributedisklayout.h>
#include <vespa/searchcore/proton/attribute/attribute_writer.h>
#include <vespa/searchcore/proton/attribute/flushableattribute.h>
-#include <vespa/searchcore/proton/flushengine/shrink_lid_space_flush_target.h>
#include <vespa/searchlib/attribute/attributefactory.h>
#include <vespa/searchlib/attribute/integerbase.h>
#include <vespa/searchlib/common/indexmetainfo.h>
@@ -390,11 +389,9 @@ Test::requireThatFlushTargetsCanBeRetrieved(void)
f.addAttribute("a4");
f.addAttribute("a5");
std::vector<IFlushTarget::SP> ftl = am.getFlushTargets();
- EXPECT_EQUAL(4u, ftl.size());
+ EXPECT_EQUAL(2u, ftl.size());
EXPECT_EQUAL(am.getFlushable("a4").get(), ftl[0].get());
- EXPECT_EQUAL(am.getShrinker("a4").get(), ftl[1].get());
- EXPECT_EQUAL(am.getFlushable("a5").get(), ftl[2].get());
- EXPECT_EQUAL(am.getShrinker("a5").get(), ftl[3].get());
+ EXPECT_EQUAL(am.getFlushable("a5").get(), ftl[1].get());
}
@@ -531,7 +528,7 @@ Test::requireThatShrinkWorks()
av->addDocs(1000 - av->getNumDocs());
av->commit(10, 10);
- IFlushTarget::SP ft = am.getShrinker("a10");
+ IFlushTarget::SP ft = am.getFlushable("a10");
EXPECT_EQUAL(ft->getApproxMemoryGain().getBefore(),
ft->getApproxMemoryGain().getAfter());
AttributeGuard::UP g = am.getAttribute("a10");
diff --git a/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp b/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp
index 88409052189..abfd80c9582 100644
--- a/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp
@@ -685,25 +685,23 @@ assertTarget(const vespalib::string &name,
TEST_F("require that flush targets can be retrieved", FastAccessFixture)
{
IFlushTarget::List targets = getFlushTargets(f);
- EXPECT_EQUAL(5u, targets.size());
- EXPECT_EQUAL("subdb.attribute.flush.attr1", targets[0]->getName());
- EXPECT_EQUAL("subdb.attribute.shrink.attr1", targets[1]->getName());
- EXPECT_EQUAL("subdb.documentmetastore", targets[2]->getName());
- EXPECT_EQUAL("subdb.summary.compact", targets[3]->getName());
- EXPECT_EQUAL("subdb.summary.flush", targets[4]->getName());
+ EXPECT_EQUAL(4u, targets.size());
+ EXPECT_EQUAL("subdb.attribute.attr1", targets[0]->getName());
+ EXPECT_EQUAL("subdb.documentmetastore", targets[1]->getName());
+ EXPECT_EQUAL("subdb.summary.compact", targets[2]->getName());
+ EXPECT_EQUAL("subdb.summary.flush", targets[3]->getName());
}
TEST_F("require that flush targets can be retrieved", SearchableFixture)
{
IFlushTarget::List targets = getFlushTargets(f);
- EXPECT_EQUAL(7u, targets.size());
- EXPECT_TRUE(assertTarget("subdb.attribute.flush.attr1", FType::SYNC, FComponent::ATTRIBUTE, *targets[0]));
- EXPECT_TRUE(assertTarget("subdb.attribute.shrink.attr1", FType::GC, FComponent::ATTRIBUTE, *targets[1]));
- EXPECT_TRUE(assertTarget("subdb.documentmetastore", FType::SYNC, FComponent::ATTRIBUTE, *targets[2]));
- EXPECT_TRUE(assertTarget("subdb.memoryindex.flush", FType::FLUSH, FComponent::INDEX, *targets[3]));
- EXPECT_TRUE(assertTarget("subdb.memoryindex.fusion", FType::GC, FComponent::INDEX, *targets[4]));
- EXPECT_TRUE(assertTarget("subdb.summary.compact", FType::GC, FComponent::DOCUMENT_STORE, *targets[5]));
- EXPECT_TRUE(assertTarget("subdb.summary.flush", FType::SYNC, FComponent::DOCUMENT_STORE, *targets[6]));
+ EXPECT_EQUAL(6u, targets.size());
+ EXPECT_TRUE(assertTarget("subdb.attribute.attr1", FType::SYNC, FComponent::ATTRIBUTE, *targets[0]));
+ EXPECT_TRUE(assertTarget("subdb.documentmetastore", FType::SYNC, FComponent::ATTRIBUTE, *targets[1]));
+ EXPECT_TRUE(assertTarget("subdb.memoryindex.flush", FType::FLUSH, FComponent::INDEX, *targets[2]));
+ EXPECT_TRUE(assertTarget("subdb.memoryindex.fusion", FType::GC, FComponent::INDEX, *targets[3]));
+ EXPECT_TRUE(assertTarget("subdb.summary.compact", FType::GC, FComponent::DOCUMENT_STORE, *targets[4]));
+ EXPECT_TRUE(assertTarget("subdb.summary.flush", FType::SYNC, FComponent::DOCUMENT_STORE, *targets[5]));
}
TEST_F("require that only fast-access attributes are instantiated", FastAccessOnlyFixture)
diff --git a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp
index 280b617246b..bdc0fc5f15c 100644
--- a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp
@@ -690,7 +690,6 @@ struct FixtureBase
void assertChangeNotified(document::GlobalId gid, uint32_t expLid) {
_gidToLidChangeHandler->assertLid(gid, expLid);
}
- void populateBeforeCompactLidSpace();
};
@@ -721,14 +720,6 @@ FixtureBase::FixtureBase(TimeStamp visibilityDelay)
FixtureBase::~FixtureBase() {
_writeServiceReal.sync();
}
-
-void
-FixtureBase::populateBeforeCompactLidSpace()
-{
- putAndWait(makeDummyDocs(0, 2, 1000));
- removeAndWait(makeDummyDocs(1, 1, 2000));
-}
-
struct SearchableFeedViewFixture : public FixtureBase
{
SearchableFeedView fv;
@@ -1144,16 +1135,17 @@ TEST_F("require that compactLidSpace() propagates to document meta store and doc
"blocks lid space shrinkage until generation is no longer used",
SearchableFeedViewFixture)
{
- f.populateBeforeCompactLidSpace();
- EXPECT_TRUE(assertThreadObserver(5, 3, f.writeServiceObserver()));
- f.compactLidSpaceAndWait(2);
+ EXPECT_TRUE(assertThreadObserver(1, 0, f.writeServiceObserver()));
+ CompactLidSpaceOperation op(0, 99);
+ op.setSerialNum(1);
+ f.runInMaster([&] () { f.fv.handleCompactLidSpace(op); });
// performIndexForceCommit in index thread, then completion callback
// in master thread.
- EXPECT_TRUE(assertThreadObserver(7, 4, f.writeServiceObserver()));
- EXPECT_EQUAL(2u, f.metaStoreObserver()._compactLidSpaceLidLimit);
- EXPECT_EQUAL(2u, f.getDocumentStore()._compactLidSpaceLidLimit);
+ EXPECT_TRUE(assertThreadObserver(3, 1, f.writeServiceObserver()));
+ EXPECT_EQUAL(99u, f.metaStoreObserver()._compactLidSpaceLidLimit);
+ EXPECT_EQUAL(99u, f.getDocumentStore()._compactLidSpaceLidLimit);
EXPECT_EQUAL(1u, f.metaStoreObserver()._holdUnblockShrinkLidSpaceCnt);
- EXPECT_EQUAL(2u, f._docIdLimit.get());
+ EXPECT_EQUAL(99u, f._docIdLimit.get());
}
TEST_F("require that compactLidSpace() doesn't propagate to "
@@ -1161,13 +1153,12 @@ TEST_F("require that compactLidSpace() doesn't propagate to "
"blocks lid space shrinkage until generation is no longer used",
SearchableFeedViewFixture)
{
- f.populateBeforeCompactLidSpace();
- EXPECT_TRUE(assertThreadObserver(5, 3, f.writeServiceObserver()));
- CompactLidSpaceOperation op(0, 2);
+ EXPECT_TRUE(assertThreadObserver(1, 0, f.writeServiceObserver()));
+ CompactLidSpaceOperation op(0, 99);
op.setSerialNum(0);
f.runInMaster([&] () { f.fv.handleCompactLidSpace(op); });
// Delayed holdUnblockShrinkLidSpace() in index thread, then master thread
- EXPECT_TRUE(assertThreadObserver(6, 3, f.writeServiceObserver()));
+ EXPECT_TRUE(assertThreadObserver(2, 0, f.writeServiceObserver()));
EXPECT_EQUAL(0u, f.metaStoreObserver()._compactLidSpaceLidLimit);
EXPECT_EQUAL(0u, f.getDocumentStore()._compactLidSpaceLidLimit);
EXPECT_EQUAL(0u, f.metaStoreObserver()._holdUnblockShrinkLidSpaceCnt);
@@ -1176,9 +1167,8 @@ TEST_F("require that compactLidSpace() doesn't propagate to "
TEST_F("require that compactLidSpace() propagates to attributeadapter",
FastAccessFeedViewFixture)
{
- f.populateBeforeCompactLidSpace();
- f.compactLidSpaceAndWait(2);
- EXPECT_EQUAL(2u, f.maw._wantedLidLimit);
+ f.runInMaster([&] () { f.fv.handleCompactLidSpace(CompactLidSpaceOperation(0, 99)); });
+ EXPECT_EQUAL(99u, f.maw._wantedLidLimit);
}
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 12a3ae7fe5e..3269fe84dcd 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
@@ -22,7 +22,6 @@ struct MFT : public test::DummyFlushTarget
};
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) {} };
@@ -94,16 +93,14 @@ TEST_F("require that known flush targets are tracked", Fixture)
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()));
IFlushTarget::List output = f._trackers.trackFlushTargets(input);
- EXPECT_EQUAL(6u, output.size());
+ EXPECT_EQUAL(5u, output.size());
EXPECT_TRUE(assertFlushTarget(f._trackers.getAttributeFlush(), *output[0]));
EXPECT_TRUE(assertFlushTarget(f._trackers.getMemoryIndexFlush(), *output[1]));
EXPECT_TRUE(assertFlushTarget(f._trackers.getDiskIndexFusion(), *output[2]));
EXPECT_TRUE(assertFlushTarget(f._trackers.getDocumentStoreFlush(), *output[3]));
EXPECT_TRUE(assertFlushTarget(f._trackers.getDocumentStoreCompact(), *output[4]));
- EXPECT_TRUE(assertFlushTarget(f._trackers.getAttributeFlush(), *output[5]));
}
TEST_F("require that un-known flush targets are not tracked", Fixture)
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/CMakeLists.txt b/searchcore/src/vespa/searchcore/proton/attribute/CMakeLists.txt
index f0e6520d0b4..cdb7b01254e 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/CMakeLists.txt
+++ b/searchcore/src/vespa/searchcore/proton/attribute/CMakeLists.txt
@@ -33,5 +33,4 @@ vespa_add_library(searchcore_attribute STATIC
initialized_attributes_result.cpp
sequential_attributes_initializer.cpp
DEPENDS
- searchcore_flushengine
)
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp
index f5014f9c944..2fa567e0c6d 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp
+++ b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.cpp
@@ -8,11 +8,9 @@
#include "imported_attributes_repo.h"
#include "sequential_attributes_initializer.h"
#include "flushableattribute.h"
-#include <vespa/searchcore/proton/flushengine/shrink_lid_space_flush_target.h>
#include <vespa/searchlib/attribute/attributecontext.h>
#include <vespa/searchlib/attribute/interlock.h>
#include <vespa/searchlib/common/isequencedtaskexecutor.h>
-#include <vespa/searchlib/common/threaded_compactable_lid_space.h>
#include <vespa/searchlib/attribute/attributevector.h>
#include <vespa/vespalib/io/fileutil.h>
#include <vespa/vespalib/stllike/hash_map.hpp>
@@ -25,7 +23,6 @@ using search::AttributeContext;
using search::AttributeEnumGuard;
using search::AttributeGuard;
using search::AttributeVector;
-using search::common::ThreadedCompactableLidSpace;
using search::TuneFileAttributes;
using search::attribute::IAttributeContext;
using search::attribute::IAttributeVector;
@@ -63,26 +60,6 @@ bool matchingTypes(const AttributeVector::SP &av, const search::attribute::Confi
}
}
-search::SerialNum estimateShrinkSerialNum(const AttributeVector &attr)
-{
- search::SerialNum serialNum = attr.getCreateSerialNum();
- if (serialNum > 0) {
- --serialNum;
- }
- return std::max(attr.getStatus().getLastSyncToken(), serialNum);
-}
-
-std::shared_ptr<ShrinkLidSpaceFlushTarget> allocShrinker(const AttributeVector::SP &attr, search::ISequencedTaskExecutor &attributeFieldWriter)
-{
- 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));
- search::SerialNum shrinkSerialNum = estimateShrinkSerialNum(*attr);
- return std::make_shared<ShrinkLidSpaceFlushTarget>("attribute.shrink." + name, Type::GC, Component::ATTRIBUTE, shrinkSerialNum, shrinkwrap);
-}
-
}
AttributeManager::AttributeWrap::AttributeWrap(const AttributeVectorSP & a,
@@ -114,21 +91,6 @@ AttributeManager::AttributeWrap::normalAttribute(const AttributeVectorSP &a)
return AttributeWrap(a, false);
}
-AttributeManager::FlushableWrap::FlushableWrap()
- : _flusher(),
- _shrinker()
-{
-}
-
-AttributeManager::FlushableWrap::FlushableWrap(FlushableAttributeSP flusher, ShrinkerSP shrinker)
- : _flusher(std::move(flusher)),
- _shrinker(std::move(shrinker))
-{
-}
-
-AttributeManager::FlushableWrap::~FlushableWrap()
-{
-}
AttributeVector::SP
AttributeManager::internalAddAttribute(const AttributeSpec &spec,
@@ -139,24 +101,25 @@ AttributeManager::internalAddAttribute(const AttributeSpec &spec,
AttributeInitializerResult result = initializer.init();
if (result) {
result.getAttribute()->setInterlock(_interlock);
- auto shrinker = allocShrinker(result.getAttribute(), _attributeFieldWriter);
- addAttribute(AttributeWrap::normalAttribute(result.getAttribute()), shrinker);
+ addAttribute(AttributeWrap::normalAttribute(result.getAttribute()));
}
return result.getAttribute();
}
void
-AttributeManager::addAttribute(const AttributeWrap &attribute, const ShrinkerSP &shrinker)
+AttributeManager::addAttribute(const AttributeWrap &attribute)
{
LOG(debug, "Adding attribute vector '%s'", attribute.getAttribute()->getBaseFileName().c_str());
_attributes[attribute.getAttribute()->getName()] = attribute;
assert(attribute.getAttribute()->getInterlock() == _interlock);
if ( ! attribute.isExtra() ) {
// Flushing of extra attributes is handled elsewhere
- auto attr = attribute.getAttribute();
- const vespalib::string &name = attr->getName();
- auto flusher = std::make_shared<FlushableAttribute>(attr, _diskLayout->createAttributeDir(name), _tuneFileAttributes, _fileHeaderContext, _attributeFieldWriter, _hwInfo);
- _flushables[attribute.getAttribute()->getName()] = FlushableWrap(flusher, shrinker);
+ _flushables[attribute.getAttribute()->getName()] = FlushableAttribute::SP
+ (new FlushableAttribute(attribute.getAttribute(), _diskLayout->createAttributeDir(attribute.getAttribute()->getName()),
+ _tuneFileAttributes,
+ _fileHeaderContext,
+ _attributeFieldWriter,
+ _hwInfo));
_writableAttributes.push_back(attribute.getAttribute().get());
}
}
@@ -170,11 +133,11 @@ AttributeManager::findAttribute(const vespalib::string &name) const
: AttributeVector::SP();
}
-const AttributeManager::FlushableWrap *
+FlushableAttribute::SP
AttributeManager::findFlushable(const vespalib::string &name) const
{
FlushableMap::const_iterator itr = _flushables.find(name);
- return (itr != _flushables.end()) ? &itr->second : nullptr;
+ return (itr != _flushables.end()) ? itr->second : FlushableAttribute::SP();
}
void
@@ -187,11 +150,7 @@ AttributeManager::transferExistingAttributes(const AttributeManager &currMgr,
if (matchingTypes(av, aspec.getConfig())) { // transfer attribute
LOG(debug, "Transferring attribute vector '%s' with %u docs and serial number %lu from current manager",
av->getName().c_str(), av->getNumDocs(), av->getStatus().getLastSyncToken());
- auto wrap = currMgr.findFlushable(aspec.getName());
- assert(wrap != nullptr);
- auto shrinker = wrap->getShrinker();
- assert(shrinker);
- addAttribute(AttributeWrap::normalAttribute(av), shrinker);
+ addAttribute(AttributeWrap::normalAttribute(av));
} else {
toBeAdded.push_back(aspec);
}
@@ -231,7 +190,7 @@ AttributeManager::transferExtraAttributes(const AttributeManager &currMgr)
{
for (const auto &kv : currMgr._attributes) {
if (kv.second.isExtra()) {
- addAttribute(kv.second, 0);
+ addAttribute(kv.second);
}
}
}
@@ -320,10 +279,8 @@ AttributeManager::addInitializedAttributes(const std::vector<AttributeInitialize
{
for (const auto &result : attributes) {
assert(result);
- auto attr = result.getAttribute();
- attr->setInterlock(_interlock);
- auto shrinker = allocShrinker(attr, _attributeFieldWriter);
- addAttribute(AttributeWrap::normalAttribute(attr), shrinker);
+ result.getAttribute()->setInterlock(_interlock);
+ addAttribute(AttributeWrap::normalAttribute(result.getAttribute()));
}
}
@@ -331,16 +288,15 @@ void
AttributeManager::addExtraAttribute(const AttributeVector::SP &attribute)
{
attribute->setInterlock(_interlock);
- addAttribute(AttributeWrap::extraAttribute(attribute), ShrinkerSP());
+ addAttribute(AttributeWrap::extraAttribute(attribute));
}
void
AttributeManager::flushAll(SerialNum currentSerial)
{
- auto flushTargets = getFlushTargets();
- for (const auto &ft : flushTargets) {
+ for (const auto &kv : _flushables) {
vespalib::Executor::Task::UP task;
- task = ft->initFlush(currentSerial);
+ task = kv.second->initFlush(currentSerial);
if (task.get() != NULL) {
task->run();
}
@@ -350,15 +306,7 @@ AttributeManager::flushAll(SerialNum currentSerial)
FlushableAttribute::SP
AttributeManager::getFlushable(const vespalib::string &name)
{
- auto wrap = findFlushable(name);
- return ((wrap != nullptr) ? wrap->getFlusher() : FlushableAttribute::SP());
-}
-
-AttributeManager::ShrinkerSP
-AttributeManager::getShrinker(const vespalib::string &name)
-{
- auto wrap = findFlushable(name);
- return ((wrap != nullptr) ? wrap->getShrinker() : ShrinkerSP());
+ return findFlushable(name);
}
size_t
@@ -481,8 +429,7 @@ AttributeManager::getFlushTargets() const
std::vector<IFlushTarget::SP> list;
list.reserve(_flushables.size());
for (const auto &kv : _flushables) {
- list.push_back(kv.second.getFlusher());
- list.push_back(kv.second.getShrinker());
+ list.push_back(kv.second);
}
return list;
}
@@ -490,12 +437,9 @@ AttributeManager::getFlushTargets() const
search::SerialNum
AttributeManager::getFlushedSerialNum(const vespalib::string &name) const
{
- auto wrap = findFlushable(name);
- if (wrap != nullptr) {
- const auto &flusher = wrap->getFlusher();
- if (flusher) {
- return flusher->getFlushedSerialNum();
- }
+ FlushableAttribute::SP flushable = findFlushable(name);
+ if (flushable.get() != nullptr) {
+ return flushable->getFlushedSerialNum();
}
return 0;
}
@@ -505,7 +449,7 @@ AttributeManager::getOldestFlushedSerialNumber() const
{
SerialNum num = -1;
for (const auto &kv : _flushables) {
- num = std::min(num, kv.second.getFlusher()->getFlushedSerialNum());
+ num = std::min(num, kv.second->getFlushedSerialNum());
}
return num;
}
@@ -515,7 +459,7 @@ AttributeManager::getNewestFlushedSerialNumber() const
{
SerialNum num = 0;
for (const auto &kv : _flushables) {
- num = std::max(num, kv.second.getFlusher()->getFlushedSerialNum());
+ num = std::max(num, kv.second->getFlushedSerialNum());
}
return num;
}
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.h b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.h
index 4faa3011a1d..7bfaf337420 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.h
+++ b/searchcore/src/vespa/searchcore/proton/attribute/attributemanager.h
@@ -35,7 +35,6 @@ namespace proton
class AttributeDiskLayout;
class FlushableAttribute;
-class ShrinkLidSpaceFlushTarget;
/**
* Specialized attribute manager for proton.
@@ -47,7 +46,6 @@ private:
typedef search::SerialNum SerialNum;
typedef AttributeCollectionSpec Spec;
using FlushableAttributeSP = std::shared_ptr<FlushableAttribute>;
- using ShrinkerSP = std::shared_ptr<ShrinkLidSpaceFlushTarget>;
using IFlushTargetSP = std::shared_ptr<searchcorespi::IFlushTarget>;
using AttributeVectorSP = std::shared_ptr<search::AttributeVector>;
@@ -66,20 +64,8 @@ private:
const AttributeVectorSP getAttribute() const { return _attr; }
};
- class FlushableWrap
- {
- FlushableAttributeSP _flusher;
- ShrinkerSP _shrinker;
- public:
- FlushableWrap();
- FlushableWrap(FlushableAttributeSP flusher, ShrinkerSP shrinker);
- ~FlushableWrap();
- const FlushableAttributeSP &getFlusher() const { return _flusher; }
- const ShrinkerSP &getShrinker() const { return _shrinker; }
- };
-
typedef vespalib::hash_map<vespalib::string, AttributeWrap> AttributeMap;
- typedef vespalib::hash_map<vespalib::string, FlushableWrap> FlushableMap;
+ typedef vespalib::hash_map<vespalib::string, FlushableAttributeSP> FlushableMap;
AttributeMap _attributes;
FlushableMap _flushables;
@@ -98,11 +84,11 @@ private:
uint64_t serialNum,
const IAttributeFactory &factory);
- void addAttribute(const AttributeWrap &attribute, const ShrinkerSP &shrinker);
+ void addAttribute(const AttributeWrap &attribute);
AttributeVectorSP findAttribute(const vespalib::string &name) const;
- const FlushableWrap *findFlushable(const vespalib::string &name) const;
+ FlushableAttributeSP findFlushable(const vespalib::string &name) const;
void transferExistingAttributes(const AttributeManager &currMgr,
const Spec &newSpec,
@@ -149,8 +135,6 @@ public:
FlushableAttributeSP getFlushable(const vespalib::string &name);
- ShrinkerSP getShrinker(const vespalib::string &name);
-
size_t getNumDocs() const;
static void padAttribute(search::AttributeVector &v, uint32_t docIdLimit);
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.cpp b/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.cpp
index e92a804b5de..f2f37fa5c16 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.cpp
+++ b/searchcore/src/vespa/searchcore/proton/attribute/filter_attribute_manager.cpp
@@ -13,39 +13,21 @@ namespace proton {
namespace {
-const vespalib::string FLUSH_TARGET_NAME_PREFIX("attribute.flush.");
-const vespalib::string SHRINK_TARGET_NAME_PREFIX("attribute.shrink.");
+const vespalib::string FLUSH_TARGET_NAME_PREFIX("attribute.");
-class FlushTargetFilter
-{
- const vespalib::string &_prefix;
- const IFlushTarget::Type _type;
-public:
- FlushTargetFilter(const vespalib::string &prefix, IFlushTarget::Type type)
- : _prefix(prefix),
- _type(type)
- {
- }
-
- ~FlushTargetFilter() { }
-
- bool match(const IFlushTarget::SP &flushTarget) const {
- const vespalib::string &targetName = flushTarget->getName();
- if ((flushTarget->getType() != _type) ||
- (flushTarget->getComponent() != IFlushTarget::Component::ATTRIBUTE)) {
- return false;
- }
- return (targetName.substr(0, _prefix.size()) == _prefix);
+bool isAttributeFlushTarget(const IFlushTarget::SP &flushTarget) {
+ const vespalib::string &targetName = flushTarget->getName();
+ if ((flushTarget->getType() != IFlushTarget::Type::SYNC) ||
+ (flushTarget->getComponent() != IFlushTarget::Component::ATTRIBUTE)) {
+ return false;
}
+ return (targetName.substr(0, FLUSH_TARGET_NAME_PREFIX.size()) == FLUSH_TARGET_NAME_PREFIX);
+}
- vespalib::string attributeName(const IFlushTarget::SP &flushTarget) {
- const vespalib::string &targetName = flushTarget->getName();
- return targetName.substr(_prefix.size());
- }
-};
-
-FlushTargetFilter syncFilter(FLUSH_TARGET_NAME_PREFIX, IFlushTarget::Type::SYNC);
-FlushTargetFilter shrinkFilter(SHRINK_TARGET_NAME_PREFIX, IFlushTarget::Type::GC);
+vespalib::string attributeFlushTargetAttributeName(const IFlushTarget::SP &flushTarget) {
+ const vespalib::string &targetName = flushTarget->getName();
+ return targetName.substr(FLUSH_TARGET_NAME_PREFIX.size());
+}
}
@@ -90,12 +72,8 @@ FilterAttributeManager::getFlushTargets() const {
std::vector<searchcorespi::IFlushTarget::SP> list;
list.reserve(completeList.size());
for (const auto &flushTarget : completeList) {
- if (syncFilter.match(flushTarget)) {
- if (acceptAttribute(syncFilter.attributeName(flushTarget))) {
- list.push_back(flushTarget);
- }
- } else if (shrinkFilter.match(flushTarget)) {
- if (acceptAttribute(shrinkFilter.attributeName(flushTarget))) {
+ if (isAttributeFlushTarget(flushTarget)) {
+ if (acceptAttribute(attributeFlushTargetAttributeName(flushTarget))) {
list.push_back(flushTarget);
}
}
diff --git a/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.cpp b/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.cpp
index 8be1a8868d1..260d819bec5 100644
--- a/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.cpp
+++ b/searchcore/src/vespa/searchcore/proton/attribute/flushableattribute.cpp
@@ -70,6 +70,9 @@ FlushableAttribute::Flusher::Flusher(FlushableAttribute & fattr, SerialNum syncT
fattr._attr->commit(syncToken, syncToken);
AttributeVector &attr = *_fattr._attr;
// Called by attribute field writer executor
+ if (attr.canShrinkLidSpace()) {
+ attr.shrinkLidSpace();
+ }
_flushFile = writer.getSnapshotDir(_syncToken) + "/" + attr.getName();
attr.setBaseFileName(_flushFile);
_saver = attr.initSave();
@@ -168,7 +171,7 @@ FlushableAttribute::FlushableAttribute(const AttributeVectorSP attr,
attributeFieldWriter,
const HwInfo &hwInfo)
: IFlushTarget(vespalib::make_string(
- "attribute.flush.%s",
+ "attribute.%s",
attr->getName().c_str()),
Type::SYNC, Component::ATTRIBUTE),
_attr(attr),
@@ -199,7 +202,11 @@ IFlushTarget::MemoryGain
FlushableAttribute::getApproxMemoryGain() const
{
int64_t used(_attr->getStatus().getUsed());
- return MemoryGain(used, used);
+ int64_t canFree = _attr->getEstimatedShrinkLidSpaceGain();
+ if (canFree > used) {
+ canFree = used;
+ }
+ return MemoryGain(used, used - canFree);
}
IFlushTarget::DiskGain
diff --git a/searchcore/src/vespa/searchcore/proton/common/eventlogger.cpp b/searchcore/src/vespa/searchcore/proton/common/eventlogger.cpp
index 49938ccf2bf..cb3963b4790 100644
--- a/searchcore/src/vespa/searchcore/proton/common/eventlogger.cpp
+++ b/searchcore/src/vespa/searchcore/proton/common/eventlogger.cpp
@@ -136,10 +136,8 @@ EventLogger::flushComplete(const string &name,
jstr.beginObject();
jstr.appendKey("name").appendString(name);
jstr.appendKey("time.elapsed.ms").appendInt64(elapsedTimeMs);
- if (!outputPath.empty()) {
- jstr.appendKey("output");
- LogUtil::logDir(jstr, outputPath, outputPathElems);
- }
+ jstr.appendKey("output");
+ LogUtil::logDir(jstr, outputPath, outputPathElems);
jstr.endObject();
EV_STATE("flush.complete", jstr.toString().c_str());
}
diff --git a/searchcore/src/vespa/searchcore/proton/flushengine/CMakeLists.txt b/searchcore/src/vespa/searchcore/proton/flushengine/CMakeLists.txt
index bd7bc949e8f..dddcfbd9327 100644
--- a/searchcore/src/vespa/searchcore/proton/flushengine/CMakeLists.txt
+++ b/searchcore/src/vespa/searchcore/proton/flushengine/CMakeLists.txt
@@ -2,7 +2,6 @@
vespa_add_library(searchcore_flushengine STATIC
SOURCES
cachedflushtarget.cpp
- shrink_lid_space_flush_target.cpp
flush_all_strategy.cpp
flushcontext.cpp
flushengine.cpp
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
deleted file mode 100644
index 3b12dbbf3aa..00000000000
--- a/searchcore/src/vespa/searchcore/proton/flushengine/shrink_lid_space_flush_target.cpp
+++ /dev/null
@@ -1,111 +0,0 @@
-// Copyright 2017 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.flushengine.shrink_lid_space_flush_target");
-
-#include "shrink_lid_space_flush_target.h"
-#include <vespa/searchlib/common/i_compactable_lid_space.h>
-
-namespace proton {
-
-using searchcorespi::IFlushTarget;
-using searchcorespi::FlushStats;
-using searchcorespi::FlushTask;
-
-class ShrinkLidSpaceFlushTarget::Flusher : public FlushTask
-{
- ShrinkLidSpaceFlushTarget &_target;
- SerialNum _flushSerialNum;
-public:
- Flusher(ShrinkLidSpaceFlushTarget &target, SerialNum flushSerialNum);
- virtual void run() override;
- virtual search::SerialNum getFlushSerial() const override;
-};
-
-ShrinkLidSpaceFlushTarget::Flusher::Flusher(ShrinkLidSpaceFlushTarget &target, SerialNum flushSerialNum)
- : FlushTask(),
- _target(target),
- _flushSerialNum(flushSerialNum)
-{
- _target._target->shrinkLidSpace();
-}
-
-void
-ShrinkLidSpaceFlushTarget::Flusher::run()
-{
- _target._flushedSerialNum = _flushSerialNum;
-}
-
-search::SerialNum
-ShrinkLidSpaceFlushTarget::Flusher::getFlushSerial() const
-{
- return _flushSerialNum;
-}
-
-ShrinkLidSpaceFlushTarget::ShrinkLidSpaceFlushTarget(const vespalib::string &name,
- Type type,
- Component component,
- SerialNum flushedSerialNum,
- std::shared_ptr<ICompactableLidSpace> target)
- : IFlushTarget(name, type, component),
-
- _target(std::move(target)),
- _flushedSerialNum(flushedSerialNum),
- _lastStats()
-{
-}
-
-IFlushTarget::MemoryGain
-ShrinkLidSpaceFlushTarget::getApproxMemoryGain() const
-{
- int64_t canFree = _target->getEstimatedShrinkLidSpaceGain();
- return MemoryGain(canFree, 0);
-}
-
-IFlushTarget::DiskGain
-ShrinkLidSpaceFlushTarget::getApproxDiskGain() const
-{
- return DiskGain(0, 0);
-}
-
-IFlushTarget::SerialNum
-ShrinkLidSpaceFlushTarget::getFlushedSerialNum() const
-{
- return _flushedSerialNum;
-}
-
-IFlushTarget::Time
-ShrinkLidSpaceFlushTarget::getLastFlushTime() const
-{
- return fastos::ClockSystem::now();
-}
-
-bool
-ShrinkLidSpaceFlushTarget::needUrgentFlush() const
-{
- return false;
-}
-
-IFlushTarget::Task::UP
-ShrinkLidSpaceFlushTarget::initFlush(SerialNum currentSerial)
-{
- if (!_target->canShrinkLidSpace() && currentSerial <= _flushedSerialNum) {
- return IFlushTarget::Task::UP();
- } else {
- return std::make_unique<Flusher>(*this, currentSerial);
- }
-}
-
-FlushStats
-ShrinkLidSpaceFlushTarget::getLastFlushStats() const
-{
- return _lastStats;
-}
-
-uint64_t
-ShrinkLidSpaceFlushTarget::getApproxBytesToWriteToDisk() const
-{
- return 0;
-}
-
-} // namespace proton
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
deleted file mode 100644
index 9dcfd592ed7..00000000000
--- a/searchcore/src/vespa/searchcore/proton/flushengine/shrink_lid_space_flush_target.h
+++ /dev/null
@@ -1,53 +0,0 @@
-// Copyright 2017 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-#pragma once
-
-#include <vespa/searchcorespi/flush/iflushtarget.h>
-
-namespace search::common { class ICompactableLidSpace; }
-
-namespace proton {
-
-
-/**
- * Implements a flush target that shrinks lid space in target.
- */
-class ShrinkLidSpaceFlushTarget : public searchcorespi::IFlushTarget
-{
- /**
- * Task representing that shrinking has been performed.
- **/
- class Flusher;
- using ICompactableLidSpace = search::common::ICompactableLidSpace;
- using FlushStats = searchcorespi::FlushStats;
- std::shared_ptr<ICompactableLidSpace> _target;
- SerialNum _flushedSerialNum;
- FlushStats _lastStats;
-
-public:
- /**
- * Constructs a new instance of this class.
- *
- * @param name The handler-wide unique name of this target.
- * @param type The flush type of this target.
- * @param component The component type of this target.
- * @param flushedSerialNum When target shrank lid space last time
- * @param target The target supporting lid space compaction
- */
- ShrinkLidSpaceFlushTarget(const vespalib::string &name,
- Type type,
- Component component,
- SerialNum flushedSerialNum,
- std::shared_ptr<ICompactableLidSpace> target);
-
- // Implements IFlushTarget.
- virtual MemoryGain getApproxMemoryGain() const override;
- virtual DiskGain getApproxDiskGain() const override;
- virtual SerialNum getFlushedSerialNum() const override;
- virtual Time getLastFlushTime() const override;
- virtual bool needUrgentFlush() const override;
- virtual Task::UP initFlush(SerialNum currentSerial) override;
- virtual searchcorespi::FlushStats getLastFlushStats() const override;
- virtual uint64_t getApproxBytesToWriteToDisk() const override;
-};
-
-} // namespace proton
diff --git a/searchcore/src/vespa/searchcore/proton/metrics/documentdb_job_trackers.cpp b/searchcore/src/vespa/searchcore/proton/metrics/documentdb_job_trackers.cpp
index c4564567d86..ce6152fe464 100644
--- a/searchcore/src/vespa/searchcore/proton/metrics/documentdb_job_trackers.cpp
+++ b/searchcore/src/vespa/searchcore/proton/metrics/documentdb_job_trackers.cpp
@@ -48,8 +48,6 @@ DocumentDBJobTrackers::trackFlushTargets(const IFlushTarget::List &flushTargets)
for (const auto &ft : flushTargets) {
if (ft->getComponent() == FTC::ATTRIBUTE && ft->getType() == FTT::SYNC) {
retval.push_back(trackFlushTarget(_attributeFlush, ft));
- } else if (ft->getComponent() == FTC::ATTRIBUTE && ft->getType() == FTT::GC) {
- retval.push_back(trackFlushTarget(_attributeFlush, ft));
} else if (ft->getComponent() == FTC::INDEX && ft->getType() == FTT::FLUSH) {
retval.push_back(trackFlushTarget(_memoryIndexFlush, ft));
} else if (ft->getComponent() == FTC::INDEX && ft->getType() == FTT::GC) {
diff --git a/searchlib/src/vespa/searchlib/attribute/attributevector.cpp b/searchlib/src/vespa/searchlib/attribute/attributevector.cpp
index e3fb780bb16..cea30a8359c 100644
--- a/searchlib/src/vespa/searchlib/attribute/attributevector.cpp
+++ b/searchlib/src/vespa/searchlib/attribute/attributevector.cpp
@@ -707,7 +707,7 @@ uint32_t AttributeVector::getVersion() const { return 0; }
void
AttributeVector::compactLidSpace(uint32_t wantedLidLimit) {
commit();
- assert(_committedDocIdLimit >= wantedLidLimit);
+ assert(_uncommittedDocIdLimit <= wantedLidLimit);
if (wantedLidLimit < _committedDocIdLimit) {
clearDocs(wantedLidLimit, _committedDocIdLimit);
}
@@ -729,10 +729,7 @@ void
AttributeVector::shrinkLidSpace(void)
{
commit();
- removeAllOldGenerations();
- if (!canShrinkLidSpace()) {
- return;
- }
+ assert(canShrinkLidSpace());
uint32_t committedDocIdLimit = _committedDocIdLimit;
clearDocs(committedDocIdLimit, getNumDocs());
commit();