diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2020-10-23 04:53:35 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2020-10-23 04:53:35 +0000 |
commit | 7262582d8b2a5e0210b8273d2186136d52e166fe (patch) | |
tree | 6b0b7b64c6ab119ec26d81f0096fbfec47693780 | |
parent | ae99f6bd8f0c28ae24fd814c9ee164de86b649b8 (diff) |
Ensure that documents are visible before accessing them. Aslo use std::make_unique/shared
-rw-r--r-- | searchcore/src/tests/proton/docsummary/docsummary.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/searchcore/src/tests/proton/docsummary/docsummary.cpp b/searchcore/src/tests/proton/docsummary/docsummary.cpp index 266a817d380..b43ef01e386 100644 --- a/searchcore/src/tests/proton/docsummary/docsummary.cpp +++ b/searchcore/src/tests/proton/docsummary/docsummary.cpp @@ -97,7 +97,7 @@ public: BuildContext(const Schema &schema) : _dmk("summary"), _bld(schema), - _repo(new DocumentTypeRepo(_bld.getDocumentType())), + _repo(std::make_shared<DocumentTypeRepo>(_bld.getDocumentType())), _summaryExecutor(4, 128 * 1024), _noTlSyncer(), _str(_summaryExecutor, "summary", @@ -125,7 +125,7 @@ public: } FieldCacheRepo::UP createFieldCacheRepo(const ResultConfig &resConfig) const { - return FieldCacheRepo::UP(new FieldCacheRepo(resConfig, _bld.getDocumentType())); + return std::make_unique<FieldCacheRepo>(resConfig, _bld.getDocumentType()); } }; @@ -150,8 +150,7 @@ vespalib::string asVstring(const Inspector &value) { } void decode(const ResEntry *entry, vespalib::Slime &slime) { - vespalib::Memory mem(entry->_dataval, - entry->_datalen); + vespalib::Memory mem(entry->_dataval, entry->_datalen); size_t decodeRes = BinaryFormat::decode(mem, slime); ASSERT_EQUAL(decodeRes, mem.size); } @@ -216,14 +215,14 @@ public: if (! FastOS_File::MakeDirectory((std::string("tmpdb/") + docTypeName).c_str())) { LOG_ABORT("should not be reached"); } - _ddb.reset(new DocumentDB("tmpdb", _configMgr.getConfig(), "tcp/localhost:9013", _queryLimiter, _clock, - DocTypeName(docTypeName), makeBucketSpace(), - *b->getProtonConfigSP(), *this, _summaryExecutor, _summaryExecutor, - _tls, _dummy, _fileHeaderContext, ConfigStore::UP(new MemoryConfigStore), - std::make_shared<vespalib::ThreadStackExecutor>(16, 128 * 1024), _hwInfo)), + _ddb = std::make_unique<DocumentDB>("tmpdb", _configMgr.getConfig(), "tcp/localhost:9013", _queryLimiter, _clock, + DocTypeName(docTypeName), makeBucketSpace(), *b->getProtonConfigSP(), *this, + _summaryExecutor, _summaryExecutor, _tls, _dummy, _fileHeaderContext, + std::make_unique<MemoryConfigStore>(), + std::make_shared<vespalib::ThreadStackExecutor>(16, 128 * 1024), _hwInfo), _ddb->start(); _ddb->waitForOnlineState(); - _aw = AttributeWriter::UP(new AttributeWriter(_ddb->getReadySubDB()->getAttributeManager())); + _aw = std::make_unique<AttributeWriter>(_ddb->getReadySubDB()->getAttributeManager()); _sa = _ddb->getReadySubDB()->getSummaryAdapter(); } ~DBContext() @@ -259,10 +258,11 @@ public: op->setSerialNum(serialNum); op->setDbDocumentId(dbdId); op->setPrevDbDocumentId(prevDbdId); - _ddb->getWriteService().master().execute(vespalib::makeLambdaTask([this, op = std::move(op)]() { - _ddb->getFeedHandler().appendOperation(*op, std::make_shared<search::IgnoreCallback>()); + vespalib::Gate commitDone; + _ddb->getWriteService().master().execute(vespalib::makeLambdaTask([this, op = std::move(op), &commitDone]() { + _ddb->getFeedHandler().appendOperation(*op, std::make_shared<search::GateCallback>(commitDone)); })); - _ddb->getWriteService().master().sync(); + commitDone.await(); SearchView *sv(dynamic_cast<SearchView *>(_ddb->getReadySubDB()->getSearchView().get())); if (sv != nullptr) { // cf. FeedView::putAttributes() |