diff options
author | Tor Egge <Tor.Egge@online.no> | 2021-11-15 23:02:33 +0100 |
---|---|---|
committer | Tor Egge <Tor.Egge@online.no> | 2021-11-15 23:02:33 +0100 |
commit | ce119ff35b16ce80b14a6d864eab614529d43dcb (patch) | |
tree | 4d7e2b911cfc1d478d862e8062e3ced74cc122b6 /searchcore/src/tests/proton/docsummary | |
parent | 9cd877af1097ad0da25036eb1fb9212c7fafc4a2 (diff) |
Use GateCallback to signal completion.
Diffstat (limited to 'searchcore/src/tests/proton/docsummary')
-rw-r--r-- | searchcore/src/tests/proton/docsummary/docsummary.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/searchcore/src/tests/proton/docsummary/docsummary.cpp b/searchcore/src/tests/proton/docsummary/docsummary.cpp index 1808aed5d0b..2e78c204b56 100644 --- a/searchcore/src/tests/proton/docsummary/docsummary.cpp +++ b/searchcore/src/tests/proton/docsummary/docsummary.cpp @@ -65,6 +65,7 @@ using vespa::config::search::core::ProtonConfig; using vespa::config::content::core::BucketspacesConfig; using vespalib::eval::TensorSpec; using vespalib::eval::SimpleValue; +using vespalib::GateCallback; using vespalib::Slime; using namespace vespalib::slime; @@ -253,8 +254,11 @@ public: dms.commit(CommitParam(0u)); uint64_t serialNum = _ddb->getFeedHandler().inc_serial_num(); _aw->put(serialNum, doc, lid, std::shared_ptr<IDestructorCallback>()); - _aw->forceCommit(serialNum, std::shared_ptr<IDestructorCallback>()); - _ddb->getReadySubDB()->getAttributeManager()->getAttributeFieldWriter().sync_all(); + { + vespalib::Gate gate; + _aw->forceCommit(serialNum, std::make_shared<GateCallback>(gate)); + gate.await(); + } _sa->put(serialNum, lid, doc); const GlobalId &gid = docId.getGlobalId(); BucketId bucketId(gid.convertToBucketId()); @@ -700,13 +704,17 @@ TEST("requireThatAttributesAreUsed") search::AttributeVector *bjAttr = attributeManager->getWritableAttribute("bj"); auto bjTensorAttr = dynamic_cast<search::tensor::TensorAttribute *>(bjAttr); + vespalib::Gate gate; + auto on_write_done = std::make_shared<GateCallback>(gate); attributeFieldWriter.execute(attributeFieldWriter.getExecutorIdFromName(bjAttr->getNamePrefix()), - [&]() { + [&, on_write_done]() { + (void) on_write_done; bjTensorAttr->setTensor(3, *make_tensor(TensorSpec("tensor(x{},y{})") .add({{"x", "a"}, {"y", "b"}}, 4))); bjTensorAttr->commit(); }); - attributeFieldWriter.sync_all(); + on_write_done.reset(); + gate.await(); DocsumReply::UP rep2 = dc._ddb->getDocsums(req); TEST_DO(assertTensor(make_tensor(TensorSpec("tensor(x{},y{})") |