From f62b0dee3d9832e3a5e67a1f2002c63f25125fdb Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Thu, 21 Jan 2021 22:01:48 +0000 Subject: Decouple and cleanup. No semantic changes. --- .../lid_space_compaction/lid_space_compaction_test.cpp | 8 +++++++- .../maintenancecontroller_test.cpp | 1 + .../proton/feedoperation/compact_lid_space_operation.h | 13 +++++-------- .../searchcore/proton/feedoperation/moveoperation.h | 9 ++++----- .../src/vespa/searchcore/proton/server/bucketmovejob.h | 2 +- .../searchcore/proton/server/documentbucketmover.h | 1 - .../proton/server/i_disk_mem_usage_notifier.h | 5 ++--- .../proton/server/i_lid_space_compaction_handler.h | 15 ++++++++------- .../proton/server/iclusterstatechangednotifier.h | 14 +++++--------- .../searchcore/proton/server/ifrozenbuckethandler.h | 9 +++------ .../proton/server/lid_space_compaction_handler.cpp | 17 ++++++++++++++--- .../proton/server/lid_space_compaction_handler.h | 13 ++++++------- .../proton/server/lid_space_compaction_job.cpp | 4 ++++ .../searchcore/proton/server/lid_space_compaction_job.h | 2 +- .../tests/distributor/btree_bucket_database_test.cpp | 2 +- storage/src/tests/distributor/bucketdatabasetest.cpp | 1 + 16 files changed, 63 insertions(+), 53 deletions(-) diff --git a/searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_compaction_test.cpp b/searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_compaction_test.cpp index 1e8e10d3dfa..c7239eaba16 100644 --- a/searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_compaction_test.cpp +++ b/searchcore/src/tests/proton/documentdb/lid_space_compaction/lid_space_compaction_test.cpp @@ -1,10 +1,16 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -#include +#include #include #include #include #include +#include +#include +#include +#include +#include +#include #include #include #include diff --git a/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp b/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp index 42ebcd8df90..8ed382087d8 100644 --- a/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp +++ b/searchcore/src/tests/proton/documentdb/maintenancecontroller/maintenancecontroller_test.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/compact_lid_space_operation.h b/searchcore/src/vespa/searchcore/proton/feedoperation/compact_lid_space_operation.h index 9722894b160..bfbd98482ca 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/compact_lid_space_operation.h +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/compact_lid_space_operation.h @@ -14,17 +14,14 @@ private: public: CompactLidSpaceOperation(); CompactLidSpaceOperation(uint32_t subDbId, uint32_t lidLimit); - virtual ~CompactLidSpaceOperation() {} + ~CompactLidSpaceOperation() override = default; uint32_t getSubDbId() const { return _subDbId; } uint32_t getLidLimit() const { return _lidLimit; } - // Implements FeedOperation - virtual void serialize(vespalib::nbostream &os) const override; - virtual void deserialize(vespalib::nbostream &is, - const document::DocumentTypeRepo &) override; - virtual vespalib::string toString() const override; + void serialize(vespalib::nbostream &os) const override; + void deserialize(vespalib::nbostream &is, const document::DocumentTypeRepo &) override; + vespalib::string toString() const override; }; -} // namespace proton - +} diff --git a/searchcore/src/vespa/searchcore/proton/feedoperation/moveoperation.h b/searchcore/src/vespa/searchcore/proton/feedoperation/moveoperation.h index 7ec40e8418f..b21ad6af9de 100644 --- a/searchcore/src/vespa/searchcore/proton/feedoperation/moveoperation.h +++ b/searchcore/src/vespa/searchcore/proton/feedoperation/moveoperation.h @@ -19,17 +19,16 @@ public: const DocumentSP &doc, DbDocumentId sourceDbdId, uint32_t targetSubDbId); - virtual ~MoveOperation(); + ~MoveOperation() override; const DocumentSP &getDocument() const { return _doc; } DbDocumentId getSourceDbdId() const { return getPrevDbDocumentId(); } DbDocumentId getTargetDbdId() const { return getDbDocumentId(); } void setTargetLid(search::DocumentIdT lid) { setDbDocumentId(DbDocumentId(getSubDbId(), lid)); } - virtual void serialize(vespalib::nbostream &os) const override; - virtual void deserialize(vespalib::nbostream &is, - const document::DocumentTypeRepo &repo) override; - virtual vespalib::string toString() const override; + void serialize(vespalib::nbostream &os) const override; + void deserialize(vespalib::nbostream &is, const document::DocumentTypeRepo &repo) override; + vespalib::string toString() const override; }; } // namespace proton diff --git a/searchcore/src/vespa/searchcore/proton/server/bucketmovejob.h b/searchcore/src/vespa/searchcore/proton/server/bucketmovejob.h index 015a779b923..e462b8ac7c6 100644 --- a/searchcore/src/vespa/searchcore/proton/server/bucketmovejob.h +++ b/searchcore/src/vespa/searchcore/proton/server/bucketmovejob.h @@ -176,7 +176,7 @@ public: // IBucketStateChangedHandler API void notifyBucketStateChanged(const document::BucketId &bucketId, - storage::spi::BucketInfo::ActiveState newState) override; + storage::spi::BucketInfo::ActiveState newState) override; void notifyDiskMemUsage(DiskMemUsageState state) override; diff --git a/searchcore/src/vespa/searchcore/proton/server/documentbucketmover.h b/searchcore/src/vespa/searchcore/proton/server/documentbucketmover.h index 53a2bdd2e4f..eded3a456d8 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentbucketmover.h +++ b/searchcore/src/vespa/searchcore/proton/server/documentbucketmover.h @@ -6,7 +6,6 @@ #include #include #include -#include "ifrozenbuckethandler.h" namespace proton { diff --git a/searchcore/src/vespa/searchcore/proton/server/i_disk_mem_usage_notifier.h b/searchcore/src/vespa/searchcore/proton/server/i_disk_mem_usage_notifier.h index ef3b5c8fa48..99de2cbd083 100644 --- a/searchcore/src/vespa/searchcore/proton/server/i_disk_mem_usage_notifier.h +++ b/searchcore/src/vespa/searchcore/proton/server/i_disk_mem_usage_notifier.h @@ -2,8 +2,7 @@ #pragma once -namespace proton -{ +namespace proton { class IDiskMemUsageListener; @@ -14,7 +13,7 @@ class IDiskMemUsageListener; class IDiskMemUsageNotifier { public: - virtual ~IDiskMemUsageNotifier() {} + virtual ~IDiskMemUsageNotifier() = default; virtual void addDiskMemUsageListener(IDiskMemUsageListener *listener) = 0; virtual void removeDiskMemUsageListener(IDiskMemUsageListener *listener) = 0; }; diff --git a/searchcore/src/vespa/searchcore/proton/server/i_lid_space_compaction_handler.h b/searchcore/src/vespa/searchcore/proton/server/i_lid_space_compaction_handler.h index afc1a4a0a7f..3e1e4aaa88a 100644 --- a/searchcore/src/vespa/searchcore/proton/server/i_lid_space_compaction_handler.h +++ b/searchcore/src/vespa/searchcore/proton/server/i_lid_space_compaction_handler.h @@ -2,18 +2,19 @@ #pragma once -#include "i_document_scan_iterator.h" -#include "ifrozenbuckethandler.h" -#include -#include #include +#include namespace vespalib { class IDestructorCallback; } - +namespace search { class DocumentMetaData; } namespace proton::documentmetastore { class OperationListener; } namespace proton { +class MoveOperation; +class CompactLidSpaceOperation; +class IDocumentScanIterator; + /** * Interface for handling of lid space compaction, used by a LidSpaceCompactionJob. * @@ -51,12 +52,12 @@ struct ILidSpaceCompactionHandler /** * Returns an iterator for scanning documents. */ - virtual IDocumentScanIterator::UP getIterator() const = 0; + virtual std::unique_ptr getIterator() const = 0; /** * Creates a move operation for moving the given document to the given lid. */ - virtual MoveOperation::UP createMoveOperation(const search::DocumentMetaData &document, uint32_t moveToLid) const = 0; + virtual std::unique_ptr createMoveOperation(const search::DocumentMetaData &document, uint32_t moveToLid) const = 0; /** * Performs the actual move operation. diff --git a/searchcore/src/vespa/searchcore/proton/server/iclusterstatechangednotifier.h b/searchcore/src/vespa/searchcore/proton/server/iclusterstatechangednotifier.h index 04c1d8f5c97..09cbe5454cd 100644 --- a/searchcore/src/vespa/searchcore/proton/server/iclusterstatechangednotifier.h +++ b/searchcore/src/vespa/searchcore/proton/server/iclusterstatechangednotifier.h @@ -2,8 +2,7 @@ #pragma once -namespace proton -{ +namespace proton { class IClusterStateChangedHandler; @@ -13,13 +12,10 @@ class IClusterStateChangedHandler; class IClusterStateChangedNotifier { public: - virtual ~IClusterStateChangedNotifier() { } - - virtual void - addClusterStateChangedHandler(IClusterStateChangedHandler *handler) = 0; + virtual ~IClusterStateChangedNotifier() = default; - virtual void - removeClusterStateChangedHandler(IClusterStateChangedHandler *handler) = 0; + virtual void addClusterStateChangedHandler(IClusterStateChangedHandler *handler) = 0; + virtual void removeClusterStateChangedHandler(IClusterStateChangedHandler *handler) = 0; }; -} // namespace proton +} diff --git a/searchcore/src/vespa/searchcore/proton/server/ifrozenbuckethandler.h b/searchcore/src/vespa/searchcore/proton/server/ifrozenbuckethandler.h index 2c2d92c9f42..7729b888d4f 100644 --- a/searchcore/src/vespa/searchcore/proton/server/ifrozenbuckethandler.h +++ b/searchcore/src/vespa/searchcore/proton/server/ifrozenbuckethandler.h @@ -4,8 +4,7 @@ #include -namespace proton -{ +namespace proton { class IBucketFreezeListener; @@ -22,12 +21,10 @@ public: document::BucketId _bucketId; }; - virtual ~IFrozenBucketHandler() { } + virtual ~IFrozenBucketHandler() = default; virtual ExclusiveBucketGuard::UP acquireExclusiveBucket(document::BucketId bucket) = 0; virtual void addListener(IBucketFreezeListener *listener) = 0; virtual void removeListener(IBucketFreezeListener *listener) = 0; }; - -} // namespace proton - +} diff --git a/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_handler.cpp b/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_handler.cpp index c534c1a3f62..7f33fc21180 100644 --- a/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_handler.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_handler.cpp @@ -3,10 +3,11 @@ #include "document_scan_iterator.h" #include "ifeedview.h" #include "lid_space_compaction_handler.h" -#include -#include -#include +#include "maintenancedocumentsubdb.h" +#include +#include #include +#include #include using document::BucketId; @@ -26,6 +27,16 @@ LidSpaceCompactionHandler::LidSpaceCompactionHandler(const MaintenanceDocumentSu LidSpaceCompactionHandler::~LidSpaceCompactionHandler() = default; +vespalib::string +LidSpaceCompactionHandler::getName() const { + return _docTypeName + "." + _subDb.name(); +} + +uint32_t +LidSpaceCompactionHandler::getSubDbId() const { + return _subDb.sub_db_id(); +} + void LidSpaceCompactionHandler::set_operation_listener(documentmetastore::OperationListener::SP op_listener) { diff --git a/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_handler.h b/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_handler.h index 1a25f56a990..d58a14e7f62 100644 --- a/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_handler.h +++ b/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_handler.h @@ -2,10 +2,11 @@ #pragma once #include "i_lid_space_compaction_handler.h" -#include "maintenancedocumentsubdb.h" namespace proton { +class MaintenanceDocumentSubDB; + /** * Class that handles lid space compaction over a single document sub db. */ @@ -20,14 +21,12 @@ public: const vespalib::string& docTypeName); ~LidSpaceCompactionHandler() override; - vespalib::string getName() const override { - return _docTypeName + "." + _subDb.name(); - } + vespalib::string getName() const override; void set_operation_listener(std::shared_ptr op_listener) override; - uint32_t getSubDbId() const override { return _subDb.sub_db_id(); } + uint32_t getSubDbId() const override; search::LidUsageStats getLidStatus() const override; - IDocumentScanIterator::UP getIterator() const override; - MoveOperation::UP createMoveOperation(const search::DocumentMetaData &document, uint32_t moveToLid) const override; + std::unique_ptr getIterator() const override; + std::unique_ptr createMoveOperation(const search::DocumentMetaData &document, uint32_t moveToLid) const override; void handleMove(const MoveOperation &op, std::shared_ptr doneCtx) override; void handleCompactLidSpace(const CompactLidSpaceOperation &op, std::shared_ptr compact_done_context) override; }; diff --git a/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_job.cpp b/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_job.cpp index 1165c8e345e..228c1e4355e 100644 --- a/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_job.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_job.cpp @@ -4,6 +4,10 @@ #include "iclusterstatechangednotifier.h" #include "imaintenancejobrunner.h" #include "lid_space_compaction_job.h" +#include "i_document_scan_iterator.h" +#include "ifrozenbuckethandler.h" +#include +#include #include #include #include diff --git a/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_job.h b/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_job.h index ea92d6ef915..e9d5de58323 100644 --- a/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_job.h +++ b/searchcore/src/vespa/searchcore/proton/server/lid_space_compaction_job.h @@ -33,7 +33,7 @@ private: ILidSpaceCompactionHandler &_handler; IOperationStorer &_opStorer; IFrozenBucketHandler &_frozenHandler; - IDocumentScanIterator::UP _scanItr; + std::unique_ptr _scanItr; bool _retryFrozenDocument; bool _shouldCompactLidSpace; IDiskMemUsageNotifier &_diskMemUsageNotifier; diff --git a/storage/src/tests/distributor/btree_bucket_database_test.cpp b/storage/src/tests/distributor/btree_bucket_database_test.cpp index 5283cc39da8..fdc1d7566ab 100644 --- a/storage/src/tests/distributor/btree_bucket_database_test.cpp +++ b/storage/src/tests/distributor/btree_bucket_database_test.cpp @@ -1,7 +1,7 @@ // Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +#include "bucketdatabasetest.h" #include -#include #include #include diff --git a/storage/src/tests/distributor/bucketdatabasetest.cpp b/storage/src/tests/distributor/bucketdatabasetest.cpp index 6aadc6c01e1..48c1d45b6ed 100644 --- a/storage/src/tests/distributor/bucketdatabasetest.cpp +++ b/storage/src/tests/distributor/bucketdatabasetest.cpp @@ -1,4 +1,5 @@ // Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + #include "bucketdatabasetest.h" #include #include -- cgit v1.2.3