diff options
Diffstat (limited to 'searchcore/src')
9 files changed, 54 insertions, 59 deletions
diff --git a/searchcore/src/apps/proton/downpersistence.cpp b/searchcore/src/apps/proton/downpersistence.cpp index aa87c383c33..999cf6696ea 100644 --- a/searchcore/src/apps/proton/downpersistence.cpp +++ b/searchcore/src/apps/proton/downpersistence.cpp @@ -95,8 +95,7 @@ DownPersistence::get(const Bucket&, const document::FieldSet&, const DocumentId& } CreateIteratorResult -DownPersistence::createIterator(const Bucket&, const document::FieldSet&, - const Selection&, IncludedVersions, Context&) +DownPersistence::createIterator(const Bucket &, FieldSetSP, const Selection &, IncludedVersions, Context &) { return CreateIteratorResult(errorResult.getErrorCode(), errorResult.getErrorMessage()); } diff --git a/searchcore/src/apps/proton/downpersistence.h b/searchcore/src/apps/proton/downpersistence.h index 10e3d9c1ad7..d8b48172880 100644 --- a/searchcore/src/apps/proton/downpersistence.h +++ b/searchcore/src/apps/proton/downpersistence.h @@ -39,8 +39,9 @@ public: UpdateResult update(const Bucket&, Timestamp timestamp, DocumentUpdateSP update, Context&) override; GetResult get(const Bucket&, const document::FieldSet& fieldSet, const DocumentId& id, Context&) const override; - CreateIteratorResult createIterator(const Bucket&, const document::FieldSet& fieldSet, - const Selection& selection, IncludedVersions versions, Context&) override; + CreateIteratorResult + createIterator(const Bucket &bucket, FieldSetSP fieldSet, const Selection &selection, IncludedVersions versions, + Context &context) override; IterateResult iterate(IteratorId id, uint64_t maxByteSize, Context&) const override; Result destroyIterator(IteratorId id, Context&) override; diff --git a/searchcore/src/apps/tests/persistenceconformance_test.cpp b/searchcore/src/apps/tests/persistenceconformance_test.cpp index 217d1edcd57..44fb2770594 100644 --- a/searchcore/src/apps/tests/persistenceconformance_test.cpp +++ b/searchcore/src/apps/tests/persistenceconformance_test.cpp @@ -362,14 +362,11 @@ public: ~MyPersistenceFactory() override { clear(); } - PersistenceProvider::UP getPersistenceImplementation(const std::shared_ptr<const DocumentTypeRepo> &repo, + std::unique_ptr<PersistenceProvider> getPersistenceImplementation(const std::shared_ptr<const DocumentTypeRepo> &repo, const DocumenttypesConfig &typesCfg) override { ConfigFactory cfgFactory(repo, std::make_shared<DocumenttypesConfig>(typesCfg), _schemaFactory); _docDbRepo = std::make_unique<DocumentDBRepo>(cfgFactory, _docDbFactory); - PersistenceEngine::UP engine(new MyPersistenceEngine(_engineOwner, - _writeFilter, - std::move(_docDbRepo), - _docType)); + auto engine = std::make_unique<MyPersistenceEngine>(_engineOwner,_writeFilter,std::move(_docDbRepo), _docType); assert( ! _docDbRepo); // Repo should be handed over return engine; } diff --git a/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp b/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp index 147bd9afb84..44ce55edfbd 100644 --- a/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp +++ b/searchcore/src/tests/proton/document_iterator/document_iterator_test.cpp @@ -447,14 +447,14 @@ TEST("require that custom retrievers work as expected") { } TEST("require that an empty list of retrievers can be iterated") { - DocumentIterator itr(bucket(5), document::AllFields(), selectAll(), newestV(), -1, false); + DocumentIterator itr(bucket(5), std::make_shared<document::AllFields>(), selectAll(), newestV(), -1, false); IterateResult res = itr.iterate(largeNum); EXPECT_EQUAL(0u, res.getEntries().size()); EXPECT_TRUE(res.isCompleted()); } TEST("require that a list of empty retrievers can be iterated") { - DocumentIterator itr(bucket(5), document::AllFields(), selectAll(), newestV(), -1, false); + DocumentIterator itr(bucket(5), std::make_shared<document::AllFields>(), selectAll(), newestV(), -1, false); itr.add(nil()); itr.add(nil()); itr.add(nil()); @@ -464,7 +464,7 @@ TEST("require that a list of empty retrievers can be iterated") { } TEST("require that normal documents can be iterated") { - DocumentIterator itr(bucket(5), document::AllFields(), selectAll(), newestV(), -1, false); + DocumentIterator itr(bucket(5), std::make_shared<document::AllFields>(), selectAll(), newestV(), -1, false); itr.add(doc("id:ns:document::1", Timestamp(2), bucket(5))); itr.add(cat(doc("id:ns:document::2", Timestamp(3), bucket(5)), doc("id:ns:document::3", Timestamp(4), bucket(5)))); @@ -487,12 +487,12 @@ void verifyIterateIgnoringStopSignal(DocumentIterator & itr) { } TEST("require that iterator stops at the end, and does not auto rewind") { - DocumentIterator itr(bucket(5), document::AllFields(), selectAll(), newestV(), -1, false); + DocumentIterator itr(bucket(5), std::make_shared<document::AllFields>(), selectAll(), newestV(), -1, false); TEST_DO(verifyIterateIgnoringStopSignal(itr)); } TEST("require that iterator ignoring maxbytes stops at the end, and does not auto rewind") { - DocumentIterator itr(bucket(5), document::AllFields(), selectAll(), newestV(), -1, true); + DocumentIterator itr(bucket(5), std::make_shared<document::AllFields>(), selectAll(), newestV(), -1, true); TEST_DO(verifyIterateIgnoringStopSignal(itr)); } @@ -515,12 +515,12 @@ void verifyStrongReadConsistency(DocumentIterator & itr) { } TEST("require that default readconsistency does commit") { - DocumentIterator itr(bucket(5), document::AllFields(), selectAll(), newestV(), -1, false); + DocumentIterator itr(bucket(5), std::make_shared<document::AllFields>(), selectAll(), newestV(), -1, false); TEST_DO(verifyStrongReadConsistency(itr)); } TEST("require that readconsistency::strong does commit") { - DocumentIterator itr(bucket(5), document::AllFields(), selectAll(), newestV(), -1, false, storage::spi::ReadConsistency::STRONG); + DocumentIterator itr(bucket(5), std::make_shared<document::AllFields>(), selectAll(), newestV(), -1, false, storage::spi::ReadConsistency::STRONG); TEST_DO(verifyStrongReadConsistency(itr)); } @@ -528,7 +528,7 @@ TEST("require that docid limit is honoured") { IDocumentRetriever::SP retriever = doc("id:ns:document::1", Timestamp(2), bucket(5)); auto & udr = dynamic_cast<UnitDR &>(*retriever); udr.docid = 7; - DocumentIterator itr(bucket(5), document::AllFields(), selectAll(), newestV(), -1, false); + DocumentIterator itr(bucket(5), std::make_shared<document::AllFields>(), selectAll(), newestV(), -1, false); itr.add(retriever); IterateResult res = itr.iterate(largeNum); EXPECT_TRUE(res.isCompleted()); @@ -536,7 +536,7 @@ TEST("require that docid limit is honoured") { TEST_DO(checkEntry(res, 0, Document(*DataType::DOCUMENT, DocumentId("id:ns:document::1")), Timestamp(2))); udr.setDocIdLimit(7); - DocumentIterator limited(bucket(5), document::AllFields(), selectAll(), newestV(), -1, false); + DocumentIterator limited(bucket(5), std::make_shared<document::AllFields>(), selectAll(), newestV(), -1, false); limited.add(retriever); res = limited.iterate(largeNum); EXPECT_TRUE(res.isCompleted()); @@ -544,7 +544,7 @@ TEST("require that docid limit is honoured") { } TEST("require that remove entries can be iterated") { - DocumentIterator itr(bucket(5), document::AllFields(), selectAll(), newestV(), -1, false); + DocumentIterator itr(bucket(5), std::make_shared<document::AllFields>(), selectAll(), newestV(), -1, false); itr.add(rem("id:ns:document::1", Timestamp(2), bucket(5))); itr.add(cat(rem("id:ns:document::2", Timestamp(3), bucket(5)), rem("id:ns:document::3", Timestamp(4), bucket(5)))); @@ -557,7 +557,7 @@ TEST("require that remove entries can be iterated") { } TEST("require that remove entries can be ignored") { - DocumentIterator itr(bucket(5), document::AllFields(), selectAll(), docV(), -1, false); + DocumentIterator itr(bucket(5), std::make_shared<document::AllFields>(), selectAll(), docV(), -1, false); itr.add(rem("id:ns:document::1", Timestamp(2), bucket(5))); itr.add(cat(doc("id:ns:document::2", Timestamp(3), bucket(5)), rem("id:ns:document::3", Timestamp(4), bucket(5)))); @@ -568,7 +568,7 @@ TEST("require that remove entries can be ignored") { } TEST("require that iterating all versions returns both documents and removes") { - DocumentIterator itr(bucket(5), document::AllFields(), selectAll(), allV(), -1, false); + DocumentIterator itr(bucket(5), std::make_shared<document::AllFields>(), selectAll(), allV(), -1, false); itr.add(rem("id:ns:document::1", Timestamp(2), bucket(5))); itr.add(cat(doc("id:ns:document::2", Timestamp(3), bucket(5)), rem("id:ns:document::3", Timestamp(4), bucket(5)))); @@ -581,7 +581,7 @@ TEST("require that iterating all versions returns both documents and removes") { } TEST("require that using an empty field set returns meta-data only") { - DocumentIterator itr(bucket(5), document::NoFields(), selectAll(), newestV(), -1, false); + DocumentIterator itr(bucket(5), std::make_shared<document::NoFields>(), selectAll(), newestV(), -1, false); itr.add(doc("id:ns:document::1", Timestamp(2), bucket(5))); itr.add(cat(doc("id:ns:document::2", Timestamp(3), bucket(5)), rem("id:ns:document::3", Timestamp(4), bucket(5)))); @@ -594,7 +594,7 @@ TEST("require that using an empty field set returns meta-data only") { } TEST("require that entries in other buckets are skipped") { - DocumentIterator itr(bucket(5), document::AllFields(), selectAll(), newestV(), -1, false); + DocumentIterator itr(bucket(5), std::make_shared<document::AllFields>(), selectAll(), newestV(), -1, false); itr.add(rem("id:ns:document::1", Timestamp(2), bucket(6))); itr.add(cat(doc("id:ns:document::2", Timestamp(3), bucket(5)), doc("id:ns:document::3", Timestamp(4), bucket(6)))); @@ -605,7 +605,7 @@ TEST("require that entries in other buckets are skipped") { } TEST("require that maxBytes splits iteration results") { - DocumentIterator itr(bucket(5), document::AllFields(), selectAll(), newestV(), -1, false); + DocumentIterator itr(bucket(5), std::make_shared<document::AllFields>(), selectAll(), newestV(), -1, false); itr.add(doc("id:ns:document::1", Timestamp(2), bucket(5))); itr.add(cat(rem("id:ns:document::2", Timestamp(3), bucket(5)), doc("id:ns:document::3", Timestamp(4), bucket(5)))); @@ -626,7 +626,7 @@ TEST("require that maxBytes splits iteration results") { } TEST("require that maxBytes splits iteration results for meta-data only iteration") { - DocumentIterator itr(bucket(5), document::NoFields(), selectAll(), newestV(), -1, false); + DocumentIterator itr(bucket(5), std::make_shared<document::NoFields>(), selectAll(), newestV(), -1, false); itr.add(doc("id:ns:document::1", Timestamp(2), bucket(5))); itr.add(cat(rem("id:ns:document::2", Timestamp(3), bucket(5)), doc("id:ns:document::3", Timestamp(4), bucket(5)))); @@ -646,7 +646,7 @@ TEST("require that maxBytes splits iteration results for meta-data only iteratio } TEST("require that at least one document is returned by visit") { - DocumentIterator itr(bucket(5), document::AllFields(), selectAll(), newestV(), -1, false); + DocumentIterator itr(bucket(5), std::make_shared<document::AllFields>(), selectAll(), newestV(), -1, false); itr.add(doc("id:ns:document::1", Timestamp(2), bucket(5))); itr.add(cat(rem("id:ns:document::2", Timestamp(3), bucket(5)), doc("id:ns:document::3", Timestamp(4), bucket(5)))); @@ -656,7 +656,7 @@ TEST("require that at least one document is returned by visit") { } TEST("require that documents outside the timestamp limits are ignored") { - DocumentIterator itr(bucket(5), document::AllFields(), selectTimestampRange(100, 200), newestV(), -1, false); + DocumentIterator itr(bucket(5), std::make_shared<document::AllFields>(), selectTimestampRange(100, 200), newestV(), -1, false); itr.add(doc("id:ns:document::1", Timestamp(99), bucket(5))); itr.add(doc("id:ns:document::2", Timestamp(100), bucket(5))); itr.add(doc("id:ns:document::3", Timestamp(200), bucket(5))); @@ -675,7 +675,7 @@ TEST("require that documents outside the timestamp limits are ignored") { } TEST("require that timestamp subset returns the appropriate documents") { - DocumentIterator itr(bucket(5), document::AllFields(), selectTimestampSet(200, 350, 400), newestV(), -1, false); + DocumentIterator itr(bucket(5), std::make_shared<document::AllFields>(), selectTimestampSet(200, 350, 400), newestV(), -1, false); itr.add(doc("id:ns:document::1", Timestamp(500), bucket(5))); itr.add(doc("id:ns:document::2", Timestamp(400), bucket(5))); itr.add(doc("id:ns:document::3", Timestamp(300), bucket(5))); @@ -693,7 +693,7 @@ TEST("require that timestamp subset returns the appropriate documents") { } TEST("require that document selection will filter results") { - DocumentIterator itr(bucket(5), document::AllFields(), selectDocs("id=\"id:ns:document::xxx*\""), newestV(), -1, false); + DocumentIterator itr(bucket(5), std::make_shared<document::AllFields>(), selectDocs("id=\"id:ns:document::xxx*\""), newestV(), -1, false); itr.add(doc("id:ns:document::xxx1", Timestamp(99), bucket(5))); itr.add(doc("id:ns:document::yyy1", Timestamp(100), bucket(5))); itr.add(doc("id:ns:document::xxx2", Timestamp(200), bucket(5))); @@ -712,7 +712,7 @@ TEST("require that document selection will filter results") { } TEST("require that document selection handles 'field == null'") { - DocumentIterator itr(bucket(5), document::AllFields(), selectDocs("foo.aa == null"), newestV(), -1, false); + DocumentIterator itr(bucket(5), std::make_shared<document::AllFields>(), selectDocs("foo.aa == null"), newestV(), -1, false); itr.add(doc_with_null_fields("id:ns:foo::xxx1", Timestamp(99), bucket(5))); itr.add(doc_with_null_fields("id:ns:foo::xxx2", Timestamp(100), bucket(5))); IterateResult res = itr.iterate(largeNum); @@ -725,7 +725,7 @@ TEST("require that document selection handles 'field == null'") { } TEST("require that invalid document selection returns no documents") { - DocumentIterator itr(bucket(5), document::AllFields(), selectDocs("=="), newestV(), -1, false); + DocumentIterator itr(bucket(5), std::make_shared<document::AllFields>(), selectDocs("=="), newestV(), -1, false); itr.add(doc("id:ns:document::xxx1", Timestamp(99), bucket(5))); itr.add(doc("id:ns:document::yyy1", Timestamp(100), bucket(5))); itr.add(doc("id:ns:document::xxx2", Timestamp(200), bucket(5))); @@ -740,7 +740,7 @@ TEST("require that invalid document selection returns no documents") { } TEST("require that document selection and timestamp range works together") { - DocumentIterator itr(bucket(5), document::AllFields(), selectDocsWithinRange("id=\"id:ns:document::xxx*\"", 100, 200), newestV(), -1, false); + DocumentIterator itr(bucket(5), std::make_shared<document::AllFields>(), selectDocsWithinRange("id=\"id:ns:document::xxx*\"", 100, 200), newestV(), -1, false); itr.add(doc("id:ns:document::xxx1", Timestamp(99), bucket(5))); itr.add(doc("id:ns:document::yyy1", Timestamp(100), bucket(5))); itr.add(doc("id:ns:document::xxx2", Timestamp(200), bucket(5))); @@ -757,9 +757,8 @@ TEST("require that document selection and timestamp range works together") { } TEST("require that fieldset limits fields returned") { - document::FieldCollection limited(getDocType(), - document::Field::Set::Builder().add(&getDocType().getField("header")).build()); - DocumentIterator itr(bucket(5), limited, selectAll(), newestV(), -1, false); + auto limited = std::make_shared<document::FieldCollection>(getDocType(),document::Field::Set::Builder().add(&getDocType().getField("header")).build()); + DocumentIterator itr(bucket(5), std::move(limited), selectAll(), newestV(), -1, false); itr.add(doc_with_fields("id:ns:foo::xxx1", Timestamp(1), bucket(5))); IterateResult res = itr.iterate(largeNum); EXPECT_TRUE(res.isCompleted()); @@ -777,8 +776,7 @@ bool contains(const Container& c, const T& value) { } TEST("require that userdoc-constrained selections pre-filter on GIDs") { - DocumentIterator itr(bucket(5), document::AllFields(), - selectDocs("id.user=1234"), newestV(), -1, false); + DocumentIterator itr(bucket(5), std::make_shared<document::AllFields>(), selectDocs("id.user=1234"), newestV(), -1, false); VisitRecordingUnitDR::VisitedLIDs visited_lids; // Even though GID filtering is probabilistic when it comes to filtering // user IDs that cover the 64-bit range, it's fully deterministic when the @@ -808,7 +806,7 @@ TEST("require that userdoc-constrained selections pre-filter on GIDs") { TEST("require that attributes are used") { UnitDR::reset(); - DocumentIterator itr(bucket(5), document::AllFields(), selectDocs("foo.aa == 45"), docV(), -1, false); + DocumentIterator itr(bucket(5), std::make_shared<document::AllFields>(), selectDocs("foo.aa == 45"), docV(), -1, false); itr.add(doc_with_attr_fields("id:ns:foo::xx1", Timestamp(1), bucket(5), 27, 28, 27, 2.7, 2.8, "x27", "x28")); itr.add(doc_with_attr_fields("id:ns:foo::xx2", Timestamp(2), bucket(5), @@ -838,7 +836,7 @@ TEST("require that attributes are used") TEST_DO(checkEntry(res, 0, expected1, Timestamp(2))); TEST_DO(checkEntry(res, 1, expected2, Timestamp(4))); - DocumentIterator itr2(bucket(5), document::AllFields(), selectDocs("foo.dd == 4.5"), docV(), -1, false); + DocumentIterator itr2(bucket(5), std::make_shared<document::AllFields>(), selectDocs("foo.dd == 4.5"), docV(), -1, false); itr2.add(doc_with_attr_fields("id:ns:foo::xx5", Timestamp(5), bucket(5), 27, 28, 27, 2.7, 2.8, "x27", "x28")); itr2.add(doc_with_attr_fields("id:ns:foo::xx6", Timestamp(6), bucket(5), @@ -868,7 +866,7 @@ TEST("require that attributes are used") TEST_DO(checkEntry(res2, 0, expected3, Timestamp(6))); TEST_DO(checkEntry(res2, 1, expected4, Timestamp(8))); - DocumentIterator itr3(bucket(5), document::AllFields(), selectDocs("foo.ss == \"x45\""), docV(), -1, false); + DocumentIterator itr3(bucket(5), std::make_shared<document::AllFields>(), selectDocs("foo.ss == \"x45\""), docV(), -1, false); itr3.add(doc_with_attr_fields("id:ns:foo::xx9", Timestamp(9), bucket(5), 27, 28, 27, 2.7, 2.8, "x27", "x28")); itr3.add(doc_with_attr_fields("id:ns:foo::xx10", Timestamp(10), bucket(5), diff --git a/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp b/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp index a31deca5d12..6351c187b45 100644 --- a/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp +++ b/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp @@ -693,7 +693,7 @@ TEST_F("require that createIterator does", SimpleFixture) { storage::spi::LoadType loadType(0, "default"); Context context(loadType, storage::spi::Priority(0), storage::spi::Trace::TraceLevel(0)); CreateIteratorResult result = - f.engine.createIterator(bucket1, document::AllFields(), selection, + f.engine.createIterator(bucket1, std::make_shared<document::AllFields>(), selection, storage::spi::NEWEST_DOCUMENT_ONLY, context); EXPECT_FALSE(result.hasError()); EXPECT_TRUE(result.getIteratorId()); @@ -707,10 +707,10 @@ TEST_F("require that iterator ids are unique", SimpleFixture) { storage::spi::LoadType loadType(0, "default"); Context context(loadType, storage::spi::Priority(0), storage::spi::Trace::TraceLevel(0)); CreateIteratorResult result = - f.engine.createIterator(bucket1, document::AllFields(), selection, + f.engine.createIterator(bucket1, std::make_shared<document::AllFields>(), selection, storage::spi::NEWEST_DOCUMENT_ONLY, context); CreateIteratorResult result2 = - f.engine.createIterator(bucket1, document::AllFields(), selection, + f.engine.createIterator(bucket1, std::make_shared<document::AllFields>(), selection, storage::spi::NEWEST_DOCUMENT_ONLY, context); EXPECT_FALSE(result.hasError()); EXPECT_FALSE(result2.hasError()); @@ -727,7 +727,7 @@ TEST_F("require that iterate requires valid iterator", SimpleFixture) { EXPECT_EQUAL("Unknown iterator with id 1", it_result.getErrorMessage()); CreateIteratorResult result = - f.engine.createIterator(bucket1, document::AllFields(), selection, + f.engine.createIterator(bucket1, std::make_shared<document::AllFields>(), selection, storage::spi::NEWEST_DOCUMENT_ONLY, context); EXPECT_TRUE(result.getIteratorId()); @@ -743,7 +743,7 @@ TEST_F("require that iterate returns documents", SimpleFixture) { Context context(loadType, storage::spi::Priority(0), storage::spi::Trace::TraceLevel(0)); uint64_t max_size = 1024; CreateIteratorResult result = - f.engine.createIterator(bucket1, document::AllFields(), selection, + f.engine.createIterator(bucket1, std::make_shared<document::AllFields>(), selection, storage::spi::NEWEST_DOCUMENT_ONLY, context); EXPECT_TRUE(result.getIteratorId()); @@ -758,7 +758,7 @@ TEST_F("require that destroyIterator prevents iteration", SimpleFixture) { storage::spi::LoadType loadType(0, "default"); Context context(loadType, storage::spi::Priority(0), storage::spi::Trace::TraceLevel(0)); CreateIteratorResult create_result = - f.engine.createIterator(bucket1, document::AllFields(), selection, + f.engine.createIterator(bucket1, std::make_shared<document::AllFields>(), selection, storage::spi::NEWEST_DOCUMENT_ONLY, context); EXPECT_TRUE(create_result.getIteratorId()); @@ -779,7 +779,7 @@ TEST_F("require that buckets are frozen during iterator life", SimpleFixture) { storage::spi::LoadType loadType(0, "default"); Context context(loadType, storage::spi::Priority(0), storage::spi::Trace::TraceLevel(0)); CreateIteratorResult create_result = - f.engine.createIterator(bucket1, document::AllFields(), selection, + f.engine.createIterator(bucket1, std::make_shared<document::AllFields>(), selection, storage::spi::NEWEST_DOCUMENT_ONLY, context); EXPECT_TRUE(f.hset.handler1.isFrozen(bucket1)); EXPECT_TRUE(f.hset.handler2.isFrozen(bucket1)); diff --git a/searchcore/src/vespa/searchcore/proton/persistenceengine/document_iterator.cpp b/searchcore/src/vespa/searchcore/proton/persistenceengine/document_iterator.cpp index fcb9a672039..65a19a72fb9 100644 --- a/searchcore/src/vespa/searchcore/proton/persistenceengine/document_iterator.cpp +++ b/searchcore/src/vespa/searchcore/proton/persistenceengine/document_iterator.cpp @@ -66,7 +66,7 @@ DocumentIterator::checkMeta(const search::DocumentMetaData &meta) const } DocumentIterator::DocumentIterator(const storage::spi::Bucket &bucket, - const document::FieldSet& fields, + document::FieldSet::SP fields, const storage::spi::Selection &selection, storage::spi::IncludedVersions versions, ssize_t defaultSerializedSize, @@ -75,10 +75,10 @@ DocumentIterator::DocumentIterator(const storage::spi::Bucket &bucket, : _bucket(bucket), _selection(selection), _versions(versions), - _fields(fields.clone()), + _fields(std::move(fields)), _defaultSerializedSize((readConsistency == ReadConsistency::WEAK) ? defaultSerializedSize : -1), _readConsistency(readConsistency), - _metaOnly(fields.getType() == document::FieldSet::Type::NONE), + _metaOnly(_fields->getType() == document::FieldSet::Type::NONE), _ignoreMaxBytes((readConsistency == ReadConsistency::WEAK) && ignoreMaxBytes), _fetchedData(false), _sources(), diff --git a/searchcore/src/vespa/searchcore/proton/persistenceengine/document_iterator.h b/searchcore/src/vespa/searchcore/proton/persistenceengine/document_iterator.h index 67242e8220f..4ae3839bfe8 100644 --- a/searchcore/src/vespa/searchcore/proton/persistenceengine/document_iterator.h +++ b/searchcore/src/vespa/searchcore/proton/persistenceengine/document_iterator.h @@ -19,7 +19,7 @@ private: const storage::spi::Bucket _bucket;; const storage::spi::Selection _selection; const storage::spi::IncludedVersions _versions; - const document::FieldSet::UP _fields; + const document::FieldSet::SP _fields; const ssize_t _defaultSerializedSize; const ReadConsistency _readConsistency; const bool _metaOnly; @@ -35,7 +35,7 @@ private: bool isWeakRead() const { return _readConsistency == ReadConsistency::WEAK; } public: - DocumentIterator(const storage::spi::Bucket &bucket, const document::FieldSet& fields, + DocumentIterator(const storage::spi::Bucket &bucket, document::FieldSet::SP fields, const storage::spi::Selection &selection, storage::spi::IncludedVersions versions, ssize_t defaultSerializedSize, bool ignoreMaxBytes, ReadConsistency readConsistency=ReadConsistency::STRONG); diff --git a/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.cpp b/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.cpp index b5166276e4a..14a56e7e0bb 100644 --- a/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.cpp +++ b/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.cpp @@ -452,13 +452,13 @@ PersistenceEngine::get(const Bucket& b, const document::FieldSet& fields, const PersistenceEngine::CreateIteratorResult -PersistenceEngine::createIterator(const Bucket &bucket, const document::FieldSet& fields, const Selection &selection, - IncludedVersions versions, Context & context) +PersistenceEngine::createIterator(const Bucket &bucket, FieldSetSP fields, const Selection &selection, + IncludedVersions versions, Context &context) { std::shared_lock<std::shared_timed_mutex> rguard(_rwMutex); HandlerSnapshot snapshot = getHandlerSnapshot(rguard, bucket.getBucketSpace()); - auto entry = std::make_unique<IteratorEntry>(context.getReadConsistency(), bucket, fields, selection, + auto entry = std::make_unique<IteratorEntry>(context.getReadConsistency(), bucket, std::move(fields), selection, versions, _defaultSerializedSize, _ignoreMaxBytes); entry->bucket_guards.reserve(snapshot.size()); for (PersistenceHandlerSequence & handlers = snapshot.handlers(); handlers.valid(); handlers.next()) { diff --git a/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.h b/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.h index 230f8c411aa..a874d91eb20 100644 --- a/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.h +++ b/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.h @@ -45,10 +45,10 @@ private: DocumentIterator it; bool in_use; std::vector<BucketGuard::UP> bucket_guards; - IteratorEntry(storage::spi::ReadConsistency readConsistency, const Bucket &b, const document::FieldSet& f, + IteratorEntry(storage::spi::ReadConsistency readConsistency, const Bucket &b, FieldSetSP f, const Selection &s, IncludedVersions v, ssize_t defaultSerializedSize, bool ignoreMaxBytes) : handler_sequence(), - it(b, f, s, v, defaultSerializedSize, ignoreMaxBytes, readConsistency), + it(b, std::move(f), s, v, defaultSerializedSize, ignoreMaxBytes, readConsistency), in_use(false), bucket_guards() {} }; @@ -105,8 +105,8 @@ public: void removeAsync(const Bucket&, Timestamp, const document::DocumentId&, Context&, OperationComplete::UP) override; void updateAsync(const Bucket&, Timestamp, storage::spi::DocumentUpdateSP, Context&, OperationComplete::UP) override; GetResult get(const Bucket&, const document::FieldSet&, const document::DocumentId&, Context&) const override; - CreateIteratorResult createIterator(const Bucket&, const document::FieldSet&, const Selection&, - IncludedVersions, Context&) override; + CreateIteratorResult + createIterator(const Bucket &bucket, FieldSetSP, const Selection &, IncludedVersions, Context &context) override; IterateResult iterate(IteratorId, uint64_t maxByteSize, Context&) const override; Result destroyIterator(IteratorId, Context&) override; |