aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/tests
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2021-11-21 17:12:08 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2021-11-21 17:12:08 +0000
commit9625a5148b8c2da60b0f54d2ce05980dfc7fccb5 (patch)
treea8fc1292355f17740fb80e410bf7dba7024ba10d /searchcore/src/tests
parent4ef7a7d4946cc944c7a95c0524717a000e1e983e (diff)
GC some unused code and less sync_all_executors.
Diffstat (limited to 'searchcore/src/tests')
-rw-r--r--searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp4
-rw-r--r--searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp19
-rw-r--r--searchcore/src/tests/proton/documentmetastore/lidreusedelayer/lidreusedelayer_test.cpp3
-rw-r--r--searchcore/src/tests/proton/index/indexmanager_test.cpp26
4 files changed, 17 insertions, 35 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 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<vespalib::IDestructorCallback> 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 <class FunctionType>
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 <class FunctionType>
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<vespalib::GateCallback>(gate));
- });
+ runAsIndex([&]() {
+ _index_manager->removeDocument(docId, serialNum);
+ _index_manager->commit(serialNum, std::make_shared<vespalib::GateCallback>(gate));
+ });
gate.await();
}
void removeDocument(uint32_t docId) {