aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp6
-rw-r--r--searchcore/src/tests/proton/documentdb/documentdb_test.cpp49
-rw-r--r--searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.cpp26
3 files changed, 54 insertions, 27 deletions
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 7f7a87c8084..633f7929a6d 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
@@ -682,19 +682,20 @@ assertTarget(const vespalib::string &name,
TEST_F("require that flush targets can be retrieved", FastAccessFixture)
{
IFlushTarget::List targets = getFlushTargets(f);
- EXPECT_EQUAL(6u, targets.size());
+ EXPECT_EQUAL(7u, targets.size());
EXPECT_EQUAL("subdb.attribute.flush.attr1", targets[0]->getName());
EXPECT_EQUAL("subdb.attribute.shrink.attr1", targets[1]->getName());
EXPECT_EQUAL("subdb.documentmetastore.flush", targets[2]->getName());
EXPECT_EQUAL("subdb.documentmetastore.shrink", targets[3]->getName());
EXPECT_EQUAL("subdb.summary.compact", targets[4]->getName());
EXPECT_EQUAL("subdb.summary.flush", targets[5]->getName());
+ EXPECT_EQUAL("subdb.summary.shrink", targets[6]->getName());
}
TEST_F("require that flush targets can be retrieved", SearchableFixture)
{
IFlushTarget::List targets = getFlushTargets(f);
- EXPECT_EQUAL(8u, targets.size());
+ EXPECT_EQUAL(9u, 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.flush", FType::SYNC, FComponent::ATTRIBUTE, *targets[2]));
@@ -703,6 +704,7 @@ TEST_F("require that flush targets can be retrieved", SearchableFixture)
EXPECT_TRUE(assertTarget("subdb.memoryindex.fusion", FType::GC, FComponent::INDEX, *targets[5]));
EXPECT_TRUE(assertTarget("subdb.summary.compact", FType::GC, FComponent::DOCUMENT_STORE, *targets[6]));
EXPECT_TRUE(assertTarget("subdb.summary.flush", FType::SYNC, FComponent::DOCUMENT_STORE, *targets[7]));
+ EXPECT_TRUE(assertTarget("subdb.summary.shrink", FType::GC, FComponent::DOCUMENT_STORE, *targets[8]));
}
TEST_F("require that only fast-access attributes are instantiated", FastAccessOnlyFixture)
diff --git a/searchcore/src/tests/proton/documentdb/documentdb_test.cpp b/searchcore/src/tests/proton/documentdb/documentdb_test.cpp
index c191b7dc4b5..5b550f9c49d 100644
--- a/searchcore/src/tests/proton/documentdb/documentdb_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/documentdb_test.cpp
@@ -1,47 +1,48 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
+#include <tests/proton/common/dummydbowner.h>
#include <vespa/document/repo/documenttyperepo.h>
#include <vespa/messagebus/emptyreply.h>
#include <vespa/messagebus/testlib/receptor.h>
#include <vespa/searchcommon/common/schema.h>
#include <vespa/searchcore/proton/attribute/flushableattribute.h>
#include <vespa/searchcore/proton/common/feedtoken.h>
+#include <vespa/searchcore/proton/common/hw_info.h>
+#include <vespa/searchcore/proton/common/statusreport.h>
#include <vespa/searchcore/proton/docsummary/summaryflushtarget.h>
#include <vespa/searchcore/proton/documentmetastore/documentmetastoreflushtarget.h>
+#include <vespa/searchcore/proton/flushengine/shrink_lid_space_flush_target.h>
#include <vespa/searchcore/proton/flushengine/threadedflushtarget.h>
-#include <vespa/searchcore/proton/common/statusreport.h>
#include <vespa/searchcore/proton/matching/querylimiter.h>
+#include <vespa/searchcore/proton/metrics/job_tracked_flush_target.h>
+#include <vespa/searchcore/proton/metrics/metricswireservice.h>
+#include <vespa/searchcore/proton/reference/document_db_reference_registry.h>
+#include <vespa/searchcore/proton/reference/i_document_db_reference.h>
#include <vespa/searchcore/proton/server/bootstrapconfig.h>
#include <vespa/searchcore/proton/server/document_db_explorer.h>
#include <vespa/searchcore/proton/server/documentdb.h>
#include <vespa/searchcore/proton/server/documentdbconfigmanager.h>
#include <vespa/searchcore/proton/server/memoryconfigstore.h>
-#include <vespa/searchcore/proton/metrics/job_tracked_flush_target.h>
-#include <vespa/searchcore/proton/metrics/metricswireservice.h>
-#include <vespa/searchcore/proton/reference/document_db_reference_registry.h>
-#include <vespa/searchcore/proton/reference/i_document_db_reference.h>
#include <vespa/searchcorespi/index/indexflushtarget.h>
#include <vespa/searchlib/index/dummyfileheadercontext.h>
#include <vespa/searchlib/transactionlog/translogserver.h>
-#include <tests/proton/common/dummydbowner.h>
-#include <vespa/vespalib/testkit/test_kit.h>
-#include <vespa/searchcore/proton/common/hw_info.h>
#include <vespa/vespalib/data/slime/slime.h>
+#include <vespa/vespalib/testkit/test_kit.h>
using document::DocumentType;
using document::DocumentTypeRepo;
-using search::index::Schema;
-using search::transactionlog::TransLogServer;
+using document::DocumenttypesConfig;
+using namespace cloud::config::filedistribution;
using namespace proton;
using namespace vespalib::slime;
-using namespace cloud::config::filedistribution;
using search::TuneFileDocumentDB;
-using document::DocumenttypesConfig;
using search::index::DummyFileHeaderContext;
+using search::index::Schema;
+using search::transactionlog::TransLogServer;
+using searchcorespi::IFlushTarget;
using searchcorespi::index::IndexFlushTarget;
using vespa::config::search::core::ProtonConfig;
using vespalib::Slime;
-using searchcorespi::IFlushTarget;
namespace {
@@ -146,7 +147,7 @@ extractRealFlushTarget(const IFlushTarget *target)
}
TEST_F("requireThatIndexFlushTargetIsUsed", Fixture) {
- std::vector<IFlushTarget::SP> targets = f._db->getFlushTargets();
+ auto targets = f._db->getFlushTargets();
ASSERT_TRUE(!targets.empty());
const IndexFlushTarget *index = 0;
for (size_t i = 0; i < targets.size(); ++i) {
@@ -176,7 +177,7 @@ size_t getNumTargets(const std::vector<IFlushTarget::SP> & targets)
}
TEST_F("requireThatFlushTargetsAreNamedBySubDocumentDB", Fixture) {
- std::vector<IFlushTarget::SP> targets = f._db->getFlushTargets();
+ auto targets = f._db->getFlushTargets();
ASSERT_TRUE(!targets.empty());
for (const IFlushTarget::SP & target : f._db->getFlushTargets()) {
vespalib::string name = target->getName();
@@ -187,7 +188,7 @@ TEST_F("requireThatFlushTargetsAreNamedBySubDocumentDB", Fixture) {
}
TEST_F("requireThatAttributeFlushTargetsAreUsed", Fixture) {
- std::vector<IFlushTarget::SP> targets = f._db->getFlushTargets();
+ auto targets = f._db->getFlushTargets();
ASSERT_TRUE(!targets.empty());
size_t numAttrs = getNumTargets<FlushableAttribute>(targets);
// attr1 defined in attributes.cfg
@@ -195,21 +196,27 @@ TEST_F("requireThatAttributeFlushTargetsAreUsed", Fixture) {
}
TEST_F("requireThatDocumentMetaStoreFlushTargetIsUsed", Fixture) {
- std::vector<IFlushTarget::SP> targets = f._db->getFlushTargets();
+ auto targets = f._db->getFlushTargets();
ASSERT_TRUE(!targets.empty());
- size_t numMetaStores =
- getNumTargets<DocumentMetaStoreFlushTarget>(targets);
- // document meta store
+ size_t numMetaStores = getNumTargets<DocumentMetaStoreFlushTarget>(targets);
EXPECT_EQUAL(3u, numMetaStores);
}
TEST_F("requireThatSummaryFlushTargetsIsUsed", Fixture) {
- std::vector<IFlushTarget::SP> targets = f._db->getFlushTargets();
+ auto targets = f._db->getFlushTargets();
ASSERT_TRUE(!targets.empty());
size_t num = getNumTargets<SummaryFlushTarget>(targets);
EXPECT_EQUAL(3u, num);
}
+TEST_F("require that shrink lid space flush targets are created", Fixture) {
+ auto targets = f._db->getFlushTargets();
+ ASSERT_TRUE(!targets.empty());
+ size_t num = getNumTargets<ShrinkLidSpaceFlushTarget>(targets);
+ // 1x attribute, 3x document meta store, 3x document store
+ EXPECT_EQUAL(1u + 3u + 3u, num);
+}
+
TEST_F("requireThatCorrectStatusIsReported", Fixture) {
StatusReport::UP report(f._db->reportStatus());
EXPECT_EQUAL("documentdb:typea", report->getComponent());
diff --git a/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.cpp b/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.cpp
index a3282e9e3ec..67a02c5d3ee 100644
--- a/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.cpp
+++ b/searchcore/src/vespa/searchcore/proton/docsummary/summarymanager.cpp
@@ -4,10 +4,11 @@
#include "summarycompacttarget.h"
#include "summaryflushtarget.h"
#include "summarymanager.h"
-#include <vespa/searchlib/docstore/logdocumentstore.h>
-#include <vespa/searchsummary/docsummary/docsumconfig.h>
#include <vespa/config/print/ostreamconfigwriter.h>
#include <vespa/juniper/rpinterface.h>
+#include <vespa/searchcore/proton/flushengine/shrink_lid_space_flush_target.h>
+#include <vespa/searchlib/docstore/logdocumentstore.h>
+#include <vespa/searchsummary/docsummary/docsumconfig.h>
#include <vespa/vespalib/util/exceptions.h>
#include <vespa/log/log.h>
@@ -22,6 +23,7 @@ using namespace vespa::config::search;
using vespalib::make_string;
using vespalib::IllegalArgumentException;
using search::DocumentStore;
+using search::IDocumentStore;
using search::LogDocumentStore;
using search::LogDataStore;
using search::WriteableFileChunk;
@@ -171,13 +173,29 @@ SummaryManager::removeDocument(uint64_t syncToken, search::DocumentIdT lid)
_currentSerial = syncToken;
}
+namespace {
+
+IFlushTarget::SP
+createShrinkLidSpaceFlushTarget(IDocumentStore::SP docStore)
+{
+ return std::make_shared<ShrinkLidSpaceFlushTarget>("summary.shrink",
+ IFlushTarget::Type::GC,
+ IFlushTarget::Component::DOCUMENT_STORE,
+ docStore->lastSyncToken(),
+ docStore->getLastFlushTime(),
+ docStore);
+}
+
+}
+
IFlushTarget::List SummaryManager::getFlushTargets()
{
IFlushTarget::List ret;
- ret.push_back(IFlushTarget::SP(new SummaryFlushTarget(getBackingStore())));
+ ret.push_back(std::make_shared<SummaryFlushTarget>(getBackingStore()));
if (dynamic_cast<LogDocumentStore *>(_docStore.get()) != NULL) {
- ret.push_back(IFlushTarget::SP(new SummaryCompactTarget(getBackingStore())));
+ ret.push_back(std::make_shared<SummaryCompactTarget>(getBackingStore()));
}
+ ret.push_back(createShrinkLidSpaceFlushTarget(_docStore));
return ret;
}