aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/tests
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2021-11-30 07:30:09 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2021-11-30 07:50:44 +0000
commitdd67bb4a5b7b5ca609f32b6a0255db4ccc4abe6f (patch)
tree74c1f24d130f652974fd80a6759cd4558fd82b5e /searchcore/src/tests
parenta1e0f60a68c8e5af9c3057ef6b1248043cdcaa08 (diff)
Wire in OnDoneCallback in handleLidSpaceCompaction to avoid brute force sync_all_executors.
Diffstat (limited to 'searchcore/src/tests')
-rw-r--r--searchcore/src/tests/proton/documentdb/combiningfeedview/combiningfeedview_test.cpp4
-rw-r--r--searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp30
2 files changed, 22 insertions, 12 deletions
diff --git a/searchcore/src/tests/proton/documentdb/combiningfeedview/combiningfeedview_test.cpp b/searchcore/src/tests/proton/documentdb/combiningfeedview/combiningfeedview_test.cpp
index 5ef02f60152..db20181eae7 100644
--- a/searchcore/src/tests/proton/documentdb/combiningfeedview/combiningfeedview_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/combiningfeedview/combiningfeedview_test.cpp
@@ -87,7 +87,7 @@ struct MyFeedView : public test::DummyFeedView
void handleMove(const MoveOperation &, IDestructorCallback::SP) override { ++_handleMove; }
void heartBeat(SerialNum) override { ++_heartBeat; }
void handlePruneRemovedDocuments(const PruneRemovedDocumentsOperation &) override { ++_handlePrune; }
- void handleCompactLidSpace(const CompactLidSpaceOperation &op) override {
+ void handleCompactLidSpace(const CompactLidSpaceOperation &op, DoneCallback) override {
_wantedLidLimit = op.getLidLimit();
}
};
@@ -429,7 +429,7 @@ TEST_F("require that calculator can be updated", Fixture)
TEST_F("require that compactLidSpace() is sent to correct feed view", Fixture)
{
- f._view.handleCompactLidSpace(CompactLidSpaceOperation(1, 99));
+ f._view.handleCompactLidSpace(CompactLidSpaceOperation(1, 99), IDestructorCallback::SP());
EXPECT_EQUAL(0u, f._ready._view->_wantedLidLimit);
EXPECT_EQUAL(99u, f._removed._view->_wantedLidLimit);
EXPECT_EQUAL(0u, f._notReady._view->_wantedLidLimit);
diff --git a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp
index d3bbcda78f7..6c45470bb42 100644
--- a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp
@@ -38,6 +38,8 @@ using search::AttributeVector;
using search::CacheStats;
using search::DocumentMetaData;
using vespalib::IDestructorCallback;
+using vespalib::Gate;
+using vespalib::GateCallback;
using search::SearchableStats;
using search::index::schema::CollectionType;
using search::index::schema::DataType;
@@ -404,7 +406,7 @@ MyAttributeWriter::~MyAttributeWriter() = default;
struct MyTransport : public feedtoken::ITransport
{
ResultUP lastResult;
- vespalib::Gate _gate;
+ Gate _gate;
MyTracer &_tracer;
MyTransport(MyTracer &tracer);
~MyTransport();
@@ -610,8 +612,8 @@ struct FixtureBase
void moveAndWait(const DocumentContext &docCtx, uint32_t fromLid, uint32_t toLid) {
MoveOperation op(docCtx.bid, docCtx.ts, docCtx.doc, DbDocumentId(pc._params._subDbId, fromLid), pc._params._subDbId);
op.setTargetLid(toLid);
- vespalib::Gate gate;
- runInMaster([&, onDone=std::make_shared<vespalib::GateCallback>(gate)]() { performMove(op, std::move(onDone)); });
+ Gate gate;
+ runInMaster([&, onDone=std::make_shared<GateCallback>(gate)]() { performMove(op, std::move(onDone)); });
gate.await();
}
@@ -621,12 +623,12 @@ struct FixtureBase
getFeedView().handleDeleteBucket(op);
}
- void performForceCommit(vespalib::IDestructorCallback::SP onDone) {
+ void performForceCommit(IDestructorCallback::SP onDone) {
getFeedView().forceCommit(serial, std::move(onDone));
}
void forceCommitAndWait() {
- vespalib::Gate gate;
- runInMaster([this, onDone=std::make_shared<vespalib::GateCallback>(gate)]() {
+ Gate gate;
+ runInMaster([this, onDone=std::make_shared<GateCallback>(gate)]() {
performForceCommit(std::move(onDone));
});
gate.await();
@@ -650,14 +652,18 @@ struct FixtureBase
return docs;
}
- void performCompactLidSpace(uint32_t wantedLidLimit) {
+ void performCompactLidSpace(uint32_t wantedLidLimit, IDestructorCallback::SP onDone) {
auto &fv = getFeedView();
CompactLidSpaceOperation op(0, wantedLidLimit);
op.setSerialNum(++serial);
- fv.handleCompactLidSpace(op);
+ fv.handleCompactLidSpace(op, std::move(onDone));
}
void compactLidSpaceAndWait(uint32_t wantedLidLimit) {
- runInMasterAndSyncAll([&]() { performCompactLidSpace(wantedLidLimit); });
+ Gate gate;
+ runInMaster([&]() {
+ performCompactLidSpace(wantedLidLimit, std::make_shared<GateCallback>(gate));
+ });
+ gate.await();
}
void assertChangeHandler(document::GlobalId expGid, uint32_t expLid, uint32_t expChanges) {
_gidToLidChangeHandler->assertChanges(expGid, expLid, expChanges);
@@ -1159,7 +1165,11 @@ TEST_F("require that compactLidSpace() doesn't propagate to "
EXPECT_TRUE(assertThreadObserver(5, 4, 4, f.writeServiceObserver()));
CompactLidSpaceOperation op(0, 2);
op.setSerialNum(0);
- f.runInMasterAndSyncAll([&]() { f.fv.handleCompactLidSpace(op); });
+ Gate gate;
+ f.runInMaster([&, onDone=std::make_shared<GateCallback>(gate)]() {
+ f.fv.handleCompactLidSpace(op, std::move(onDone));
+ });
+ gate.await();
// Delayed holdUnblockShrinkLidSpace() in index thread, then master thread
EXPECT_TRUE(assertThreadObserver(6, 6, 5, f.writeServiceObserver()));
EXPECT_EQUAL(0u, f.metaStoreObserver()._compactLidSpaceLidLimit);