aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2021-11-22 08:38:27 +0100
committerGitHub <noreply@github.com>2021-11-22 08:38:27 +0100
commit7226465dfa8487cd507df1246b061f6a34283691 (patch)
tree8ecf759cb7dc44fc5e2b13cf0d51ce0390db1085
parentf4a3bc3279e6b539891def82fa7922007493340c (diff)
parent041aa273656e26248393523808a4040407c911b9 (diff)
Merge pull request #20137 from vespa-engine/balder/cleanup-and-less-sync_all_executors-2
Follow renaming
-rw-r--r--searchcore/src/tests/proton/documentdb/document_subdbs/document_subdbs_test.cpp20
-rw-r--r--searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp20
-rw-r--r--searchcore/src/tests/proton/documentdb/storeonlyfeedview/storeonlyfeedview_test.cpp36
-rw-r--r--searchcore/src/tests/proton/documentmetastore/lidreusedelayer/lidreusedelayer_test.cpp8
4 files changed, 44 insertions, 40 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 1ae5a4ad24b..27ee7dee3e9 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
@@ -318,7 +318,7 @@ struct FixtureBase
_writeService.sync_all_executors();
}
template <typename FunctionType>
- void runInMaster(FunctionType func) {
+ void runInMasterAndSync(FunctionType func) {
proton::test::runInMasterAndSync(_writeService, func);
}
void init() {
@@ -328,13 +328,13 @@ struct FixtureBase
initializer::TaskRunner taskRunner(executor);
taskRunner.runTask(task);
auto sessionMgr = std::make_shared<SessionManager>(1);
- runInMaster([&] () { _subDb.initViews(*_snapshot->_cfg, sessionMgr); });
+ runInMasterAndSync([&]() { _subDb.initViews(*_snapshot->_cfg, sessionMgr); });
}
void basicReconfig(SerialNum serialNum) {
- runInMaster([&] () { performReconfig(serialNum, TwoAttrSchema(), ConfigDir2::dir()); });
+ runInMasterAndSync([&]() { performReconfig(serialNum, TwoAttrSchema(), ConfigDir2::dir()); });
}
void reconfig(SerialNum serialNum, const Schema &reconfigSchema, const vespalib::string &reconfigConfigDir) {
- runInMaster([&] () { performReconfig(serialNum, reconfigSchema, reconfigConfigDir); });
+ runInMasterAndSync([&]() { performReconfig(serialNum, reconfigSchema, reconfigConfigDir); });
}
void performReconfig(SerialNum serialNum, const Schema &reconfigSchema, const vespalib::string &reconfigConfigDir) {
MyConfigSnapshot::UP newCfg(new MyConfigSnapshot(reconfigSchema, reconfigConfigDir));
@@ -782,32 +782,32 @@ struct DocumentHandler
void putDoc(PutOperation &op) {
IFeedView::SP feedView = _f._subDb.getFeedView();
vespalib::Gate gate;
- _f.runInMaster([&]() {
+ _f.runInMasterAndSync([&]() {
feedView->preparePut(op);
feedView->handlePut(FeedToken(), op);
feedView->forceCommit(CommitParam(op.getSerialNum()), std::make_shared<vespalib::GateCallback>(gate));
- } );
+ });
gate.await();
}
void moveDoc(MoveOperation &op) {
IFeedView::SP feedView = _f._subDb.getFeedView();
vespalib::Gate gate;
- _f.runInMaster([&]() {
+ _f.runInMasterAndSync([&]() {
auto onDone = std::make_shared<vespalib::GateCallback>(gate);
feedView->handleMove(op, onDone);
feedView->forceCommit(CommitParam(op.getSerialNum()), onDone);
- } );
+ });
gate.await();
}
void removeDoc(RemoveOperation &op)
{
IFeedView::SP feedView = _f._subDb.getFeedView();
vespalib::Gate gate;
- _f.runInMaster([&]() {
+ _f.runInMasterAndSync([&]() {
feedView->prepareRemove(op);
feedView->handleRemove(FeedToken(), op);
feedView->forceCommit(CommitParam(op.getSerialNum()), std::make_shared<vespalib::GateCallback>(gate));
- } );
+ });
gate.await();
}
void putDocs() {
diff --git a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp
index f53b50c487d..54772f353d0 100644
--- a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp
@@ -512,7 +512,7 @@ struct FixtureBase
}
template <typename FunctionType>
- void runInMaster(FunctionType func) {
+ void runInMasterAndSync(FunctionType func) {
test::runInMasterAndSync(_writeService, func);
}
@@ -558,7 +558,7 @@ struct FixtureBase
void putAndWait(const DocumentContext &docCtx) {
FeedTokenContext token(_tracer);
PutOperation op(docCtx.bid, docCtx.ts, docCtx.doc);
- runInMaster([this, ft=std::move(token.ft), &op] () mutable { performPut(std::move(ft), op); });
+ runInMasterAndSync([this, ft = std::move(token.ft), &op]() mutable { performPut(std::move(ft), op); });
token.mt.await();
}
@@ -571,7 +571,7 @@ struct FixtureBase
void updateAndWait(const DocumentContext &docCtx) {
FeedTokenContext token(_tracer);
UpdateOperation op(docCtx.bid, docCtx.ts, docCtx.upd);
- runInMaster([this, ft=std::move(token.ft), &op] () mutable { performUpdate(std::move(ft), op); });
+ runInMasterAndSync([this, ft = std::move(token.ft), &op]() mutable { performUpdate(std::move(ft), op); });
token.mt.await();
}
@@ -586,7 +586,7 @@ struct FixtureBase
void removeAndWait(const DocumentContext &docCtx) {
FeedTokenContext token(_tracer);
RemoveOperationWithDocId op(docCtx.bid, docCtx.ts, docCtx.doc->getId());
- runInMaster([this, ft=std::move(token.ft), &op] () mutable { performRemove(std::move(ft), op); });
+ runInMasterAndSync([this, ft = std::move(token.ft), &op]() mutable { performRemove(std::move(ft), op); });
token.mt.await();
}
@@ -604,7 +604,7 @@ 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);
- runInMaster([&]() { performMove(op); });
+ runInMasterAndSync([&]() { performMove(op); });
}
void performDeleteBucket(DeleteBucketOperation &op) {
@@ -615,7 +615,7 @@ struct FixtureBase
void performForceCommit() { getFeedView().forceCommit(serial); }
void forceCommitAndWait() {
- runInMaster([&]() { performForceCommit(); });
+ runInMasterAndSync([&]() { performForceCommit(); });
}
bool assertTrace(const vespalib::string &exp) {
@@ -642,7 +642,7 @@ struct FixtureBase
fv.handleCompactLidSpace(op);
}
void compactLidSpaceAndWait(uint32_t wantedLidLimit) {
- runInMaster([&] () { performCompactLidSpace(wantedLidLimit); });
+ runInMasterAndSync([&]() { performCompactLidSpace(wantedLidLimit); });
}
void assertChangeHandler(document::GlobalId expGid, uint32_t expLid, uint32_t expChanges) {
_gidToLidChangeHandler->assertChanges(expGid, expLid, expChanges);
@@ -931,7 +931,7 @@ TEST_F("require that handleDeleteBucket() removes documents", SearchableFeedView
// delete bucket for user 1
DeleteBucketOperation op(docs[0].bid);
- f.runInMaster([&] () { f.performDeleteBucket(op); });
+ f.runInMasterAndSync([&]() { f.performDeleteBucket(op); });
f.dms_commit();
EXPECT_EQUAL(0u, f.getBucketDB()->get(docs[0].bid).getDocumentCount());
@@ -1034,7 +1034,7 @@ TEST_F("require that removes are not remembered", SearchableFeedViewFixture)
TEST_F("require that heartbeat propagates to index- and attributeadapter",
SearchableFeedViewFixture)
{
- f.runInMaster([&] () { f.fv.heartBeat(2); });
+ f.runInMasterAndSync([&]() { f.fv.heartBeat(2); });
EXPECT_EQUAL(1, f.miw._heartBeatCount);
EXPECT_EQUAL(1, f.maw._heartBeatCount);
}
@@ -1146,7 +1146,7 @@ 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.runInMaster([&] () { f.fv.handleCompactLidSpace(op); });
+ f.runInMasterAndSync([&]() { f.fv.handleCompactLidSpace(op); });
// Delayed holdUnblockShrinkLidSpace() in index thread, then master thread
EXPECT_TRUE(assertThreadObserver(6, 6, 5, f.writeServiceObserver()));
EXPECT_EQUAL(0u, f.metaStoreObserver()._compactLidSpaceLidLimit);
diff --git a/searchcore/src/tests/proton/documentdb/storeonlyfeedview/storeonlyfeedview_test.cpp b/searchcore/src/tests/proton/documentdb/storeonlyfeedview/storeonlyfeedview_test.cpp
index 02d0bb5c056..8ccf4f792c5 100644
--- a/searchcore/src/tests/proton/documentdb/storeonlyfeedview/storeonlyfeedview_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/storeonlyfeedview/storeonlyfeedview_test.cpp
@@ -241,13 +241,13 @@ struct FixtureBase {
}
template <typename FunctionType>
- void runInMaster(FunctionType func) {
+ void runInMasterAndSync(FunctionType func) {
test::runInMasterAndSync(writeService, func);
}
void force_commit() {
vespalib::Gate gate;
- runInMaster([this, &gate] () {
+ runInMasterAndSync([this, &gate]() {
feedview->forceCommit(search::CommitParam(serial_num), std::make_shared<vespalib::GateCallback>(gate));
});
gate.await();
@@ -285,7 +285,7 @@ TEST_F("require that prepareMove sets target db document id", Fixture)
{
Document::SP doc(new Document);
MoveOperation op(BucketId(20, 42), Timestamp(10), doc, 1, subdb_id + 1);
- f.runInMaster([&] () { f.feedview->prepareMove(op); });
+ f.runInMasterAndSync([&]() { f.feedview->prepareMove(op); });
DbDocumentId targetId = op.getDbDocumentId();
EXPECT_EQUAL(subdb_id, targetId.getSubDbId());
@@ -313,8 +313,8 @@ TEST_F("require that handleMove() adds document to target and removes it from so
{ // move from (subdb_id + 1) -> this (subdb_id)
MoveOperation::UP op = makeMoveOp(DbDocumentId(subdb_id + 1, 1), subdb_id);
TEST_DO(f.assertPutCount(0));
- f.runInMaster([&]() { f.feedview->prepareMove(*op); });
- f.runInMaster([&]() { f.feedview->handleMove(*op, f.beginMoveOp()); });
+ f.runInMasterAndSync([&]() { f.feedview->prepareMove(*op); });
+ f.runInMasterAndSync([&]() { f.feedview->handleMove(*op, f.beginMoveOp()); });
TEST_DO(f.assertPutCount(1));
TEST_DO(f.assertAndClearMoveOp());
lid = op->getDbDocumentId().getLid();
@@ -326,7 +326,7 @@ TEST_F("require that handleMove() adds document to target and removes it from so
MoveOperation::UP op = makeMoveOp(DbDocumentId(subdb_id, 1), subdb_id + 1);
op->setDbDocumentId(DbDocumentId(subdb_id + 1, 1));
TEST_DO(f.assertRemoveCount(0));
- f.runInMaster([&]() { f.feedview->handleMove(*op, f.beginMoveOp()); });
+ f.runInMasterAndSync([&]() { f.feedview->handleMove(*op, f.beginMoveOp()); });
EXPECT_FALSE(f.metaStore->validLid(lid));
TEST_DO(f.assertRemoveCount(1));
TEST_DO(f.assertAndClearMoveOp());
@@ -338,19 +338,23 @@ TEST_F("require that handleMove() handles move within same subdb and propagates
Document::SP doc(new Document);
DocumentId doc1id("id:test:foo:g=foo:1");
uint32_t docSize = 1;
- f.runInMaster([&] () { f.metaStore->put(doc1id.getGlobalId(),
- doc1id.getGlobalId().convertToBucketId(),
- Timestamp(9), docSize, 1, 0u); });
- f.runInMaster([&] () { f.metaStore->put(doc->getId().getGlobalId(),
- doc->getId().getGlobalId().convertToBucketId(),
- Timestamp(10), docSize, 2, 0u); });
- f.runInMaster([&] () { f.metaStore->remove(1, 0u); });
+ f.runInMasterAndSync([&]() {
+ f.metaStore->put(doc1id.getGlobalId(),
+ doc1id.getGlobalId().convertToBucketId(),
+ Timestamp(9), docSize, 1, 0u);
+ });
+ f.runInMasterAndSync([&]() {
+ f.metaStore->put(doc->getId().getGlobalId(),
+ doc->getId().getGlobalId().convertToBucketId(),
+ Timestamp(10), docSize, 2, 0u);
+ });
+ f.runInMasterAndSync([&]() { f.metaStore->remove(1, 0u); });
f.metaStore->removes_complete({ 1 });
MoveOperation::UP op = makeMoveOp(doc, DbDocumentId(subdb_id, 2), subdb_id);
op->setTargetLid(1);
TEST_DO(f.assertPutCount(0));
TEST_DO(f.assertRemoveCount(0));
- f.runInMaster([&] () { f.feedview->handleMove(*op, f.beginMoveOp()); });
+ f.runInMasterAndSync([&]() { f.feedview->handleMove(*op, f.beginMoveOp()); });
TEST_DO(f.assertPutCount(1));
TEST_DO(f.assertRemoveCount(1));
TEST_DO(f.assertAndClearMoveOp());
@@ -370,7 +374,7 @@ TEST_F("require that prune removed documents removes documents",
PruneRemovedDocumentsOperation op(lids->getDocIdLimit(), subdb_id);
op.setLidsToRemove(lids);
op.setSerialNum(1); // allows use of meta store.
- f.runInMaster([&] () { f.feedview->handlePruneRemovedDocuments(op); });
+ f.runInMasterAndSync([&]() { f.feedview->handlePruneRemovedDocuments(op); });
EXPECT_EQUAL(2, f.removeCount);
EXPECT_FALSE(f.metaStore->validLid(1));
@@ -386,7 +390,7 @@ TEST_F("require that heartbeat propagates and commits meta store", Fixture)
EXPECT_EQUAL(0, f.feedview->heartBeatIndexedFieldsCount);
EXPECT_EQUAL(0, f.feedview->heartBeatAttributesCount);
EXPECT_EQUAL(0, f.heartbeatCount);
- f.runInMaster([&] () { f.feedview->heartBeat(2); });
+ f.runInMasterAndSync([&]() { f.feedview->heartBeat(2); });
EXPECT_EQUAL(2u, f.metaStore->getStatus().getLastSyncToken());
EXPECT_EQUAL(1, f.feedview->heartBeatIndexedFieldsCount);
EXPECT_EQUAL(1, f.feedview->heartBeatAttributesCount);
diff --git a/searchcore/src/tests/proton/documentmetastore/lidreusedelayer/lidreusedelayer_test.cpp b/searchcore/src/tests/proton/documentmetastore/lidreusedelayer/lidreusedelayer_test.cpp
index 240019c6d7b..7be591099bc 100644
--- a/searchcore/src/tests/proton/documentmetastore/lidreusedelayer/lidreusedelayer_test.cpp
+++ b/searchcore/src/tests/proton/documentmetastore/lidreusedelayer/lidreusedelayer_test.cpp
@@ -136,7 +136,7 @@ public:
}
template <typename FunctionType>
- void runInMaster(FunctionType func) {
+ void runInMasterAndSync(FunctionType func) {
test::runInMasterAndSync(_writeService, func);
}
@@ -155,15 +155,15 @@ public:
}
void delayReuse(uint32_t lid) {
- runInMaster([&] () { _lidReuseDelayer->delayReuse(lid); } );
+ runInMasterAndSync([&]() { _lidReuseDelayer->delayReuse(lid); });
}
void delayReuse(const std::vector<uint32_t> &lids) {
- runInMaster([&] () { _lidReuseDelayer->delayReuse(lids); });
+ runInMasterAndSync([&]() { _lidReuseDelayer->delayReuse(lids); });
}
void commit() {
- runInMaster([&] () { cycleLids(_lidReuseDelayer->getReuseLids()); });
+ runInMasterAndSync([&]() { cycleLids(_lidReuseDelayer->getReuseLids()); });
}
};