summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2020-10-23 10:31:35 +0200
committerGitHub <noreply@github.com>2020-10-23 10:31:35 +0200
commit3a60012ad750e9889f2a8fdaaff2b8c3bf328d65 (patch)
tree32f2913305a8dd103e7473e436e98a0b6c9f4b57
parent24fe152948851e1f11c63e86b96a78db91343a61 (diff)
parent7262582d8b2a5e0210b8273d2186136d52e166fe (diff)
Merge pull request #15016 from vespa-engine/balder/ensure-documents-are-committed
Ensure that documents are visible before accessing them. Aslo use stdā€¦
-rw-r--r--searchcore/src/tests/proton/docsummary/docsummary.cpp26
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()