From 9625a5148b8c2da60b0f54d2ce05980dfc7fccb5 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Sun, 21 Nov 2021 17:12:08 +0000 Subject: GC some unused code and less sync_all_executors. --- .../document_subdbs/document_subdbs_test.cpp | 4 +--- .../proton/documentdb/feedview/feedview_test.cpp | 19 ---------------- .../lidreusedelayer/lidreusedelayer_test.cpp | 3 --- .../src/tests/proton/index/indexmanager_test.cpp | 26 +++++++++++++--------- 4 files changed, 17 insertions(+), 35 deletions(-) (limited to 'searchcore') 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 17eb0ffc147..6733fbf3267 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 @@ -353,9 +353,7 @@ struct FixtureBase } _subDb.onReprocessDone(serialNum); } - void sync() { - _writeService.master().sync(); - } + proton::IAttributeManager::SP getAttributeManager() { return _subDb.getAttributeManager(); } diff --git a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp index cf3dfec771a..8c9d36d665d 100644 --- a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp +++ b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp @@ -418,16 +418,6 @@ struct MyTransport : public feedtoken::ITransport MyTransport::MyTransport(MyTracer &tracer) : lastResult(), _gate(), _tracer(tracer) {} MyTransport::~MyTransport() = default; -struct MyResultHandler : public IGenericResultHandler -{ - vespalib::Gate _gate; - MyResultHandler() : _gate() {} - void handle(const storage::spi::Result &) override { - _gate.countDown(); - } - void await() { _gate.await(); } -}; - struct SchemaContext { Schema::SP _schema; @@ -450,7 +440,6 @@ SchemaContext::SchemaContext() : } SchemaContext::~SchemaContext() = default; - struct DocumentContext { Document::SP doc; @@ -514,14 +503,6 @@ struct FixtureBase virtual ~FixtureBase(); - void syncMaster() { - _writeService.master().sync(); - } - - void sync() { - _writeServiceReal.sync_all_executors(); - } - const test::DocumentMetaStoreObserver &metaStoreObserver() { return _dmsc->getObserver(); } diff --git a/searchcore/src/tests/proton/documentmetastore/lidreusedelayer/lidreusedelayer_test.cpp b/searchcore/src/tests/proton/documentmetastore/lidreusedelayer/lidreusedelayer_test.cpp index 33b58e32669..00b4eb7ad7e 100644 --- a/searchcore/src/tests/proton/documentmetastore/lidreusedelayer/lidreusedelayer_test.cpp +++ b/searchcore/src/tests/proton/documentmetastore/lidreusedelayer/lidreusedelayer_test.cpp @@ -165,9 +165,6 @@ public: void commit() { runInMaster([&] () { cycleLids(_lidReuseDelayer->getReuseLids()); }); } - - void sync() { _writeService.sync_all_executors(); } - }; TEST_F("require that nothing happens before free list is active", Fixture) diff --git a/searchcore/src/tests/proton/index/indexmanager_test.cpp b/searchcore/src/tests/proton/index/indexmanager_test.cpp index d34e2ae667e..d6bbc77aa09 100644 --- a/searchcore/src/tests/proton/index/indexmanager_test.cpp +++ b/searchcore/src/tests/proton/index/indexmanager_test.cpp @@ -104,8 +104,6 @@ void push_documents_and_wait(search::memoryindex::DocumentInverter &inverter) { gate.await(); } -std::shared_ptr emptyDestructorCallback; - struct IndexManagerTest : public ::testing::Test { SerialNum _serial_num; IndexManagerDummyReconfigurer _reconfigurer; @@ -128,7 +126,6 @@ struct IndexManagerTest : public ::testing::Test { { removeTestData(); vespalib::mkdir(index_dir, false); - _writeService.sync_all_executors(); resetIndexManager(); } @@ -138,22 +135,31 @@ struct IndexManagerTest : public ::testing::Test { template inline void runAsMaster(FunctionType &&function) { - _writeService.master().execute(makeLambdaTask(std::move(function))); - _writeService.master().sync(); + vespalib::Gate gate; + _writeService.master().execute(makeLambdaTask([&gate,function = std::move(function)]() { + function(); + gate.countDown(); + })); + gate.await(); } template inline void runAsIndex(FunctionType &&function) { - _writeService.index().execute(makeLambdaTask(std::move(function))); - _writeService.index().sync(); + vespalib::Gate gate; + _writeService.index().execute(makeLambdaTask([&gate,function = std::move(function)]() { + function(); + gate.countDown(); + })); + gate.await(); } void flushIndexManager(); Document::UP addDocument(uint32_t docid); void resetIndexManager(); void removeDocument(uint32_t docId, SerialNum serialNum) { vespalib::Gate gate; - runAsIndex([&]() { _index_manager->removeDocument(docId, serialNum); - _index_manager->commit(serialNum, std::make_shared(gate)); - }); + runAsIndex([&]() { + _index_manager->removeDocument(docId, serialNum); + _index_manager->commit(serialNum, std::make_shared(gate)); + }); gate.await(); } void removeDocument(uint32_t docId) { -- cgit v1.2.3