summaryrefslogtreecommitdiffstats
path: root/searchcore/src
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-10-08 12:02:05 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2020-10-08 12:02:05 +0000
commitf0de1d6106d9de4235d39d65afb39ecb5f71e4f7 (patch)
tree2730d02ea3389d62a56cec6dbe3c78044cfde566 /searchcore/src
parent079c648dc2c8b3aad65c902183bce2e40bfee8cb (diff)
Ensure we really wait until operation is complete.
Diffstat (limited to 'searchcore/src')
-rw-r--r--searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp13
-rw-r--r--searchcore/src/vespa/searchcore/proton/test/thread_utils.h12
2 files changed, 12 insertions, 13 deletions
diff --git a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp
index e6751a0cb98..adaeafb31bd 100644
--- a/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp
+++ b/searchcore/src/tests/proton/documentdb/feedview/feedview_test.cpp
@@ -594,7 +594,8 @@ struct FixtureBase
void putAndWait(const DocumentContext &docCtx) {
FeedTokenContext token(_tracer);
PutOperation op(docCtx.bid, docCtx.ts, docCtx.doc);
- runInMaster([&] () { performPut(token.ft, op); });
+ runInMaster([this, ft=std::move(token.ft), &op] () { performPut(std::move(ft), op); });
+ token.mt.await();
}
void performUpdate(FeedToken token, UpdateOperation &op) {
@@ -606,7 +607,8 @@ struct FixtureBase
void updateAndWait(const DocumentContext &docCtx) {
FeedTokenContext token(_tracer);
UpdateOperation op(docCtx.bid, docCtx.ts, docCtx.upd);
- runInMaster([&] () { performUpdate(token.ft, op); });
+ runInMaster([this, ft=std::move(token.ft), &op] () { performUpdate(std::move(ft), op); });
+ token.mt.await();
}
void performRemove(FeedToken token, RemoveOperation &op) {
@@ -620,7 +622,8 @@ struct FixtureBase
void removeAndWait(const DocumentContext &docCtx) {
FeedTokenContext token(_tracer);
RemoveOperationWithDocId op(docCtx.bid, docCtx.ts, docCtx.doc->getId());
- runInMaster([&] () { performRemove(token.ft, op); });
+ runInMaster([this, ft=std::move(token.ft), &op] () { performRemove(std::move(ft), op); });
+ token.mt.await();
}
void removeAndWait(const DocumentContext::List &docs) {
@@ -647,7 +650,9 @@ struct FixtureBase
}
void performForceCommit() { getFeedView().forceCommit(serial); }
- void forceCommitAndWait() { runInMaster([&]() { performForceCommit(); }); }
+ void forceCommitAndWait() {
+ runInMaster([&]() { performForceCommit(); });
+ }
bool assertTrace(const vespalib::string &exp) {
return EXPECT_EQUAL(exp, _tracer._os.str());
diff --git a/searchcore/src/vespa/searchcore/proton/test/thread_utils.h b/searchcore/src/vespa/searchcore/proton/test/thread_utils.h
index 4dac300d614..340d3b08441 100644
--- a/searchcore/src/vespa/searchcore/proton/test/thread_utils.h
+++ b/searchcore/src/vespa/searchcore/proton/test/thread_utils.h
@@ -4,9 +4,7 @@
#include <vespa/searchcorespi/index/ithreadingservice.h>
#include <vespa/vespalib/util/closuretask.h>
-namespace proton {
-
-namespace test {
+namespace proton::test {
template <typename FunctionType>
void
@@ -20,15 +18,11 @@ runFunction(FunctionType *func)
*/
template <typename FunctionType>
void
-runInMaster(searchcorespi::index::IThreadingService &writeService,
- FunctionType func)
+runInMaster(searchcorespi::index::IThreadingService &writeService, FunctionType func)
{
writeService.master().execute(vespalib::makeTask
(vespalib::makeClosure(&runFunction<FunctionType>, &func)));
writeService.sync();
}
-} // namespace test
-
-} // namespace proton
-
+}