summaryrefslogtreecommitdiffstats
path: root/persistence
diff options
context:
space:
mode:
authorArnstein Ressem <aressem@gmail.com>2020-08-19 17:54:54 +0200
committerGitHub <noreply@github.com>2020-08-19 17:54:54 +0200
commit3a9f8a641d5312e83a34f6aa293f98182c90adfe (patch)
tree4267692e9ed8a798ea0817798c2f16f3a406fc42 /persistence
parentff1749fab8abcb2201f662098552f3aa00e6300f (diff)
Revert "Balder/use an actual fieldset repo"
Diffstat (limited to 'persistence')
-rw-r--r--persistence/src/tests/dummyimpl/dummyimpltest.cpp4
-rw-r--r--persistence/src/vespa/persistence/conformancetest/conformancetest.cpp324
-rw-r--r--persistence/src/vespa/persistence/conformancetest/conformancetest.h21
-rw-r--r--persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp12
-rw-r--r--persistence/src/vespa/persistence/dummyimpl/dummypersistence.h9
-rw-r--r--persistence/src/vespa/persistence/spi/persistenceprovider.h11
6 files changed, 226 insertions, 155 deletions
diff --git a/persistence/src/tests/dummyimpl/dummyimpltest.cpp b/persistence/src/tests/dummyimpl/dummyimpltest.cpp
index 7bc27266020..6cf0b53766f 100644
--- a/persistence/src/tests/dummyimpl/dummyimpltest.cpp
+++ b/persistence/src/tests/dummyimpl/dummyimpltest.cpp
@@ -14,9 +14,9 @@ namespace {
struct DummyPersistenceFactory : public ConformanceTest::PersistenceFactory {
using Repo = document::DocumentTypeRepo;
- std::unique_ptr<PersistenceProvider>
+ PersistenceProvider::UP
getPersistenceImplementation(const std::shared_ptr<const Repo>& repo, const Repo::DocumenttypesConfig&) override {
- return std::make_unique<dummy::DummyPersistence>(repo, 4);
+ return PersistenceProvider::UP(new dummy::DummyPersistence(repo, 4));
}
bool supportsActiveState() const override { return true; }
diff --git a/persistence/src/vespa/persistence/conformancetest/conformancetest.cpp b/persistence/src/vespa/persistence/conformancetest/conformancetest.cpp
index 1871d8943d8..3d15d09814f 100644
--- a/persistence/src/vespa/persistence/conformancetest/conformancetest.cpp
+++ b/persistence/src/vespa/persistence/conformancetest/conformancetest.cpp
@@ -27,15 +27,13 @@ using storage::spi::test::makeSpiBucket;
namespace storage::spi {
-using PersistenceProviderUP = std::unique_ptr<PersistenceProvider>;
-
namespace {
LoadType defaultLoadType(0, "default");
-std::unique_ptr<PersistenceProvider> getSpi(ConformanceTest::PersistenceFactory &factory,
+PersistenceProvider::UP getSpi(ConformanceTest::PersistenceFactory &factory,
const document::TestDocMan &testDocMan) {
- PersistenceProviderUP result(factory.getPersistenceImplementation(
+ PersistenceProvider::UP result(factory.getPersistenceImplementation(
testDocMan.getTypeRepoSP(), *testDocMan.getTypeConfig()));
EXPECT_TRUE(!result->initialize().hasError());
EXPECT_TRUE(!result->getPartitionStates().hasError());
@@ -55,15 +53,15 @@ createIterator(PersistenceProvider& spi,
IncludedVersions versions = NEWEST_DOCUMENT_ONLY,
int fields = ALL_FIELDS)
{
- document::FieldSet::SP fieldSet;
+ document::FieldSet::UP fieldSet;
if (fields & ALL_FIELDS) {
- fieldSet = std::make_shared<document::AllFields>();
+ fieldSet.reset(new document::AllFields());
} else {
- fieldSet = std::make_shared<document::DocIdOnly>();
+ fieldSet.reset(new document::DocIdOnly());
}
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
- return spi.createIterator(b, std::move(fieldSet), sel, versions, context);
+ return spi.createIterator(b, *fieldSet, sel, versions, context);
}
Selection
@@ -208,7 +206,7 @@ iterateBucket(PersistenceProvider& spi,
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
CreateIteratorResult iter = spi.createIterator(
bucket,
- std::make_shared<document::AllFields>(),
+ document::AllFields(),
sel,
versions,
context);
@@ -332,7 +330,7 @@ TEST_F(ConformanceTest, testBasics)
{
document::TestDocMan testDocMan;
_factory->clear();
- PersistenceProviderUP spi(getSpi(*_factory, testDocMan));
+ PersistenceProvider::UP spi(getSpi(*_factory, testDocMan));
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
Bucket bucket(makeSpiBucket(BucketId(8, 0x01)));
@@ -360,7 +358,7 @@ TEST_F(ConformanceTest, testBasics)
CreateIteratorResult iter = spi->createIterator(
bucket,
- std::make_shared<document::AllFields>(),
+ document::AllFields(),
sel,
includeRemoves
? NEWEST_DOCUMENT_OR_REMOVE : NEWEST_DOCUMENT_ONLY,
@@ -417,7 +415,7 @@ TEST_F(ConformanceTest, testListBuckets)
//TODO: enable when supported by provider in storage
document::TestDocMan testDocMan;
_factory->clear();
- PersistenceProviderUP spi(getSpi(*_factory, testDocMan));
+ PersistenceProvider::UP spi(getSpi(*_factory, testDocMan));
PartitionId partId(0);
BucketId bucketId1(8, 0x01);
@@ -462,7 +460,7 @@ TEST_F(ConformanceTest, testBucketInfo)
{
document::TestDocMan testDocMan;
_factory->clear();
- PersistenceProviderUP spi(getSpi(*_factory, testDocMan));
+ PersistenceProvider::UP spi(getSpi(*_factory, testDocMan));
Bucket bucket(makeSpiBucket(BucketId(8, 0x01)));
@@ -519,7 +517,7 @@ TEST_F(ConformanceTest, testOrderIndependentBucketInfo)
{
document::TestDocMan testDocMan;
_factory->clear();
- PersistenceProviderUP spi(getSpi(*_factory, testDocMan));
+ PersistenceProvider::UP spi(getSpi(*_factory, testDocMan));
Bucket bucket(makeSpiBucket(BucketId(8, 0x01)));
@@ -563,7 +561,7 @@ TEST_F(ConformanceTest, testPut)
{
document::TestDocMan testDocMan;
_factory->clear();
- PersistenceProviderUP spi(getSpi(*_factory, testDocMan));
+ PersistenceProvider::UP spi(getSpi(*_factory, testDocMan));
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
Bucket bucket(makeSpiBucket(BucketId(8, 0x01)));
@@ -588,7 +586,7 @@ TEST_F(ConformanceTest, testPutNewDocumentVersion)
{
document::TestDocMan testDocMan;
_factory->clear();
- PersistenceProviderUP spi(getSpi(*_factory, testDocMan));
+ PersistenceProvider::UP spi(getSpi(*_factory, testDocMan));
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
Bucket bucket(makeSpiBucket(BucketId(8, 0x01)));
@@ -639,7 +637,7 @@ TEST_F(ConformanceTest, testPutOlderDocumentVersion)
{
document::TestDocMan testDocMan;
_factory->clear();
- PersistenceProviderUP spi(getSpi(*_factory, testDocMan));
+ PersistenceProvider::UP spi(getSpi(*_factory, testDocMan));
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
Bucket bucket(makeSpiBucket(BucketId(8, 0x01)));
@@ -683,7 +681,7 @@ TEST_F(ConformanceTest, testPutDuplicate)
{
document::TestDocMan testDocMan;
_factory->clear();
- PersistenceProviderUP spi(getSpi(*_factory, testDocMan));
+ PersistenceProvider::UP spi(getSpi(*_factory, testDocMan));
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
Bucket bucket(makeSpiBucket(BucketId(8, 0x01)));
@@ -715,7 +713,7 @@ TEST_F(ConformanceTest, testRemove)
{
document::TestDocMan testDocMan;
_factory->clear();
- PersistenceProviderUP spi(getSpi(*_factory, testDocMan));
+ PersistenceProvider::UP spi(getSpi(*_factory, testDocMan));
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
Bucket bucket(makeSpiBucket(BucketId(8, 0x01)));
@@ -808,7 +806,7 @@ TEST_F(ConformanceTest, testRemoveMerge)
{
document::TestDocMan testDocMan;
_factory->clear();
- PersistenceProviderUP spi(getSpi(*_factory, testDocMan));
+ PersistenceProvider::UP spi(getSpi(*_factory, testDocMan));
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
Bucket bucket(makeSpiBucket(BucketId(8, 0x01)));
@@ -902,7 +900,7 @@ TEST_F(ConformanceTest, testUpdate)
{
document::TestDocMan testDocMan;
_factory->clear();
- PersistenceProviderUP spi(getSpi(*_factory, testDocMan));
+ PersistenceProvider::UP spi(getSpi(*_factory, testDocMan));
Document::SP doc1 = testDocMan.createRandomDocumentAtLocation(0x01, 1);
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
@@ -1001,7 +999,7 @@ TEST_F(ConformanceTest, testGet)
{
document::TestDocMan testDocMan;
_factory->clear();
- PersistenceProviderUP spi(getSpi(*_factory, testDocMan));
+ PersistenceProvider::UP spi(getSpi(*_factory, testDocMan));
Document::SP doc1 = testDocMan.createRandomDocumentAtLocation(0x01, 1);
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
@@ -1044,7 +1042,7 @@ TEST_F(ConformanceTest, testIterateCreateIterator)
{
document::TestDocMan testDocMan;
_factory->clear();
- PersistenceProviderUP spi(getSpi(*_factory, testDocMan));
+ PersistenceProvider::UP spi(getSpi(*_factory, testDocMan));
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
Bucket b(makeSpiBucket(BucketId(8, 0x1)));
spi->createBucket(b, context);
@@ -1063,7 +1061,7 @@ TEST_F(ConformanceTest, testIterateWithUnknownId)
{
document::TestDocMan testDocMan;
_factory->clear();
- PersistenceProviderUP spi(getSpi(*_factory, testDocMan));
+ PersistenceProvider::UP spi(getSpi(*_factory, testDocMan));
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
Bucket b(makeSpiBucket(BucketId(8, 0x1)));
spi->createBucket(b, context);
@@ -1077,7 +1075,7 @@ TEST_F(ConformanceTest, testIterateDestroyIterator)
{
document::TestDocMan testDocMan;
_factory->clear();
- PersistenceProviderUP spi(getSpi(*_factory, testDocMan));
+ PersistenceProvider::UP spi(getSpi(*_factory, testDocMan));
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
Bucket b(makeSpiBucket(BucketId(8, 0x1)));
spi->createBucket(b, context);
@@ -1109,7 +1107,7 @@ TEST_F(ConformanceTest, testIterateAllDocs)
{
document::TestDocMan testDocMan;
_factory->clear();
- PersistenceProviderUP spi(getSpi(*_factory, testDocMan));
+ PersistenceProvider::UP spi(getSpi(*_factory, testDocMan));
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
Bucket b(makeSpiBucket(BucketId(8, 0x1)));
spi->createBucket(b, context);
@@ -1127,7 +1125,7 @@ TEST_F(ConformanceTest, testIterateAllDocsNewestVersionOnly)
{
document::TestDocMan testDocMan;
_factory->clear();
- PersistenceProviderUP spi(getSpi(*_factory, testDocMan));
+ PersistenceProvider::UP spi(getSpi(*_factory, testDocMan));
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
Bucket b(makeSpiBucket(BucketId(8, 0x1)));
spi->createBucket(b, context);
@@ -1155,7 +1153,7 @@ TEST_F(ConformanceTest, testIterateChunked)
{
document::TestDocMan testDocMan;
_factory->clear();
- PersistenceProviderUP spi(getSpi(*_factory, testDocMan));
+ PersistenceProvider::UP spi(getSpi(*_factory, testDocMan));
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
Bucket b(makeSpiBucket(BucketId(8, 0x1)));
spi->createBucket(b, context);
@@ -1175,7 +1173,7 @@ TEST_F(ConformanceTest, testMaxByteSize)
{
document::TestDocMan testDocMan;
_factory->clear();
- PersistenceProviderUP spi(getSpi(*_factory, testDocMan));
+ PersistenceProvider::UP spi(getSpi(*_factory, testDocMan));
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
Bucket b(makeSpiBucket(BucketId(8, 0x1)));
spi->createBucket(b, context);
@@ -1201,7 +1199,7 @@ TEST_F(ConformanceTest, testIterateMatchTimestampRange)
{
document::TestDocMan testDocMan;
_factory->clear();
- PersistenceProviderUP spi(getSpi(*_factory, testDocMan));
+ PersistenceProvider::UP spi(getSpi(*_factory, testDocMan));
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
Bucket b(makeSpiBucket(BucketId(8, 0x1)));
spi->createBucket(b, context);
@@ -1239,7 +1237,7 @@ TEST_F(ConformanceTest, testIterateExplicitTimestampSubset)
{
document::TestDocMan testDocMan;
_factory->clear();
- PersistenceProviderUP spi(getSpi(*_factory, testDocMan));
+ PersistenceProvider::UP spi(getSpi(*_factory, testDocMan));
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
Bucket b(makeSpiBucket(BucketId(8, 0x1)));
spi->createBucket(b, context);
@@ -1288,7 +1286,7 @@ TEST_F(ConformanceTest, testIterateRemoves)
{
document::TestDocMan testDocMan;
_factory->clear();
- PersistenceProviderUP spi(getSpi(*_factory, testDocMan));
+ PersistenceProvider::UP spi(getSpi(*_factory, testDocMan));
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
Bucket b(makeSpiBucket(BucketId(8, 0x1)));
spi->createBucket(b, context);
@@ -1323,7 +1321,8 @@ TEST_F(ConformanceTest, testIterateRemoves)
{
Selection sel(createSelection(""));
- CreateIteratorResult iter(createIterator(*spi, b, sel, NEWEST_DOCUMENT_OR_REMOVE));
+ CreateIteratorResult iter(
+ createIterator(*spi, b, sel, NEWEST_DOCUMENT_OR_REMOVE));
std::vector<Chunk> chunks = doIterate(*spi, iter.getIteratorId(), 4096);
std::vector<DocEntry::UP> entries = getEntriesFromChunks(chunks);
@@ -1338,7 +1337,7 @@ TEST_F(ConformanceTest, testIterateMatchSelection)
{
document::TestDocMan testDocMan;
_factory->clear();
- PersistenceProviderUP spi(getSpi(*_factory, testDocMan));
+ PersistenceProvider::UP spi(getSpi(*_factory, testDocMan));
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
Bucket b(makeSpiBucket(BucketId(8, 0x1)));
spi->createBucket(b, context);
@@ -1352,11 +1351,15 @@ TEST_F(ConformanceTest, testIterateMatchSelection)
spi->put(b, Timestamp(1000 + i), doc, context);
if ((i % 3) == 0) {
- docsToVisit.push_back(DocAndTimestamp(doc, Timestamp(1000 + i)));
+ docsToVisit.push_back(
+ DocAndTimestamp(doc, Timestamp(1000 + i)));
}
}
- CreateIteratorResult iter(createIterator(*spi, b, createSelection("testdoctype1.headerval % 3 == 0")));
+ CreateIteratorResult iter(
+ createIterator(*spi,
+ b,
+ createSelection("testdoctype1.headerval % 3 == 0")));
std::vector<Chunk> chunks = doIterate(*spi, iter.getIteratorId(), 2048 * 1024);
verifyDocs(docsToVisit, chunks);
@@ -1368,7 +1371,7 @@ TEST_F(ConformanceTest, testIterationRequiringDocumentIdOnlyMatching)
{
document::TestDocMan testDocMan;
_factory->clear();
- PersistenceProviderUP spi(getSpi(*_factory, testDocMan));
+ PersistenceProvider::UP spi(getSpi(*_factory, testDocMan));
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
Bucket b(makeSpiBucket(BucketId(8, 0x1)));
spi->createBucket(b, context);
@@ -1378,11 +1381,13 @@ TEST_F(ConformanceTest, testIterationRequiringDocumentIdOnlyMatching)
// Document does not already exist, remove should create a
// remove entry for it regardless.
- EXPECT_TRUE(!spi->remove(b, Timestamp(2000), removedId, context).wasFound());
+ EXPECT_TRUE(
+ !spi->remove(b, Timestamp(2000), removedId, context).wasFound());
Selection sel(createSelection("id == '" + removedId.toString() + "'"));
- CreateIteratorResult iter(createIterator(*spi, b, sel, NEWEST_DOCUMENT_OR_REMOVE));
+ CreateIteratorResult iter(
+ createIterator(*spi, b, sel, NEWEST_DOCUMENT_OR_REMOVE));
EXPECT_TRUE(iter.getErrorCode() == Result::ErrorType::NONE);
std::vector<Chunk> chunks = doIterate(*spi, iter.getIteratorId(), 4096);
@@ -1398,14 +1403,16 @@ TEST_F(ConformanceTest, testIterateBadDocumentSelection)
{
document::TestDocMan testDocMan;
_factory->clear();
- PersistenceProviderUP spi(getSpi(*_factory, testDocMan));
+ PersistenceProvider::UP spi(getSpi(*_factory, testDocMan));
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
Bucket b(makeSpiBucket(BucketId(8, 0x1)));
spi->createBucket(b, context);
{
- CreateIteratorResult iter(createIterator(*spi, b, createSelection("the muppet show")));
+ CreateIteratorResult iter(
+ createIterator(*spi, b, createSelection("the muppet show")));
if (iter.getErrorCode() == Result::ErrorType::NONE) {
- IterateResult result(spi->iterate(iter.getIteratorId(), 4096, context));
+ IterateResult result(
+ spi->iterate(iter.getIteratorId(), 4096, context));
EXPECT_EQ(Result::ErrorType::NONE, result.getErrorCode());
EXPECT_EQ(size_t(0), result.getEntries().size());
EXPECT_EQ(true, result.isCompleted());
@@ -1415,9 +1422,14 @@ TEST_F(ConformanceTest, testIterateBadDocumentSelection)
}
}
{
- CreateIteratorResult iter(createIterator(*spi, b, createSelection("unknownddoctype.something=thatthing")));
+ CreateIteratorResult iter(
+ createIterator(*spi,
+ b,
+ createSelection(
+ "unknownddoctype.something=thatthing")));
if (iter.getErrorCode() == Result::ErrorType::NONE) {
- IterateResult result(spi->iterate(iter.getIteratorId(), 4096, context));
+ IterateResult result(spi->iterate(
+ iter.getIteratorId(), 4096, context));
EXPECT_EQ(Result::ErrorType::NONE, result.getErrorCode());
EXPECT_EQ(size_t(0), result.getEntries().size());
EXPECT_EQ(true, result.isCompleted());
@@ -1432,7 +1444,7 @@ TEST_F(ConformanceTest, testIterateAlreadyCompleted)
{
document::TestDocMan testDocMan;
_factory->clear();
- PersistenceProviderUP spi(getSpi(*_factory, testDocMan));
+ PersistenceProvider::UP spi(getSpi(*_factory, testDocMan));
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
Bucket b(makeSpiBucket(BucketId(8, 0x1)));
spi->createBucket(b, context);
@@ -1456,7 +1468,7 @@ TEST_F(ConformanceTest, testIterateEmptyBucket)
{
document::TestDocMan testDocMan;
_factory->clear();
- PersistenceProviderUP spi(getSpi(*_factory, testDocMan));
+ PersistenceProvider::UP spi(getSpi(*_factory, testDocMan));
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
Bucket b(makeSpiBucket(BucketId(8, 0x1)));
spi->createBucket(b, context);
@@ -1476,7 +1488,7 @@ TEST_F(ConformanceTest, testDeleteBucket)
{
document::TestDocMan testDocMan;
_factory->clear();
- PersistenceProviderUP spi(getSpi(*_factory, testDocMan));
+ PersistenceProvider::UP spi(getSpi(*_factory, testDocMan));
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
Document::SP doc1 = testDocMan.createRandomDocumentAtLocation(0x01, 1);
@@ -1486,28 +1498,28 @@ TEST_F(ConformanceTest, testDeleteBucket)
spi->put(bucket, Timestamp(3), doc1, context);
spi->deleteBucket(bucket, context);
- testDeleteBucketPostCondition(*spi, bucket, *doc1);
+ testDeleteBucketPostCondition(spi, bucket, *doc1);
if (_factory->hasPersistence()) {
spi.reset();
document::TestDocMan testDocMan2;
spi = getSpi(*_factory, testDocMan2);
- testDeleteBucketPostCondition(*spi, bucket, *doc1);
+ testDeleteBucketPostCondition(spi, bucket, *doc1);
}
}
void
ConformanceTest::
-testDeleteBucketPostCondition(const PersistenceProvider &spi,
+testDeleteBucketPostCondition(const PersistenceProvider::UP &spi,
const Bucket &bucket,
const Document &doc1)
{
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
{
- GetResult result = spi.get(bucket,
- document::AllFields(),
- doc1.getId(),
- context);
+ GetResult result = spi->get(bucket,
+ document::AllFields(),
+ doc1.getId(),
+ context);
EXPECT_EQ(Result::ErrorType::NONE, result.getErrorCode());
EXPECT_EQ(Timestamp(0), result.getTimestamp());
@@ -1519,7 +1531,7 @@ TEST_F(ConformanceTest, testSplitNormalCase)
{
document::TestDocMan testDocMan;
_factory->clear();
- PersistenceProviderUP spi(getSpi(*_factory, testDocMan));
+ PersistenceProvider::UP spi(getSpi(*_factory, testDocMan));
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
Bucket bucketA(makeSpiBucket(BucketId(3, 0x02)));
@@ -1540,41 +1552,51 @@ TEST_F(ConformanceTest, testSplitNormalCase)
}
spi->split(bucketC, bucketA, bucketB, context);
- testSplitNormalCasePostCondition(*spi, bucketA, bucketB, bucketC, testDocMan);
+ testSplitNormalCasePostCondition(spi, bucketA, bucketB, bucketC,
+ testDocMan);
if (_factory->hasPersistence()) {
spi.reset();
document::TestDocMan testDocMan2;
spi = getSpi(*_factory, testDocMan2);
- testSplitNormalCasePostCondition(*spi, bucketA, bucketB, bucketC, testDocMan2);
+ testSplitNormalCasePostCondition(spi, bucketA, bucketB, bucketC,
+ testDocMan2);
}
}
void
ConformanceTest::
-testSplitNormalCasePostCondition(const PersistenceProvider &spi,
+testSplitNormalCasePostCondition(const PersistenceProvider::UP &spi,
const Bucket &bucketA,
const Bucket &bucketB,
const Bucket &bucketC,
document::TestDocMan &testDocMan)
{
- EXPECT_EQ(10, (int)spi.getBucketInfo(bucketA).getBucketInfo().getDocumentCount());
- EXPECT_EQ(10, (int)spi.getBucketInfo(bucketB).getBucketInfo().getDocumentCount());
+ EXPECT_EQ(10, (int)spi->getBucketInfo(bucketA).getBucketInfo().
+ getDocumentCount());
+ EXPECT_EQ(10, (int)spi->getBucketInfo(bucketB).getBucketInfo().
+ getDocumentCount());
document::AllFields fs;
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
for (uint32_t i = 0; i < 10; ++i) {
Document::UP doc1 = testDocMan.createRandomDocumentAtLocation(0x02, i);
- EXPECT_TRUE(spi.get(bucketA, fs, doc1->getId(), context).hasDocument());
- EXPECT_TRUE(!spi.get(bucketC, fs, doc1->getId(), context).hasDocument());
- EXPECT_TRUE(!spi.get(bucketB, fs, doc1->getId(), context).hasDocument());
+ EXPECT_TRUE(
+ spi->get(bucketA, fs, doc1->getId(), context).hasDocument());
+ EXPECT_TRUE(
+ !spi->get(bucketC, fs, doc1->getId(), context).hasDocument());
+ EXPECT_TRUE(
+ !spi->get(bucketB, fs, doc1->getId(), context).hasDocument());
}
for (uint32_t i = 10; i < 20; ++i) {
Document::UP doc1 = testDocMan.createRandomDocumentAtLocation(0x06, i);
- EXPECT_TRUE(spi.get(bucketB, fs, doc1->getId(), context).hasDocument());
- EXPECT_TRUE(!spi.get(bucketA, fs, doc1->getId(), context).hasDocument());
- EXPECT_TRUE(!spi.get(bucketC, fs, doc1->getId(), context).hasDocument());
+ EXPECT_TRUE(
+ spi->get(bucketB, fs, doc1->getId(), context).hasDocument());
+ EXPECT_TRUE(
+ !spi->get(bucketA, fs, doc1->getId(), context).hasDocument());
+ EXPECT_TRUE(
+ !spi->get(bucketC, fs, doc1->getId(), context).hasDocument());
}
}
@@ -1582,7 +1604,7 @@ TEST_F(ConformanceTest, testSplitTargetExists)
{
document::TestDocMan testDocMan;
_factory->clear();
- PersistenceProviderUP spi(getSpi(*_factory, testDocMan));
+ PersistenceProvider::UP spi(getSpi(*_factory, testDocMan));
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
Bucket bucketA(makeSpiBucket(BucketId(3, 0x02)));
@@ -1616,27 +1638,29 @@ TEST_F(ConformanceTest, testSplitTargetExists)
}
spi->split(bucketC, bucketA, bucketB, context);
- testSplitTargetExistsPostCondition(*spi, bucketA, bucketB, bucketC,testDocMan);
+ testSplitTargetExistsPostCondition(spi, bucketA, bucketB, bucketC,
+ testDocMan);
if (_factory->hasPersistence()) {
spi.reset();
document::TestDocMan testDocMan2;
spi = getSpi(*_factory, testDocMan2);
- testSplitTargetExistsPostCondition(*spi, bucketA, bucketB, bucketC,testDocMan2);
+ testSplitTargetExistsPostCondition(spi, bucketA, bucketB, bucketC,
+ testDocMan2);
}
}
void
ConformanceTest::
-testSplitTargetExistsPostCondition(const PersistenceProvider &spi,
+testSplitTargetExistsPostCondition(const PersistenceProvider::UP &spi,
const Bucket &bucketA,
const Bucket &bucketB,
const Bucket &bucketC,
document::TestDocMan &testDocMan)
{
- EXPECT_EQ(10, (int)spi.getBucketInfo(bucketA).getBucketInfo().
+ EXPECT_EQ(10, (int)spi->getBucketInfo(bucketA).getBucketInfo().
getDocumentCount());
- EXPECT_EQ(15, (int)spi.getBucketInfo(bucketB).getBucketInfo().
+ EXPECT_EQ(15, (int)spi->getBucketInfo(bucketB).getBucketInfo().
getDocumentCount());
document::AllFields fs;
@@ -1644,21 +1668,21 @@ testSplitTargetExistsPostCondition(const PersistenceProvider &spi,
for (uint32_t i = 0; i < 10; ++i) {
Document::UP doc1 = testDocMan.createRandomDocumentAtLocation(0x02, i);
EXPECT_TRUE(
- spi.get(bucketA, fs, doc1->getId(), context).hasDocument());
+ spi->get(bucketA, fs, doc1->getId(), context).hasDocument());
EXPECT_TRUE(
- !spi.get(bucketC, fs, doc1->getId(), context).hasDocument());
+ !spi->get(bucketC, fs, doc1->getId(), context).hasDocument());
EXPECT_TRUE(
- !spi.get(bucketB, fs, doc1->getId(), context).hasDocument());
+ !spi->get(bucketB, fs, doc1->getId(), context).hasDocument());
}
for (uint32_t i = 10; i < 25; ++i) {
Document::UP doc1 = testDocMan.createRandomDocumentAtLocation(0x06, i);
EXPECT_TRUE(
- spi.get(bucketB, fs, doc1->getId(), context).hasDocument());
+ spi->get(bucketB, fs, doc1->getId(), context).hasDocument());
EXPECT_TRUE(
- !spi.get(bucketA, fs, doc1->getId(), context).hasDocument());
+ !spi->get(bucketA, fs, doc1->getId(), context).hasDocument());
EXPECT_TRUE(
- !spi.get(bucketC, fs, doc1->getId(), context).hasDocument());
+ !spi->get(bucketC, fs, doc1->getId(), context).hasDocument());
}
}
@@ -1666,7 +1690,7 @@ TEST_F(ConformanceTest, testSplitSingleDocumentInSource)
{
document::TestDocMan testDocMan;
_factory->clear();
- PersistenceProviderUP spi(getSpi(*_factory, testDocMan));
+ PersistenceProvider::UP spi(getSpi(*_factory, testDocMan));
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
Bucket target1(makeSpiBucket(BucketId(3, 0x02)));
@@ -1680,34 +1704,42 @@ TEST_F(ConformanceTest, testSplitSingleDocumentInSource)
spi->put(source, Timestamp(1), doc, context);
spi->split(source, target1, target2, context);
- testSplitSingleDocumentInSourcePostCondition(*spi, source, target1, target2, testDocMan);
+ testSplitSingleDocumentInSourcePostCondition(
+ spi, source, target1, target2, testDocMan);
if (_factory->hasPersistence()) {
spi.reset();
document::TestDocMan testDocMan2;
spi = getSpi(*_factory, testDocMan2);
- testSplitSingleDocumentInSourcePostCondition(*spi, source, target1, target2, testDocMan2);
+ testSplitSingleDocumentInSourcePostCondition(
+ spi, source, target1, target2, testDocMan2);
}
}
void
ConformanceTest::testSplitSingleDocumentInSourcePostCondition(
- const PersistenceProvider& spi,
+ const PersistenceProvider::UP& spi,
const Bucket& source,
const Bucket& target1,
const Bucket& target2,
document::TestDocMan& testDocMan)
{
- EXPECT_EQ(uint32_t(0), spi.getBucketInfo(source).getBucketInfo().getDocumentCount());
- EXPECT_EQ(uint32_t(0), spi.getBucketInfo(target1).getBucketInfo().getDocumentCount());
- EXPECT_EQ(uint32_t(1), spi.getBucketInfo(target2).getBucketInfo().getDocumentCount());
+ EXPECT_EQ(uint32_t(0),
+ spi->getBucketInfo(source).getBucketInfo().
+ getDocumentCount());
+ EXPECT_EQ(uint32_t(0),
+ spi->getBucketInfo(target1).getBucketInfo().
+ getDocumentCount());
+ EXPECT_EQ(uint32_t(1),
+ spi->getBucketInfo(target2).getBucketInfo().
+ getDocumentCount());
document::AllFields fs;
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
Document::UP doc = testDocMan.createRandomDocumentAtLocation(0x06, 0);
- EXPECT_TRUE(spi.get(target2, fs, doc->getId(), context).hasDocument());
- EXPECT_TRUE(!spi.get(target1, fs, doc->getId(), context).hasDocument());
- EXPECT_TRUE(!spi.get(source, fs, doc->getId(), context).hasDocument());
+ EXPECT_TRUE(spi->get(target2, fs, doc->getId(), context).hasDocument());
+ EXPECT_TRUE(!spi->get(target1, fs, doc->getId(), context).hasDocument());
+ EXPECT_TRUE(!spi->get(source, fs, doc->getId(), context).hasDocument());
}
void
@@ -1744,19 +1776,21 @@ ConformanceTest::doTestJoinNormalCase(const Bucket& source1,
{
document::TestDocMan testDocMan;
_factory->clear();
- PersistenceProviderUP spi(getSpi(*_factory, testDocMan));
+ PersistenceProvider::UP spi(getSpi(*_factory, testDocMan));
createAndPopulateJoinSourceBuckets(*spi, source1, source2, testDocMan);
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
spi->join(source1, source2, target, context);
- testJoinNormalCasePostCondition(*spi, source1, source2, target, testDocMan);
+ testJoinNormalCasePostCondition(spi, source1, source2, target,
+ testDocMan);
if (_factory->hasPersistence()) {
spi.reset();
document::TestDocMan testDocMan2;
spi = getSpi(*_factory, testDocMan2);
- testJoinNormalCasePostCondition(*spi, source1, source2, target, testDocMan2);
+ testJoinNormalCasePostCondition(spi, source1, source2, target,
+ testDocMan2);
}
}
@@ -1778,13 +1812,14 @@ TEST_F(ConformanceTest, testJoinNormalCaseWithMultipleBitsDecreased)
void
ConformanceTest::
-testJoinNormalCasePostCondition(const PersistenceProvider &spi,
+testJoinNormalCasePostCondition(const PersistenceProvider::UP &spi,
const Bucket &bucketA,
const Bucket &bucketB,
const Bucket &bucketC,
document::TestDocMan &testDocMan)
{
- EXPECT_EQ(20, (int)spi.getBucketInfo(bucketC).getBucketInfo().getDocumentCount());
+ EXPECT_EQ(20, (int)spi->getBucketInfo(bucketC).
+ getBucketInfo().getDocumentCount());
document::AllFields fs;
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
@@ -1792,14 +1827,20 @@ testJoinNormalCasePostCondition(const PersistenceProvider &spi,
Document::UP doc(
testDocMan.createRandomDocumentAtLocation(
bucketA.getBucketId().getId(), i));
- EXPECT_TRUE(spi.get(bucketC, fs, doc->getId(), context).hasDocument());
- EXPECT_TRUE(!spi.get(bucketA, fs, doc->getId(), context).hasDocument());
+ EXPECT_TRUE(
+ spi->get(bucketC, fs, doc->getId(), context).hasDocument());
+ EXPECT_TRUE(
+ !spi->get(bucketA, fs, doc->getId(), context).hasDocument());
}
for (uint32_t i = 10; i < 20; ++i) {
- Document::UP doc(testDocMan.createRandomDocumentAtLocation(bucketB.getBucketId().getId(), i));
- EXPECT_TRUE(spi.get(bucketC, fs, doc->getId(), context).hasDocument());
- EXPECT_TRUE(!spi.get(bucketB, fs, doc->getId(), context).hasDocument());
+ Document::UP doc(
+ testDocMan.createRandomDocumentAtLocation(
+ bucketB.getBucketId().getId(), i));
+ EXPECT_TRUE(
+ spi->get(bucketC, fs, doc->getId(), context).hasDocument());
+ EXPECT_TRUE(
+ !spi->get(bucketB, fs, doc->getId(), context).hasDocument());
}
}
@@ -1808,7 +1849,7 @@ TEST_F(ConformanceTest, testJoinTargetExists)
{
document::TestDocMan testDocMan;
_factory->clear();
- PersistenceProviderUP spi(getSpi(*_factory, testDocMan));
+ PersistenceProvider::UP spi(getSpi(*_factory, testDocMan));
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
Bucket bucketA(makeSpiBucket(BucketId(3, 0x02)));
@@ -1837,43 +1878,51 @@ TEST_F(ConformanceTest, testJoinTargetExists)
}
spi->join(bucketA, bucketB, bucketC, context);
- testJoinTargetExistsPostCondition(*spi, bucketA, bucketB, bucketC, testDocMan);
+ testJoinTargetExistsPostCondition(spi, bucketA, bucketB, bucketC,
+ testDocMan);
if (_factory->hasPersistence()) {
spi.reset();
document::TestDocMan testDocMan2;
spi = getSpi(*_factory, testDocMan2);
- testJoinTargetExistsPostCondition(*spi, bucketA, bucketB, bucketC, testDocMan2);
+ testJoinTargetExistsPostCondition(spi, bucketA, bucketB, bucketC,
+ testDocMan2);
}
}
void
ConformanceTest::
-testJoinTargetExistsPostCondition(const PersistenceProvider &spi,
+testJoinTargetExistsPostCondition(const PersistenceProvider::UP &spi,
const Bucket &bucketA,
const Bucket &bucketB,
const Bucket &bucketC,
document::TestDocMan &testDocMan)
{
- EXPECT_EQ(30, (int)spi.getBucketInfo(bucketC).getBucketInfo().getDocumentCount());
+ EXPECT_EQ(30, (int)spi->getBucketInfo(bucketC).getBucketInfo().
+ getDocumentCount());
document::AllFields fs;
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
for (uint32_t i = 0; i < 10; ++i) {
Document::UP doc1 = testDocMan.createRandomDocumentAtLocation(0x02, i);
- EXPECT_TRUE(spi.get(bucketC, fs, doc1->getId(), context).hasDocument());
- EXPECT_TRUE(!spi.get(bucketA, fs, doc1->getId(), context).hasDocument());
+ EXPECT_TRUE(
+ spi->get(bucketC, fs, doc1->getId(), context).hasDocument());
+ EXPECT_TRUE(
+ !spi->get(bucketA, fs, doc1->getId(), context).hasDocument());
}
for (uint32_t i = 10; i < 20; ++i) {
Document::UP doc1 = testDocMan.createRandomDocumentAtLocation(0x06, i);
- EXPECT_TRUE(spi.get(bucketC, fs, doc1->getId(), context).hasDocument());
- EXPECT_TRUE(!spi.get(bucketB, fs, doc1->getId(), context).hasDocument());
+ EXPECT_TRUE(
+ spi->get(bucketC, fs, doc1->getId(), context).hasDocument());
+ EXPECT_TRUE(
+ !spi->get(bucketB, fs, doc1->getId(), context).hasDocument());
}
for (uint32_t i = 20; i < 30; ++i) {
Document::UP doc1 = testDocMan.createRandomDocumentAtLocation(0x06, i);
- EXPECT_TRUE(spi.get(bucketC, fs, doc1->getId(), context).hasDocument());
+ EXPECT_TRUE(
+ spi->get(bucketC, fs, doc1->getId(), context).hasDocument());
}
}
@@ -1888,7 +1937,8 @@ ConformanceTest::populateBucket(const Bucket& b,
assert(from <= to);
for (uint32_t i = from; i < to; ++i) {
const uint32_t location = b.getBucketId().getId();
- Document::SP doc1 = testDocMan.createRandomDocumentAtLocation(location, i);
+ Document::SP doc1 = testDocMan.createRandomDocumentAtLocation(
+ location, i);
spi.put(b, Timestamp(i + 1), doc1, context);
}
}
@@ -1897,7 +1947,7 @@ TEST_F(ConformanceTest, testJoinOneBucket)
{
document::TestDocMan testDocMan;
_factory->clear();
- PersistenceProviderUP spi(getSpi(*_factory, testDocMan));
+ PersistenceProvider::UP spi(getSpi(*_factory, testDocMan));
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
Bucket bucketA(makeSpiBucket(BucketId(3, 0x02)));
@@ -1909,37 +1959,40 @@ TEST_F(ConformanceTest, testJoinOneBucket)
populateBucket(bucketA, *spi, context, 0, 10, testDocMan);
spi->join(bucketA, bucketB, bucketC, context);
- testJoinOneBucketPostCondition(*spi, bucketA, bucketC, testDocMan);
+ testJoinOneBucketPostCondition(spi, bucketA, bucketC, testDocMan);
if (_factory->hasPersistence()) {
spi.reset();
document::TestDocMan testDocMan2;
spi = getSpi(*_factory, testDocMan2);
- testJoinOneBucketPostCondition(*spi, bucketA, bucketC, testDocMan2);
+ testJoinOneBucketPostCondition(spi, bucketA, bucketC, testDocMan2);
}
}
void
ConformanceTest::
-testJoinOneBucketPostCondition(const PersistenceProvider &spi,
+testJoinOneBucketPostCondition(const PersistenceProvider::UP &spi,
const Bucket &bucketA,
const Bucket &bucketC,
document::TestDocMan &testDocMan)
{
- EXPECT_EQ(10, (int)spi.getBucketInfo(bucketC).getBucketInfo().getDocumentCount());
+ EXPECT_EQ(10, (int)spi->getBucketInfo(bucketC).getBucketInfo().
+ getDocumentCount());
document::AllFields fs;
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
for (uint32_t i = 0; i < 10; ++i) {
Document::UP doc1 = testDocMan.createRandomDocumentAtLocation(0x02, i);
- EXPECT_TRUE(spi.get(bucketC, fs, doc1->getId(), context).hasDocument());
- EXPECT_TRUE(!spi.get(bucketA, fs, doc1->getId(), context).hasDocument());
+ EXPECT_TRUE(
+ spi->get(bucketC, fs, doc1->getId(), context).hasDocument());
+ EXPECT_TRUE(
+ !spi->get(bucketA, fs, doc1->getId(), context).hasDocument());
}
}
void
ConformanceTest::
testJoinSameSourceBucketsPostCondition(
- const PersistenceProvider& spi,
+ const PersistenceProvider::UP& spi,
const Bucket& source,
const Bucket& target,
document::TestDocMan& testDocMan)
@@ -1949,23 +2002,25 @@ testJoinSameSourceBucketsPostCondition(
}
void
-ConformanceTest::doTestJoinSameSourceBuckets(const Bucket& source, const Bucket& target)
+ConformanceTest::doTestJoinSameSourceBuckets(const Bucket& source,
+ const Bucket& target)
{
document::TestDocMan testDocMan;
_factory->clear();
- PersistenceProviderUP spi(getSpi(*_factory, testDocMan));
+ PersistenceProvider::UP spi(getSpi(*_factory, testDocMan));
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
spi->createBucket(source, context);
populateBucket(source, *spi, context, 0, 10, testDocMan);
spi->join(source, source, target, context);
- testJoinSameSourceBucketsPostCondition(*spi, source, target, testDocMan);
+ testJoinSameSourceBucketsPostCondition(spi, source, target, testDocMan);
if (_factory->hasPersistence()) {
spi.reset();
document::TestDocMan testDocMan2;
spi = getSpi(*_factory, testDocMan2);
- testJoinSameSourceBucketsPostCondition(*spi, source, target, testDocMan2);
+ testJoinSameSourceBucketsPostCondition(
+ spi, source, target, testDocMan2);
}
}
@@ -1990,14 +2045,17 @@ ConformanceTest::testJoinSameSourceBucketsTargetExistsPostCondition(
const Bucket& target,
document::TestDocMan& testDocMan)
{
- EXPECT_EQ(20, (int)spi.getBucketInfo(target).getBucketInfo().getDocumentCount());
+ EXPECT_EQ(20, (int)spi.getBucketInfo(target).getBucketInfo().
+ getDocumentCount());
document::AllFields fs;
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
for (uint32_t i = 0; i < 20; ++i) {
Document::UP doc1 = testDocMan.createRandomDocumentAtLocation(0x02, i);
- EXPECT_TRUE(spi.get(target, fs, doc1->getId(), context).hasDocument());
- EXPECT_TRUE(!spi.get(source, fs, doc1->getId(), context).hasDocument());
+ EXPECT_TRUE(
+ spi.get(target, fs, doc1->getId(), context).hasDocument());
+ EXPECT_TRUE(
+ !spi.get(source, fs, doc1->getId(), context).hasDocument());
}
}
@@ -2005,7 +2063,7 @@ TEST_F(ConformanceTest, testJoinSameSourceBucketsTargetExists)
{
document::TestDocMan testDocMan;
_factory->clear();
- PersistenceProviderUP spi(getSpi(*_factory, testDocMan));
+ PersistenceProvider::UP spi(getSpi(*_factory, testDocMan));
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
Bucket source(makeSpiBucket(BucketId(3, 0x02)));
@@ -2024,7 +2082,8 @@ TEST_F(ConformanceTest, testJoinSameSourceBucketsTargetExists)
spi.reset();
document::TestDocMan testDocMan2;
spi = getSpi(*_factory, testDocMan2);
- testJoinSameSourceBucketsTargetExistsPostCondition(*spi, source, target, testDocMan2);
+ testJoinSameSourceBucketsTargetExistsPostCondition(
+ *spi, source, target, testDocMan2);
}
}
@@ -2032,8 +2091,9 @@ TEST_F(ConformanceTest, testGetModifiedBuckets)
{
document::TestDocMan testDocMan;
_factory->clear();
- PersistenceProviderUP spi(getSpi(*_factory, testDocMan));
- EXPECT_EQ(0, (int)spi->getModifiedBuckets(makeBucketSpace()).getList().size());
+ PersistenceProvider::UP spi(getSpi(*_factory, testDocMan));
+ EXPECT_EQ(0,
+ (int)spi->getModifiedBuckets(makeBucketSpace()).getList().size());
}
TEST_F(ConformanceTest, testBucketActivation)
@@ -2044,7 +2104,7 @@ TEST_F(ConformanceTest, testBucketActivation)
document::TestDocMan testDocMan;
_factory->clear();
- PersistenceProviderUP spi(getSpi(*_factory, testDocMan));
+ PersistenceProvider::UP spi(getSpi(*_factory, testDocMan));
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
Bucket bucket(makeSpiBucket(BucketId(8, 0x01)));
@@ -2087,7 +2147,7 @@ TEST_F(SingleDocTypeConformanceTest, testBucketActivationSplitAndJoin)
document::TestDocMan testDocMan;
_factory->clear();
- PersistenceProviderUP spi(getSpi(*_factory, testDocMan));
+ PersistenceProvider::UP spi(getSpi(*_factory, testDocMan));
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
Bucket bucketA(makeSpiBucket(BucketId(3, 0x02)));
@@ -2165,7 +2225,7 @@ TEST_F(ConformanceTest, testRemoveEntry)
}
document::TestDocMan testDocMan;
_factory->clear();
- PersistenceProviderUP spi(getSpi(*_factory, testDocMan));
+ PersistenceProvider::UP spi(getSpi(*_factory, testDocMan));
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
Bucket bucket(makeSpiBucket(BucketId(8, 0x01)));
@@ -2234,7 +2294,7 @@ TEST_F(ConformanceTest, testBucketSpaces)
}
document::TestDocMan testDocMan;
_factory->clear();
- PersistenceProviderUP spi(getSpi(*_factory, testDocMan));
+ PersistenceProvider::UP spi(getSpi(*_factory, testDocMan));
Context context(defaultLoadType, Priority(0), Trace::TraceLevel(0));
BucketSpace bucketSpace0(makeBucketSpace("testdoctype1"));
BucketSpace bucketSpace1(makeBucketSpace("testdoctype2"));
diff --git a/persistence/src/vespa/persistence/conformancetest/conformancetest.h b/persistence/src/vespa/persistence/conformancetest/conformancetest.h
index 19be63cf3cb..05c1bc87c9f 100644
--- a/persistence/src/vespa/persistence/conformancetest/conformancetest.h
+++ b/persistence/src/vespa/persistence/conformancetest/conformancetest.h
@@ -26,13 +26,12 @@ namespace storage::spi {
class ConformanceTest : public ::testing::Test {
public:
- using PersistenceProviderUP = std::unique_ptr<PersistenceProvider>;
struct PersistenceFactory {
typedef std::unique_ptr<PersistenceFactory> UP;
using DocumenttypesConfig = const document::internal::InternalDocumenttypesType;
- virtual ~PersistenceFactory() = default;
- virtual PersistenceProviderUP getPersistenceImplementation(
+ virtual ~PersistenceFactory() {}
+ virtual PersistenceProvider::UP getPersistenceImplementation(
const std::shared_ptr<const document::DocumentTypeRepo> &repo,
const DocumenttypesConfig &typesCfg) = 0;
@@ -75,19 +74,19 @@ protected:
document::TestDocMan& testDocMan);
void
- testDeleteBucketPostCondition(const PersistenceProvider &spi,
+ testDeleteBucketPostCondition(const PersistenceProvider::UP &spi,
const Bucket &bucket,
const Document &doc1);
void
- testSplitNormalCasePostCondition(const PersistenceProvider &spi,
+ testSplitNormalCasePostCondition(const PersistenceProvider::UP &spi,
const Bucket &bucketA,
const Bucket &bucketB,
const Bucket &bucketC,
document::TestDocMan &testDocMan);
void
- testSplitTargetExistsPostCondition(const PersistenceProvider &spi,
+ testSplitTargetExistsPostCondition(const PersistenceProvider::UP &spi,
const Bucket &bucketA,
const Bucket &bucketB,
const Bucket &bucketC,
@@ -95,7 +94,7 @@ protected:
void
testSplitSingleDocumentInSourcePostCondition(
- const PersistenceProvider& spi,
+ const PersistenceProvider::UP& spi,
const Bucket& source,
const Bucket& target1,
const Bucket& target2,
@@ -114,21 +113,21 @@ protected:
const Bucket& target);
void
- testJoinNormalCasePostCondition(const PersistenceProvider &spi,
+ testJoinNormalCasePostCondition(const PersistenceProvider::UP &spi,
const Bucket &bucketA,
const Bucket &bucketB,
const Bucket &bucketC,
document::TestDocMan &testDocMan);
void
- testJoinTargetExistsPostCondition(const PersistenceProvider &spi,
+ testJoinTargetExistsPostCondition(const PersistenceProvider::UP &spi,
const Bucket &bucketA,
const Bucket &bucketB,
const Bucket &bucketC,
document::TestDocMan &testDocMan);
void
- testJoinOneBucketPostCondition(const PersistenceProvider &spi,
+ testJoinOneBucketPostCondition(const PersistenceProvider::UP &spi,
const Bucket &bucketA,
const Bucket &bucketC,
document::TestDocMan &testDocMan);
@@ -139,7 +138,7 @@ protected:
void
testJoinSameSourceBucketsPostCondition(
- const PersistenceProvider& spi,
+ const PersistenceProvider::UP& spi,
const Bucket& source,
const Bucket& target,
document::TestDocMan& testDocMan);
diff --git a/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp b/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp
index 297a3319939..73783413061 100644
--- a/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp
+++ b/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp
@@ -547,7 +547,12 @@ DummyPersistence::get(const Bucket& b, const document::FieldSet& fieldSet, const
}
CreateIteratorResult
-DummyPersistence::createIterator(const Bucket &b, FieldSetSP fs, const Selection &s, IncludedVersions v, Context &)
+DummyPersistence::createIterator(
+ const Bucket& b,
+ const document::FieldSet& fs,
+ const Selection& s,
+ IncludedVersions v,
+ Context&)
{
DUMMYPERSISTENCE_VERIFY_INITIALIZED;
LOG(debug, "createIterator(%s)", b.toString().c_str());
@@ -580,7 +585,7 @@ DummyPersistence::createIterator(const Bucket &b, FieldSetSP fs, const Selection
}
// Memory pointed to by 'it' should now be valid from here on out
- it->_fieldSet = std::move(fs);
+ it->_fieldSet = std::unique_ptr<document::FieldSet>(fs.clone());
const BucketContent::GidMapType& gidMap((*bc)->_gidMap);
if (s.getTimestampSubset().empty()) {
@@ -595,7 +600,8 @@ DummyPersistence::createIterator(const Bucket &b, FieldSetSP fs, const Selection
entry.getTimestamp() > s.getToTimestamp()) {
continue;
}
- BucketContent::GidMapType::const_iterator gidIt(gidMap.find(bucketEntry.gid));
+ BucketContent::GidMapType::const_iterator gidIt(
+ gidMap.find(bucketEntry.gid));
assert(gidIt != gidMap.end());
if (entry.isRemove()) {
diff --git a/persistence/src/vespa/persistence/dummyimpl/dummypersistence.h b/persistence/src/vespa/persistence/dummyimpl/dummypersistence.h
index c3a4991a590..94c2e1cd9a4 100644
--- a/persistence/src/vespa/persistence/dummyimpl/dummypersistence.h
+++ b/persistence/src/vespa/persistence/dummyimpl/dummypersistence.h
@@ -93,7 +93,7 @@ struct Iterator {
using UP = std::unique_ptr<Iterator>;
Bucket _bucket;
std::vector<Timestamp> _leftToIterate;
- std::shared_ptr<document::FieldSet> _fieldSet;
+ std::unique_ptr<document::FieldSet> _fieldSet;
};
class DummyPersistence;
@@ -158,8 +158,11 @@ public:
RemoveResult remove(const Bucket& b, Timestamp t, const DocumentId& did, Context&) override;
UpdateResult update(const Bucket&, Timestamp, DocumentUpdateSP, Context&) override;
- CreateIteratorResult
- createIterator(const Bucket &bucket, FieldSetSP fs, const Selection &, IncludedVersions, Context &context) override;
+ CreateIteratorResult createIterator(const Bucket&,
+ const document::FieldSet& fs,
+ const Selection&,
+ IncludedVersions,
+ Context&) override;
IterateResult iterate(IteratorId, uint64_t maxByteSize, Context&) const override;
Result destroyIterator(IteratorId, Context&) override;
diff --git a/persistence/src/vespa/persistence/spi/persistenceprovider.h b/persistence/src/vespa/persistence/spi/persistenceprovider.h
index 021ac6338eb..2bb91c776d0 100644
--- a/persistence/src/vespa/persistence/spi/persistenceprovider.h
+++ b/persistence/src/vespa/persistence/spi/persistenceprovider.h
@@ -56,8 +56,8 @@ namespace storage::spi {
*/
struct PersistenceProvider
{
+ typedef std::unique_ptr<PersistenceProvider> UP;
using BucketSpace = document::BucketSpace;
- using FieldSetSP = std::shared_ptr<document::FieldSet>;
virtual ~PersistenceProvider();
@@ -258,9 +258,12 @@ struct PersistenceProvider
* error. Identifier must be non-zero, as zero is used internally to
* signify an invalid iterator ID.
*/
- virtual CreateIteratorResult
- createIterator(const Bucket &bucket, FieldSetSP fieldSet, const Selection &selection,
- IncludedVersions versions, Context &context) = 0;
+ virtual CreateIteratorResult createIterator(
+ const Bucket&,
+ const document::FieldSet& fieldSet,
+ const Selection& selection, //TODO: Make AST
+ IncludedVersions versions,
+ Context&) = 0;
/**
* Iterate over a bucket's document space using a valid iterator id