From 9ce8b90851a655c814280ad8efca0e58bf739a6b Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Tue, 16 Nov 2021 09:20:31 +0000 Subject: Do not inherit Syncable. sync -> sync_all_executors to make its call sites more evident. --- .../tests/proton/documentdb/configurer/configurer_test.cpp | 2 +- .../documentdb/document_subdbs/document_subdbs_test.cpp | 10 +++++----- .../proton/documentdb/feedhandler/feedhandler_test.cpp | 2 +- .../src/tests/proton/documentdb/feedview/feedview_test.cpp | 6 +++--- .../storeonlyfeedview/storeonlyfeedview_test.cpp | 2 +- .../lidreusedelayer/lidreusedelayer_test.cpp | 2 +- searchcore/src/tests/proton/index/indexmanager_test.cpp | 2 +- .../src/vespa/searchcore/proton/server/documentdb.cpp | 14 +++++++------- .../searchcore/proton/server/executorthreadingservice.cpp | 5 ++--- .../searchcore/proton/server/executorthreadingservice.h | 2 +- .../searchcore/proton/server/fast_access_feed_view.cpp | 2 +- .../src/vespa/searchcore/proton/server/feedhandler.cpp | 2 +- .../vespa/searchcore/proton/server/searchabledocsubdb.cpp | 2 +- searchcore/src/vespa/searchcore/proton/test/thread_utils.h | 2 +- .../searchcore/proton/test/threading_service_observer.h | 4 ++-- .../src/vespa/searchcorespi/index/ithreadingservice.h | 5 +++-- 16 files changed, 32 insertions(+), 32 deletions(-) diff --git a/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp b/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp index e20c4268f88..b2acc8703f3 100644 --- a/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp +++ b/searchcore/src/tests/proton/documentdb/configurer/configurer_test.cpp @@ -287,7 +287,7 @@ struct FastAccessFixture vespalib::mkdir(BASE_DIR); } ~FastAccessFixture() { - _writeService.sync(); + _writeService.sync_all_executors(); } }; 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 5e42231d866..091292b3151 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 @@ -313,9 +313,9 @@ struct FixtureBase init(); } ~FixtureBase() { - _writeService.sync(); + _writeService.sync_all_executors(); _writeService.master().execute(makeLambdaTask([this]() { _subDb.close(); })); - _writeService.sync(); + _writeService.sync_all_executors(); } template void runInMaster(FunctionType func) { @@ -591,20 +591,20 @@ TEST_F("require that attribute compaction config reflect retirement", FastAccess auto calc = std::make_shared(); calc->setNodeRetired(true); f._subDb.setBucketStateCalculator(calc); - f._writeService.sync(); + f._writeService.sync_all_executors(); guard = f._subDb.getAttributeManager()->getAttribute("attr1"); EXPECT_EQUAL(retired_cfg, (*guard)->getConfig().getCompactionStrategy()); EXPECT_EQUAL(retired_cfg, dynamic_cast(f._subDb.getDocumentMetaStoreContext().get()).getConfig().getCompactionStrategy()); f.basicReconfig(10); - f._writeService.sync(); + f._writeService.sync_all_executors(); guard = f._subDb.getAttributeManager()->getAttribute("attr1"); EXPECT_EQUAL(retired_cfg, (*guard)->getConfig().getCompactionStrategy()); EXPECT_EQUAL(retired_cfg, dynamic_cast(f._subDb.getDocumentMetaStoreContext().get()).getConfig().getCompactionStrategy()); calc->setNodeRetired(false); f._subDb.setBucketStateCalculator(calc); - f._writeService.sync(); + f._writeService.sync_all_executors(); guard = f._subDb.getAttributeManager()->getAttribute("attr1"); EXPECT_EQUAL(default_cfg, (*guard)->getConfig().getCompactionStrategy()); EXPECT_EQUAL(default_cfg, dynamic_cast(f._subDb.getDocumentMetaStoreContext().get()).getConfig().getCompactionStrategy()); diff --git a/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp b/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp index 5384a985af0..977c899ab11 100644 --- a/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp +++ b/searchcore/src/tests/proton/documentdb/feedhandler/feedhandler_test.cpp @@ -455,7 +455,7 @@ struct FeedHandlerFixture } ~FeedHandlerFixture() { - writeService.sync(); + writeService.sync_all_executors(); } template inline void runAsMaster(FunctionType &&function) { diff --git a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp index 97faa81b48a..e53468e0dd4 100644 --- a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp +++ b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp @@ -516,11 +516,11 @@ struct FixtureBase } void syncIndex() { - _writeService.sync(); + _writeService.sync_all_executors(); } void sync() { - _writeServiceReal.sync(); + _writeServiceReal.sync_all_executors(); } const test::DocumentMetaStoreObserver &metaStoreObserver() { @@ -701,7 +701,7 @@ FixtureBase::FixtureBase() } FixtureBase::~FixtureBase() { - _writeServiceReal.sync(); + _writeServiceReal.sync_all_executors(); } void diff --git a/searchcore/src/tests/proton/documentdb/storeonlyfeedview/storeonlyfeedview_test.cpp b/searchcore/src/tests/proton/documentdb/storeonlyfeedview/storeonlyfeedview_test.cpp index 5146a16272a..eb398b9ee48 100644 --- a/searchcore/src/tests/proton/documentdb/storeonlyfeedview/storeonlyfeedview_test.cpp +++ b/searchcore/src/tests/proton/documentdb/storeonlyfeedview/storeonlyfeedview_test.cpp @@ -246,7 +246,7 @@ struct FixtureBase { void force_commit() { runInMaster([this] () { static_cast(*feedview).forceCommit(serial_num); }); - writeService.sync(); + writeService.sync_all_executors(); } }; diff --git a/searchcore/src/tests/proton/documentmetastore/lidreusedelayer/lidreusedelayer_test.cpp b/searchcore/src/tests/proton/documentmetastore/lidreusedelayer/lidreusedelayer_test.cpp index c49ec67f220..9162972a4cb 100644 --- a/searchcore/src/tests/proton/documentmetastore/lidreusedelayer/lidreusedelayer_test.cpp +++ b/searchcore/src/tests/proton/documentmetastore/lidreusedelayer/lidreusedelayer_test.cpp @@ -185,7 +185,7 @@ public: runInMaster([&] () { cycleLids(_lidReuseDelayer->getReuseLids()); }); } - void sync() { _writeService.sync(); } + void sync() { _writeService.sync_all_executors(); } }; diff --git a/searchcore/src/tests/proton/index/indexmanager_test.cpp b/searchcore/src/tests/proton/index/indexmanager_test.cpp index 4c442d38443..d34e2ae667e 100644 --- a/searchcore/src/tests/proton/index/indexmanager_test.cpp +++ b/searchcore/src/tests/proton/index/indexmanager_test.cpp @@ -128,7 +128,7 @@ struct IndexManagerTest : public ::testing::Test { { removeTestData(); vespalib::mkdir(index_dir, false); - _writeService.sync(); + _writeService.sync_all_executors(); resetIndexManager(); } diff --git a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp index 645c9b15f07..ccfdb3b9b36 100644 --- a/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/documentdb.cpp @@ -378,7 +378,7 @@ DocumentDB::enterOnlineState() // Called by executor thread // Ensure that all replayed operations are committed to memory structures _feedView.get()->forceCommit(CommitParam(_feedHandler->getSerialNum())); - _writeService.sync(); + _writeService.sync_all_executors(); (void) _state.enterOnlineState(); // Consider delayed pruning of transaction log and config history @@ -467,7 +467,7 @@ DocumentDB::applyConfig(DocumentDBConfig::SP configSnapshot, SerialNum serialNum // Flush changes to attributes and memory index, cf. visibilityDelay _feedView.get()->forceCommit(CommitParam(elidedConfigSave ? serialNum : serialNum - 1), std::make_shared>(std::move(commit_result))); - _writeService.sync(); + _writeService.sync_all_executors(); } if (params.shouldMaintenanceControllerChange()) { _maintenanceController.killJobs(); @@ -575,15 +575,15 @@ DocumentDB::close() // Caller should have removed document DB from feed router. _refCount.waitForZeroRefCount(); - _writeService.sync(); + _writeService.sync_all_executors(); // The attributes in the ready sub db is also the total set of attributes. DocumentDBTaggedMetrics &metrics = getMetrics(); _metricsWireService.cleanAttributes(metrics.ready.attributes); _metricsWireService.cleanAttributes(metrics.notReady.attributes); - _writeService.sync(); + _writeService.sync_all_executors(); masterExecute([this] () { closeSubDBs(); } ); - _writeService.sync(); + _writeService.sync_all_executors(); // What about queued tasks ? _writeService.shutdown(); _maintenanceController.kill(); @@ -920,7 +920,7 @@ DocumentDB::syncFeedView() IFeedView::SP newFeedView(_subDBs.getFeedView()); _maintenanceController.killJobs(); - _writeService.sync(); + _writeService.sync_all_executors(); _feedView.set(newFeedView); _feedHandler->setActiveFeedView(newFeedView.get()); @@ -994,7 +994,7 @@ void DocumentDB::stopMaintenance() { _maintenanceController.stop(); - _writeService.sync(); + _writeService.sync_all_executors(); } void diff --git a/searchcore/src/vespa/searchcore/proton/server/executorthreadingservice.cpp b/searchcore/src/vespa/searchcore/proton/server/executorthreadingservice.cpp index d35aaf9f909..0e9ba7a24c8 100644 --- a/searchcore/src/vespa/searchcore/proton/server/executorthreadingservice.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/executorthreadingservice.cpp @@ -88,13 +88,12 @@ ExecutorThreadingService::ExecutorThreadingService(vespalib::ThreadExecutor & sh ExecutorThreadingService::~ExecutorThreadingService() = default; -vespalib::Syncable & -ExecutorThreadingService::sync() { +void +ExecutorThreadingService::sync_all_executors() { // We have multiple patterns where task A posts to B which post back to A for (size_t i = 0; i < 2; i++) { syncOnce(); } - return *this; } void diff --git a/searchcore/src/vespa/searchcore/proton/server/executorthreadingservice.h b/searchcore/src/vespa/searchcore/proton/server/executorthreadingservice.h index 51da27586f7..611cf64aa9c 100644 --- a/searchcore/src/vespa/searchcore/proton/server/executorthreadingservice.h +++ b/searchcore/src/vespa/searchcore/proton/server/executorthreadingservice.h @@ -49,7 +49,7 @@ public: /** * Implements vespalib::Syncable */ - vespalib::Syncable &sync() override; + void sync_all_executors() override; void shutdown(); diff --git a/searchcore/src/vespa/searchcore/proton/server/fast_access_feed_view.cpp b/searchcore/src/vespa/searchcore/proton/server/fast_access_feed_view.cpp index ce7f1d70195..db2bb7ed2cb 100644 --- a/searchcore/src/vespa/searchcore/proton/server/fast_access_feed_view.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/fast_access_feed_view.cpp @@ -73,7 +73,7 @@ void FastAccessFeedView::handleCompactLidSpace(const CompactLidSpaceOperation &op) { // Drain pending PutDoneContext and ForceCommitContext objects - _writeService.sync(); + _writeService.sync_all_executors(); _docIdLimit.set(op.getLidLimit()); getAttributeWriter()->compactLidSpace(op.getLidLimit(), op.getSerialNum()); Parent::handleCompactLidSpace(op); diff --git a/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp b/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp index af746f9debb..c9294150f16 100644 --- a/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/feedhandler.cpp @@ -303,7 +303,7 @@ void FeedHandler::performEof() { assert(_writeService.master().isCurrentThread()); - _writeService.sync(); + _writeService.sync_all_executors(); LOG(debug, "Visiting done for transaction log domain '%s', eof received", _tlsMgr.getDomainName().c_str()); // Replay must be complete if (_replay_end_serial_num != _serialNum) { diff --git a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp index b512143c5fd..bf3589457f9 100644 --- a/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp +++ b/searchcore/src/vespa/searchcore/proton/server/searchabledocsubdb.cpp @@ -244,7 +244,7 @@ SearchableDocSubDB::reconfigure(std::unique_ptr configure) { assert(_writeService.master().isCurrentThread()); - _writeService.sync(); + _writeService.sync_all_executors(); // Everything should be quiet now. diff --git a/searchcore/src/vespa/searchcore/proton/test/thread_utils.h b/searchcore/src/vespa/searchcore/proton/test/thread_utils.h index 84b7c12cba6..6b08eecf61f 100644 --- a/searchcore/src/vespa/searchcore/proton/test/thread_utils.h +++ b/searchcore/src/vespa/searchcore/proton/test/thread_utils.h @@ -14,7 +14,7 @@ void runInMaster(searchcorespi::index::IThreadingService &writeService, FunctionType func) { writeService.master().execute(vespalib::makeLambdaTask(std::move(func))); - writeService.sync(); + writeService.sync_all_executors(); } } diff --git a/searchcore/src/vespa/searchcore/proton/test/threading_service_observer.h b/searchcore/src/vespa/searchcore/proton/test/threading_service_observer.h index 94b62962f04..14cd9f2dbfd 100644 --- a/searchcore/src/vespa/searchcore/proton/test/threading_service_observer.h +++ b/searchcore/src/vespa/searchcore/proton/test/threading_service_observer.h @@ -43,8 +43,8 @@ public: return _attributeFieldWriter; } - vespalib::Syncable &sync() override { - return _service.sync(); + void sync_all_executors() override { + return _service.sync_all_executors(); } searchcorespi::index::IThreadService &master() override { diff --git a/searchcorespi/src/vespa/searchcorespi/index/ithreadingservice.h b/searchcorespi/src/vespa/searchcorespi/index/ithreadingservice.h index be8c9ef7d86..f30aec94d53 100644 --- a/searchcorespi/src/vespa/searchcorespi/index/ithreadingservice.h +++ b/searchcorespi/src/vespa/searchcorespi/index/ithreadingservice.h @@ -2,7 +2,6 @@ #pragma once #include "i_thread_service.h" -#include namespace vespalib { class ISequencedTaskExecutor; } namespace searchcorespi::index { @@ -57,13 +56,15 @@ namespace searchcorespi::index { * TODO: * indexFieldInverter and indexFieldWriter can be collapsed to one. Both need sequencing, * but they sequence on different things so efficiency will be the same and just depends on #threads */ -struct IThreadingService : public vespalib::Syncable +struct IThreadingService { IThreadingService(const IThreadingService &) = delete; IThreadingService & operator = (const IThreadingService &) = delete; IThreadingService() = default; virtual ~IThreadingService() = default; + virtual void sync_all_executors() = 0; + virtual IThreadService &master() = 0; virtual IThreadService &index() = 0; virtual IThreadService &summary() = 0; -- cgit v1.2.3 From 76fda3f5d22820dea2c49cd0f12535a6efb29d1d Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Tue, 16 Nov 2021 10:50:29 +0000 Subject: Remove return keyword. --- .../src/vespa/searchcore/proton/test/threading_service_observer.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/searchcore/src/vespa/searchcore/proton/test/threading_service_observer.h b/searchcore/src/vespa/searchcore/proton/test/threading_service_observer.h index 14cd9f2dbfd..f1213d51296 100644 --- a/searchcore/src/vespa/searchcore/proton/test/threading_service_observer.h +++ b/searchcore/src/vespa/searchcore/proton/test/threading_service_observer.h @@ -44,7 +44,7 @@ public: } void sync_all_executors() override { - return _service.sync_all_executors(); + _service.sync_all_executors(); } searchcorespi::index::IThreadService &master() override { -- cgit v1.2.3