diff options
Diffstat (limited to 'persistence')
10 files changed, 259 insertions, 323 deletions
diff --git a/persistence/src/vespa/persistence/conformancetest/conformancetest.cpp b/persistence/src/vespa/persistence/conformancetest/conformancetest.cpp index 6f05a1a7b79..bf1c828e2e6 100644 --- a/persistence/src/vespa/persistence/conformancetest/conformancetest.cpp +++ b/persistence/src/vespa/persistence/conformancetest/conformancetest.cpp @@ -153,8 +153,7 @@ doIterate(PersistenceProvider& spi, std::vector<Chunk> chunks; while (true) { - Context context(Priority(0), Trace::TraceLevel(0)); - IterateResult result(spi.iterate(id, maxByteSize, context)); + IterateResult result(spi.iterate(id, maxByteSize)); EXPECT_EQ(Result::ErrorType::NONE, result.getErrorCode()); @@ -213,7 +212,7 @@ iterateBucket(PersistenceProvider& spi, while (true) { IterateResult result = spi.iterate(iter.getIteratorId(), - std::numeric_limits<int64_t>().max(), context); + std::numeric_limits<int64_t>().max()); if (result.getErrorCode() != Result::ErrorType::NONE) { return DocEntryList(); } @@ -224,7 +223,7 @@ iterateBucket(PersistenceProvider& spi, } } - spi.destroyIterator(iter.getIteratorId(), context); + spi.destroyIterator(iter.getIteratorId()); std::sort(ret.begin(), ret.end(), DocEntryIndirectTimestampComparator()); @@ -279,7 +278,6 @@ feedDocs(PersistenceProvider& spi, uint32_t maxSize = 110) { std::vector<DocAndTimestamp> docs; - Context context(Priority(0), Trace::TraceLevel(0)); for (uint32_t i = 0; i < numDocs; ++i) { Document::SP doc( testDocMan.createRandomDocumentAtLocation( @@ -287,7 +285,7 @@ feedDocs(PersistenceProvider& spi, i, minSize, maxSize)); - Result result = spi.put(bucket, Timestamp(1000 + i), doc, context); + Result result = spi.put(bucket, Timestamp(1000 + i), doc); EXPECT_TRUE(!result.hasError()); docs.push_back(DocAndTimestamp(doc, Timestamp(1000 + i))); } @@ -330,10 +328,10 @@ TEST_F(ConformanceTest, testBasics) Bucket bucket(makeSpiBucket(BucketId(8, 0x01))); Document::SP doc1 = testDocMan.createRandomDocumentAtLocation(0x01, 1); Document::SP doc2 = testDocMan.createRandomDocumentAtLocation(0x01, 2); - spi->createBucket(bucket, context); - EXPECT_EQ(Result(), Result(spi->put(bucket, Timestamp(1), doc1, context))); - EXPECT_EQ(Result(), Result(spi->put(bucket, Timestamp(2), doc2, context))); - EXPECT_EQ(Result(), Result(spi->remove(bucket, Timestamp(3), doc1->getId(), context))); + spi->createBucket(bucket); + EXPECT_EQ(Result(), Result(spi->put(bucket, Timestamp(1), doc1))); + EXPECT_EQ(Result(), Result(spi->put(bucket, Timestamp(2), doc2))); + EXPECT_EQ(Result(), Result(spi->remove(bucket, Timestamp(3), doc1->getId()))); // Iterate first without removes, then with. for (int iterPass = 0; iterPass < 2; ++iterPass) { @@ -352,11 +350,11 @@ TEST_F(ConformanceTest, testBasics) EXPECT_EQ(Result(), Result(iter)); - IterateResult result = spi->iterate(iter.getIteratorId(), std::numeric_limits<int64_t>().max(), context); + IterateResult result = spi->iterate(iter.getIteratorId(), std::numeric_limits<int64_t>().max()); EXPECT_EQ(Result(), Result(result)); EXPECT_TRUE(result.isCompleted()); - spi->destroyIterator(iter.getIteratorId(), context); + spi->destroyIterator(iter.getIteratorId()); Timestamp timeDoc1(0); Timestamp timeDoc2(0); @@ -411,14 +409,13 @@ TEST_F(ConformanceTest, testListBuckets) Document::SP doc1 = testDocMan.createRandomDocumentAtLocation(0x01, 1); Document::SP doc2 = testDocMan.createRandomDocumentAtLocation(0x02, 2); Document::SP doc3 = testDocMan.createRandomDocumentAtLocation(0x03, 3); - Context context(Priority(0), Trace::TraceLevel(0)); - spi->createBucket(bucket1, context); - spi->createBucket(bucket2, context); - spi->createBucket(bucket3, context); + spi->createBucket(bucket1); + spi->createBucket(bucket2); + spi->createBucket(bucket3); - spi->put(bucket1, Timestamp(1), doc1, context); - spi->put(bucket2, Timestamp(2), doc2, context); - spi->put(bucket3, Timestamp(3), doc3, context); + spi->put(bucket1, Timestamp(1), doc1); + spi->put(bucket2, Timestamp(2), doc2); + spi->put(bucket3, Timestamp(3), doc3); { BucketIdListResult result = spi->listBuckets(makeBucketSpace()); @@ -444,10 +441,9 @@ TEST_F(ConformanceTest, testBucketInfo) Document::SP doc1 = testDocMan.createRandomDocumentAtLocation(0x01, 1); Document::SP doc2 = testDocMan.createRandomDocumentAtLocation(0x01, 2); - Context context(Priority(0), Trace::TraceLevel(0)); - spi->createBucket(bucket, context); + spi->createBucket(bucket); - spi->put(bucket, Timestamp(2), doc2, context); + spi->put(bucket, Timestamp(2), doc2); const BucketInfo info1 = spi->getBucketInfo(bucket).getBucketInfo(); @@ -456,7 +452,7 @@ TEST_F(ConformanceTest, testBucketInfo) EXPECT_TRUE(info1.getChecksum() != 0); } - spi->put(bucket, Timestamp(3), doc1, context); + spi->put(bucket, Timestamp(3), doc1); const BucketInfo info2 = spi->getBucketInfo(bucket).getBucketInfo(); @@ -466,7 +462,7 @@ TEST_F(ConformanceTest, testBucketInfo) EXPECT_TRUE(info2.getChecksum() != info1.getChecksum()); } - spi->put(bucket, Timestamp(4), doc1, context); + spi->put(bucket, Timestamp(4), doc1); const BucketInfo info3 = spi->getBucketInfo(bucket).getBucketInfo(); @@ -476,7 +472,7 @@ TEST_F(ConformanceTest, testBucketInfo) EXPECT_TRUE(info3.getChecksum() != info2.getChecksum()); } - spi->remove(bucket, Timestamp(5), doc1->getId(), context); + spi->remove(bucket, Timestamp(5), doc1->getId()); const BucketInfo info4 = spi->getBucketInfo(bucket).getBucketInfo(); @@ -501,21 +497,20 @@ TEST_F(ConformanceTest, testOrderIndependentBucketInfo) Document::SP doc1 = testDocMan.createRandomDocumentAtLocation(0x01, 1); Document::SP doc2 = testDocMan.createRandomDocumentAtLocation(0x01, 2); - Context context(Priority(0), Trace::TraceLevel(0)); - spi->createBucket(bucket, context); + spi->createBucket(bucket); BucketChecksum checksumOrdered(0); { - spi->put(bucket, Timestamp(2), doc1, context); - spi->put(bucket, Timestamp(3), doc2, context); + spi->put(bucket, Timestamp(2), doc1); + spi->put(bucket, Timestamp(3), doc2); const BucketInfo info(spi->getBucketInfo(bucket).getBucketInfo()); checksumOrdered = info.getChecksum(); EXPECT_TRUE(checksumOrdered != 0); } - spi->deleteBucket(bucket, context); - spi->createBucket(bucket, context); + spi->deleteBucket(bucket); + spi->createBucket(bucket); { const BucketInfo info(spi->getBucketInfo(bucket).getBucketInfo()); EXPECT_EQ(BucketChecksum(0), info.getChecksum()); @@ -524,8 +519,8 @@ TEST_F(ConformanceTest, testOrderIndependentBucketInfo) BucketChecksum checksumUnordered(0); { // Swap order of puts - spi->put(bucket, Timestamp(3), doc2, context); - spi->put(bucket, Timestamp(2), doc1, context); + spi->put(bucket, Timestamp(3), doc2); + spi->put(bucket, Timestamp(2), doc1); const BucketInfo info(spi->getBucketInfo(bucket).getBucketInfo()); checksumUnordered = info.getChecksum(); @@ -540,14 +535,13 @@ TEST_F(ConformanceTest, testPut) document::TestDocMan testDocMan; _factory->clear(); PersistenceProviderUP spi(getSpi(*_factory, testDocMan)); - Context context(Priority(0), Trace::TraceLevel(0)); Bucket bucket(makeSpiBucket(BucketId(8, 0x01))); Document::SP doc1 = testDocMan.createRandomDocumentAtLocation(0x01, 1); Document::SP doc2 = testDocMan.createRandomDocumentAtLocation(0x01, 2); - spi->createBucket(bucket, context); + spi->createBucket(bucket); - Result result = spi->put(bucket, Timestamp(3), doc1, context); + Result result = spi->put(bucket, Timestamp(3), doc1); { const BucketInfo info = spi->getBucketInfo(bucket).getBucketInfo(); @@ -571,9 +565,9 @@ TEST_F(ConformanceTest, testPutNewDocumentVersion) Document::SP doc1 = testDocMan.createRandomDocumentAtLocation(0x01, 1); Document::SP doc2(doc1->clone()); doc2->setValue("content", document::StringFieldValue("hiho silver")); - spi->createBucket(bucket, context); + spi->createBucket(bucket); - Result result = spi->put(bucket, Timestamp(3), doc1, context); + Result result = spi->put(bucket, Timestamp(3), doc1); { const BucketInfo info = spi->getBucketInfo(bucket).getBucketInfo(); @@ -584,7 +578,7 @@ TEST_F(ConformanceTest, testPutNewDocumentVersion) EXPECT_TRUE(info.getUsedSize() >= info.getDocumentSize()); } - result = spi->put(bucket, Timestamp(4), doc2, context); + result = spi->put(bucket, Timestamp(4), doc2); { const BucketInfo info = spi->getBucketInfo(bucket).getBucketInfo(); @@ -621,9 +615,9 @@ TEST_F(ConformanceTest, testPutOlderDocumentVersion) Document::SP doc1 = testDocMan.createRandomDocumentAtLocation(0x01, 1); Document::SP doc2(doc1->clone()); doc2->setValue("content", document::StringFieldValue("hiho silver")); - spi->createBucket(bucket, context); + spi->createBucket(bucket); - Result result = spi->put(bucket, Timestamp(5), doc1, context); + Result result = spi->put(bucket, Timestamp(5), doc1); const BucketInfo info1 = spi->getBucketInfo(bucket).getBucketInfo(); { EXPECT_EQ(1, (int)info1.getDocumentCount()); @@ -633,7 +627,7 @@ TEST_F(ConformanceTest, testPutOlderDocumentVersion) EXPECT_TRUE(info1.getUsedSize() >= info1.getDocumentSize()); } - result = spi->put(bucket, Timestamp(4), doc2, context); + result = spi->put(bucket, Timestamp(4), doc2); { const BucketInfo info2 = spi->getBucketInfo(bucket).getBucketInfo(); @@ -657,12 +651,11 @@ TEST_F(ConformanceTest, testPutDuplicate) document::TestDocMan testDocMan; _factory->clear(); PersistenceProviderUP spi(getSpi(*_factory, testDocMan)); - Context context(Priority(0), Trace::TraceLevel(0)); Bucket bucket(makeSpiBucket(BucketId(8, 0x01))); Document::SP doc1 = testDocMan.createRandomDocumentAtLocation(0x01, 1); - spi->createBucket(bucket, context); - EXPECT_EQ(Result(), spi->put(bucket, Timestamp(3), doc1, context)); + spi->createBucket(bucket); + EXPECT_EQ(Result(), spi->put(bucket, Timestamp(3), doc1)); BucketChecksum checksum; { @@ -670,7 +663,7 @@ TEST_F(ConformanceTest, testPutDuplicate) EXPECT_EQ(1, (int)info.getDocumentCount()); checksum = info.getChecksum(); } - EXPECT_EQ(Result(), spi->put(bucket, Timestamp(3), doc1, context)); + EXPECT_EQ(Result(), spi->put(bucket, Timestamp(3), doc1)); { const BucketInfo info = spi->getBucketInfo(bucket).getBucketInfo(); @@ -691,9 +684,9 @@ TEST_F(ConformanceTest, testRemove) Bucket bucket(makeSpiBucket(BucketId(8, 0x01))); Document::SP doc1 = testDocMan.createRandomDocumentAtLocation(0x01, 1); Document::SP doc2 = testDocMan.createRandomDocumentAtLocation(0x01, 2); - spi->createBucket(bucket, context); + spi->createBucket(bucket); - Result result = spi->put(bucket, Timestamp(3), doc1, context); + Result result = spi->put(bucket, Timestamp(3), doc1); { const BucketInfo info = spi->getBucketInfo(bucket).getBucketInfo(); @@ -706,7 +699,7 @@ TEST_F(ConformanceTest, testRemove) } // Add a remove entry - RemoveResult result2 = spi->remove(bucket, Timestamp(5), doc1->getId(), context); + RemoveResult result2 = spi->remove(bucket, Timestamp(5), doc1->getId()); { const BucketInfo info = spi->getBucketInfo(bucket).getBucketInfo(); @@ -726,7 +719,7 @@ TEST_F(ConformanceTest, testRemove) } // Result tagged as document not found - RemoveResult result3 = spi->remove(bucket, Timestamp(7), doc1->getId(), context); + RemoveResult result3 = spi->remove(bucket, Timestamp(7), doc1->getId()); { const BucketInfo info = spi->getBucketInfo(bucket).getBucketInfo(); @@ -735,11 +728,11 @@ TEST_F(ConformanceTest, testRemove) EXPECT_EQ(false, result3.wasFound()); } - Result result4 = spi->put(bucket, Timestamp(9), doc1, context); + Result result4 = spi->put(bucket, Timestamp(9), doc1); EXPECT_TRUE(!result4.hasError()); - RemoveResult result5 = spi->remove(bucket, Timestamp(9), doc1->getId(), context); + RemoveResult result5 = spi->remove(bucket, Timestamp(9), doc1->getId()); { const BucketInfo info = spi->getBucketInfo(bucket).getBucketInfo(); @@ -765,8 +758,7 @@ TEST_F(ConformanceTest, testRemoveMulti) BucketId bucketId1(8, 0x01); Bucket bucket1(makeSpiBucket(bucketId1)); - Context context(Priority(0), Trace::TraceLevel(0)); - spi->createBucket(bucket1, context); + spi->createBucket(bucket1); std::vector<Document::SP> docs; for (size_t i(0); i < 30; i++) { @@ -775,7 +767,7 @@ TEST_F(ConformanceTest, testRemoveMulti) std::vector<PersistenceProvider::TimeStampAndDocumentId> ids; for (size_t i(0); i < docs.size(); i++) { - spi->put(bucket1, Timestamp(i), docs[i], context); + spi->put(bucket1, Timestamp(i), docs[i]); if (i & 0x1) { ids.emplace_back(Timestamp(i), docs[i]->getId()); } @@ -783,7 +775,7 @@ TEST_F(ConformanceTest, testRemoveMulti) auto onDone = std::make_unique<CatchResult>(); auto future = onDone->future_result(); - spi->removeAsync(bucket1, ids, context, std::move(onDone)); + spi->removeAsync(bucket1, ids, std::move(onDone)); auto result = future.get(); ASSERT_TRUE(result); auto removeResult = dynamic_cast<spi::RemoveResult *>(result.get()); @@ -796,18 +788,17 @@ TEST_F(ConformanceTest, testRemoveMerge) document::TestDocMan testDocMan; _factory->clear(); PersistenceProviderUP spi(getSpi(*_factory, testDocMan)); - Context context(Priority(0), Trace::TraceLevel(0)); Bucket bucket(makeSpiBucket(BucketId(8, 0x01))); Document::SP doc1 = testDocMan.createRandomDocumentAtLocation(0x01, 1); DocumentId removeId("id:fraggle:testdoctype1:n=1:rock"); - spi->createBucket(bucket, context); + spi->createBucket(bucket); - Result result = spi->put(bucket, Timestamp(3), doc1, context); + Result result = spi->put(bucket, Timestamp(3), doc1); // Remove a document that does not exist { - RemoveResult removeResult = spi->remove(bucket, Timestamp(10), removeId, context); + RemoveResult removeResult = spi->remove(bucket, Timestamp(10), removeId); EXPECT_EQ(Result::ErrorType::NONE, removeResult.getErrorCode()); EXPECT_EQ(false, removeResult.wasFound()); } @@ -830,7 +821,7 @@ TEST_F(ConformanceTest, testRemoveMerge) } // Add a _newer_ remove for the same document ID we already removed { - RemoveResult removeResult = spi->remove(bucket, Timestamp(11), removeId, context); + RemoveResult removeResult = spi->remove(bucket, Timestamp(11), removeId); EXPECT_EQ(Result::ErrorType::NONE, removeResult.getErrorCode()); EXPECT_EQ(false, removeResult.wasFound()); } @@ -854,7 +845,7 @@ TEST_F(ConformanceTest, testRemoveMerge) // It may or may not be present in a subsequent iteration, but the // newest timestamp must still be present. { - RemoveResult removeResult = spi->remove(bucket, Timestamp(7), removeId, context); + RemoveResult removeResult = spi->remove(bucket, Timestamp(7), removeId); EXPECT_EQ(Result::ErrorType::NONE, removeResult.getErrorCode()); EXPECT_EQ(false, removeResult.wasFound()); } @@ -884,21 +875,21 @@ TEST_F(ConformanceTest, testUpdate) Context context(Priority(0), Trace::TraceLevel(0)); Bucket bucket(makeSpiBucket(BucketId(8, 0x01))); - spi->createBucket(bucket, context); + spi->createBucket(bucket); const document::DocumentType *docType(testDocMan.getTypeRepo().getDocumentType("testdoctype1")); document::DocumentUpdate::SP update(new DocumentUpdate(testDocMan.getTypeRepo(), *docType, doc1->getId())); update->addUpdate(FieldUpdate(docType->getField("headerval")).addUpdate(std::make_unique<AssignValueUpdate>(std::make_unique<IntFieldValue>(42)))); { - UpdateResult result = spi->update(bucket, Timestamp(3), update, context); + UpdateResult result = spi->update(bucket, Timestamp(3), update); EXPECT_EQ(Result(), Result(result)); EXPECT_EQ(Timestamp(0), result.getExistingTimestamp()); } - spi->put(bucket, Timestamp(3), doc1, context); + spi->put(bucket, Timestamp(3), doc1); { - UpdateResult result = spi->update(bucket, Timestamp(4), update, context); + UpdateResult result = spi->update(bucket, Timestamp(4), update); EXPECT_EQ(Result::ErrorType::NONE, result.getErrorCode()); EXPECT_EQ(Timestamp(3), result.getExistingTimestamp()); @@ -913,7 +904,7 @@ TEST_F(ConformanceTest, testUpdate) EXPECT_EQ(IntFieldValue(42), static_cast<IntFieldValue&>(*result.getDocument().getValue("headerval"))); } - spi->remove(bucket, Timestamp(5), doc1->getId(), context); + spi->remove(bucket, Timestamp(5), doc1->getId()); { GetResult result = spi->get(bucket, document::AllFields(), doc1->getId(), context); @@ -925,7 +916,7 @@ TEST_F(ConformanceTest, testUpdate) } { - UpdateResult result = spi->update(bucket, Timestamp(6), update, context); + UpdateResult result = spi->update(bucket, Timestamp(6), update); EXPECT_EQ(Result::ErrorType::NONE, result.getErrorCode()); EXPECT_EQ(Timestamp(0), result.getExistingTimestamp()); @@ -943,7 +934,7 @@ TEST_F(ConformanceTest, testUpdate) { // Document does not exist (and therefore its condition cannot match by definition), // but since CreateIfNonExistent is set it should be auto-created anyway. - UpdateResult result = spi->update(bucket, Timestamp(7), update, context); + UpdateResult result = spi->update(bucket, Timestamp(7), update); EXPECT_EQ(Result::ErrorType::NONE, result.getErrorCode()); EXPECT_EQ(Timestamp(7), result.getExistingTimestamp()); } @@ -966,7 +957,7 @@ TEST_F(ConformanceTest, testGet) Context context(Priority(0), Trace::TraceLevel(0)); Bucket bucket(makeSpiBucket(BucketId(8, 0x01))); - spi->createBucket(bucket, context); + spi->createBucket(bucket); { GetResult result = spi->get(bucket, document::AllFields(), doc1->getId(), context); @@ -976,7 +967,7 @@ TEST_F(ConformanceTest, testGet) EXPECT_FALSE(result.is_tombstone()); } - spi->put(bucket, Timestamp(3), doc1, context); + spi->put(bucket, Timestamp(3), doc1); { GetResult result = spi->get(bucket, document::AllFields(), doc1->getId(), context); @@ -985,7 +976,7 @@ TEST_F(ConformanceTest, testGet) EXPECT_FALSE(result.is_tombstone()); } - spi->remove(bucket, Timestamp(4), doc1->getId(), context); + spi->remove(bucket, Timestamp(4), doc1->getId()); { GetResult result = spi->get(bucket, document::AllFields(), doc1->getId(), context); @@ -1002,9 +993,8 @@ TEST_F(ConformanceTest, testIterateCreateIterator) document::TestDocMan testDocMan; _factory->clear(); PersistenceProviderUP spi(getSpi(*_factory, testDocMan)); - Context context(Priority(0), Trace::TraceLevel(0)); Bucket b(makeSpiBucket(BucketId(8, 0x1))); - spi->createBucket(b, context); + spi->createBucket(b); spi::CreateIteratorResult result(createIterator(*spi, b, createSelection(""))); EXPECT_EQ(Result::ErrorType::NONE, result.getErrorCode()); @@ -1012,7 +1002,7 @@ TEST_F(ConformanceTest, testIterateCreateIterator) // from a successful createIterator call. EXPECT_TRUE(result.getIteratorId() != IteratorId(0)); - spi->destroyIterator(result.getIteratorId(), context); + spi->destroyIterator(result.getIteratorId()); } TEST_F(ConformanceTest, testIterateWithUnknownId) @@ -1020,12 +1010,11 @@ TEST_F(ConformanceTest, testIterateWithUnknownId) document::TestDocMan testDocMan; _factory->clear(); PersistenceProviderUP spi(getSpi(*_factory, testDocMan)); - Context context(Priority(0), Trace::TraceLevel(0)); Bucket b(makeSpiBucket(BucketId(8, 0x1))); - spi->createBucket(b, context); + spi->createBucket(b); IteratorId unknownId(123); - IterateResult result(spi->iterate(unknownId, 1024, context)); + IterateResult result(spi->iterate(unknownId, 1024)); EXPECT_EQ(Result::ErrorType::PERMANENT_ERROR, result.getErrorCode()); } @@ -1034,27 +1023,26 @@ TEST_F(ConformanceTest, testIterateDestroyIterator) document::TestDocMan testDocMan; _factory->clear(); PersistenceProviderUP spi(getSpi(*_factory, testDocMan)); - Context context(Priority(0), Trace::TraceLevel(0)); Bucket b(makeSpiBucket(BucketId(8, 0x1))); - spi->createBucket(b, context); + spi->createBucket(b); CreateIteratorResult iter(createIterator(*spi, b, createSelection(""))); { - IterateResult result(spi->iterate(iter.getIteratorId(), 1024, context)); + IterateResult result(spi->iterate(iter.getIteratorId(), 1024)); EXPECT_EQ(Result::ErrorType::NONE, result.getErrorCode()); } { - Result destroyResult(spi->destroyIterator(iter.getIteratorId(), context)); + Result destroyResult(spi->destroyIterator(iter.getIteratorId())); EXPECT_TRUE(!destroyResult.hasError()); } // Iteration should now fail { - IterateResult result(spi->iterate(iter.getIteratorId(), 1024, context)); + IterateResult result(spi->iterate(iter.getIteratorId(), 1024)); EXPECT_EQ(Result::ErrorType::PERMANENT_ERROR, result.getErrorCode()); } { - Result destroyResult(spi->destroyIterator(iter.getIteratorId(), context)); + Result destroyResult(spi->destroyIterator(iter.getIteratorId())); EXPECT_TRUE(!destroyResult.hasError()); } } @@ -1064,9 +1052,8 @@ TEST_F(ConformanceTest, testIterateAllDocs) document::TestDocMan testDocMan; _factory->clear(); PersistenceProviderUP spi(getSpi(*_factory, testDocMan)); - Context context(Priority(0), Trace::TraceLevel(0)); Bucket b(makeSpiBucket(BucketId(8, 0x1))); - spi->createBucket(b, context); + spi->createBucket(b); std::vector<DocAndTimestamp> docs(feedDocs(*spi, testDocMan, b, 100)); CreateIteratorResult iter(createIterator(*spi, b, createSelection(""))); @@ -1074,7 +1061,7 @@ TEST_F(ConformanceTest, testIterateAllDocs) std::vector<Chunk> chunks = doIterate(*spi, iter.getIteratorId(), 4_Ki); verifyDocs(docs, chunks); - spi->destroyIterator(iter.getIteratorId(), context); + spi->destroyIterator(iter.getIteratorId()); } TEST_F(ConformanceTest, testIterateAllDocsNewestVersionOnly) @@ -1082,9 +1069,8 @@ TEST_F(ConformanceTest, testIterateAllDocsNewestVersionOnly) document::TestDocMan testDocMan; _factory->clear(); PersistenceProviderUP spi(getSpi(*_factory, testDocMan)); - Context context(Priority(0), Trace::TraceLevel(0)); Bucket b(makeSpiBucket(BucketId(8, 0x1))); - spi->createBucket(b, context); + spi->createBucket(b); std::vector<DocAndTimestamp> docs(feedDocs(*spi, testDocMan, b, 100)); std::vector<DocAndTimestamp> newDocs; @@ -1093,7 +1079,7 @@ TEST_F(ConformanceTest, testIterateAllDocsNewestVersionOnly) Document::SP newDoc(docs[i].doc->clone()); Timestamp newTimestamp(2000 + i); newDoc->setValue("headerval", IntFieldValue(5678 + i)); - spi->put(b, newTimestamp, newDoc, context); + spi->put(b, newTimestamp, newDoc); newDocs.push_back(DocAndTimestamp(newDoc, newTimestamp)); } @@ -1102,7 +1088,7 @@ TEST_F(ConformanceTest, testIterateAllDocsNewestVersionOnly) std::vector<Chunk> chunks = doIterate(*spi, iter.getIteratorId(), 4_Ki); verifyDocs(newDocs, chunks); - spi->destroyIterator(iter.getIteratorId(), context); + spi->destroyIterator(iter.getIteratorId()); } TEST_F(ConformanceTest, testIterateChunked) @@ -1110,9 +1096,8 @@ TEST_F(ConformanceTest, testIterateChunked) document::TestDocMan testDocMan; _factory->clear(); PersistenceProviderUP spi(getSpi(*_factory, testDocMan)); - Context context(Priority(0), Trace::TraceLevel(0)); Bucket b(makeSpiBucket(BucketId(8, 0x1))); - spi->createBucket(b, context); + spi->createBucket(b); std::vector<DocAndTimestamp> docs(feedDocs(*spi, testDocMan, b, 100)); CreateIteratorResult iter(createIterator(*spi, b, createSelection(""))); @@ -1122,7 +1107,7 @@ TEST_F(ConformanceTest, testIterateChunked) EXPECT_EQ(size_t(100), chunks.size()); verifyDocs(docs, chunks); - spi->destroyIterator(iter.getIteratorId(), context); + spi->destroyIterator(iter.getIteratorId()); } TEST_F(ConformanceTest, testMaxByteSize) @@ -1130,9 +1115,8 @@ TEST_F(ConformanceTest, testMaxByteSize) document::TestDocMan testDocMan; _factory->clear(); PersistenceProviderUP spi(getSpi(*_factory, testDocMan)); - Context context(Priority(0), Trace::TraceLevel(0)); Bucket b(makeSpiBucket(BucketId(8, 0x1))); - spi->createBucket(b, context); + spi->createBucket(b); std::vector<DocAndTimestamp> docs(feedDocs(*spi, testDocMan, b, 100, 4_Ki, 4096)); @@ -1147,7 +1131,7 @@ TEST_F(ConformanceTest, testMaxByteSize) } verifyDocs(docs, chunks); - spi->destroyIterator(iter.getIteratorId(), context); + spi->destroyIterator(iter.getIteratorId()); } TEST_F(ConformanceTest, testIterateMatchTimestampRange) @@ -1155,9 +1139,8 @@ TEST_F(ConformanceTest, testIterateMatchTimestampRange) document::TestDocMan testDocMan; _factory->clear(); PersistenceProviderUP spi(getSpi(*_factory, testDocMan)); - Context context(Priority(0), Trace::TraceLevel(0)); Bucket b(makeSpiBucket(BucketId(8, 0x1))); - spi->createBucket(b, context); + spi->createBucket(b); std::vector<DocAndTimestamp> docsToVisit; Timestamp fromTimestamp(1010); @@ -1167,7 +1150,7 @@ TEST_F(ConformanceTest, testIterateMatchTimestampRange) Timestamp timestamp(1000 + i); document::Document::SP doc(testDocMan.createRandomDocumentAtLocation(1, timestamp, 110, 110)); - spi->put(b, timestamp, doc, context); + spi->put(b, timestamp, doc); if (timestamp >= fromTimestamp && timestamp <= toTimestamp) { docsToVisit.push_back(DocAndTimestamp(doc, Timestamp(1000 + i))); } @@ -1182,7 +1165,7 @@ TEST_F(ConformanceTest, testIterateMatchTimestampRange) std::vector<Chunk> chunks = doIterate(*spi, iter.getIteratorId(), 2_Ki); verifyDocs(docsToVisit, chunks); - spi->destroyIterator(iter.getIteratorId(), context); + spi->destroyIterator(iter.getIteratorId()); } TEST_F(ConformanceTest, testIterateExplicitTimestampSubset) @@ -1190,9 +1173,8 @@ TEST_F(ConformanceTest, testIterateExplicitTimestampSubset) document::TestDocMan testDocMan; _factory->clear(); PersistenceProviderUP spi(getSpi(*_factory, testDocMan)); - Context context(Priority(0), Trace::TraceLevel(0)); Bucket b(makeSpiBucket(BucketId(8, 0x1))); - spi->createBucket(b, context); + spi->createBucket(b); std::vector<DocAndTimestamp> docsToVisit; std::vector<Timestamp> timestampsToVisit; @@ -1202,7 +1184,7 @@ TEST_F(ConformanceTest, testIterateExplicitTimestampSubset) Timestamp timestamp(1000 + i); document::Document::SP doc(testDocMan.createRandomDocumentAtLocation(1, timestamp, 110, 110)); - spi->put(b, timestamp, doc, context); + spi->put(b, timestamp, doc); if (timestamp % 3 == 0) { docsToVisit.push_back(DocAndTimestamp(doc, Timestamp(1000 + i))); timestampsToVisit.push_back(Timestamp(timestamp)); @@ -1210,10 +1192,7 @@ TEST_F(ConformanceTest, testIterateExplicitTimestampSubset) } // Timestamp subset should include removes without // having to explicitly specify it - EXPECT_TRUE(spi->remove(b, - Timestamp(2000), - docsToVisit.front().doc->getId(), context) - .wasFound()); + EXPECT_TRUE(spi->remove(b, Timestamp(2000), docsToVisit.front().doc->getId()).wasFound()); timestampsToVisit.push_back(Timestamp(2000)); removes.insert(docsToVisit.front().doc->getId().toString()); @@ -1228,7 +1207,7 @@ TEST_F(ConformanceTest, testIterateExplicitTimestampSubset) std::vector<Chunk> chunks = doIterate(*spi, iter.getIteratorId(), 2_Ki); verifyDocs(docsToVisit, chunks, removes); - spi->destroyIterator(iter.getIteratorId(), context); + spi->destroyIterator(iter.getIteratorId()); } TEST_F(ConformanceTest, testIterateRemoves) @@ -1236,9 +1215,8 @@ TEST_F(ConformanceTest, testIterateRemoves) document::TestDocMan testDocMan; _factory->clear(); PersistenceProviderUP spi(getSpi(*_factory, testDocMan)); - Context context(Priority(0), Trace::TraceLevel(0)); Bucket b(makeSpiBucket(BucketId(8, 0x1))); - spi->createBucket(b, context); + spi->createBucket(b); int docCount = 10; std::vector<DocAndTimestamp> docs(feedDocs(*spi, testDocMan, b, docCount)); @@ -1248,11 +1226,7 @@ TEST_F(ConformanceTest, testIterateRemoves) for (int i = 0; i < docCount; ++i) { if (i % 3 == 0) { removedDocs.insert(docs[i].doc->getId().toString()); - EXPECT_TRUE(spi->remove(b, - Timestamp(2000 + i), - docs[i].doc->getId(), - context) - .wasFound()); + EXPECT_TRUE(spi->remove(b, Timestamp(2000 + i), docs[i].doc->getId()).wasFound()); } else { nonRemovedDocs.push_back(docs[i]); } @@ -1265,7 +1239,7 @@ TEST_F(ConformanceTest, testIterateRemoves) std::vector<Chunk> chunks = doIterate(*spi, iter.getIteratorId(), 4_Ki); verifyDocs(nonRemovedDocs, chunks); - spi->destroyIterator(iter.getIteratorId(), context); + spi->destroyIterator(iter.getIteratorId()); } { @@ -1277,7 +1251,7 @@ TEST_F(ConformanceTest, testIterateRemoves) EXPECT_EQ(docs.size(), entries.size()); verifyDocs(nonRemovedDocs, chunks, removedDocs); - spi->destroyIterator(iter.getIteratorId(), context); + spi->destroyIterator(iter.getIteratorId()); } } @@ -1286,9 +1260,8 @@ TEST_F(ConformanceTest, testIterateMatchSelection) document::TestDocMan testDocMan; _factory->clear(); PersistenceProviderUP spi(getSpi(*_factory, testDocMan)); - Context context(Priority(0), Trace::TraceLevel(0)); Bucket b(makeSpiBucket(BucketId(8, 0x1))); - spi->createBucket(b, context); + spi->createBucket(b); std::vector<DocAndTimestamp> docsToVisit; @@ -1296,7 +1269,7 @@ TEST_F(ConformanceTest, testIterateMatchSelection) document::Document::SP doc(testDocMan.createRandomDocumentAtLocation(1, 1000 + i, 110, 110)); doc->setValue("headerval", IntFieldValue(i)); - spi->put(b, Timestamp(1000 + i), doc, context); + spi->put(b, Timestamp(1000 + i), doc); if ((i % 3) == 0) { docsToVisit.push_back(DocAndTimestamp(doc, Timestamp(1000 + i))); } @@ -1307,7 +1280,7 @@ TEST_F(ConformanceTest, testIterateMatchSelection) std::vector<Chunk> chunks = doIterate(*spi, iter.getIteratorId(), 2_Mi); verifyDocs(docsToVisit, chunks); - spi->destroyIterator(iter.getIteratorId(), context); + spi->destroyIterator(iter.getIteratorId()); } TEST_F(ConformanceTest, testIterationRequiringDocumentIdOnlyMatching) @@ -1315,16 +1288,15 @@ TEST_F(ConformanceTest, testIterationRequiringDocumentIdOnlyMatching) document::TestDocMan testDocMan; _factory->clear(); PersistenceProviderUP spi(getSpi(*_factory, testDocMan)); - Context context(Priority(0), Trace::TraceLevel(0)); Bucket b(makeSpiBucket(BucketId(8, 0x1))); - spi->createBucket(b, context); + spi->createBucket(b); feedDocs(*spi, testDocMan, b, 100); DocumentId removedId("id:blarg:testdoctype1:n=1:unknowndoc"); // 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).wasFound()); Selection sel(createSelection("id == '" + removedId.toString() + "'")); @@ -1337,7 +1309,7 @@ TEST_F(ConformanceTest, testIterationRequiringDocumentIdOnlyMatching) removes.insert(removedId.toString()); verifyDocs(docs, chunks, removes); - spi->destroyIterator(iter.getIteratorId(), context); + spi->destroyIterator(iter.getIteratorId()); } TEST_F(ConformanceTest, testIterateBadDocumentSelection) @@ -1345,13 +1317,12 @@ TEST_F(ConformanceTest, testIterateBadDocumentSelection) document::TestDocMan testDocMan; _factory->clear(); PersistenceProviderUP spi(getSpi(*_factory, testDocMan)); - Context context(Priority(0), Trace::TraceLevel(0)); Bucket b(makeSpiBucket(BucketId(8, 0x1))); - spi->createBucket(b, context); + spi->createBucket(b); { CreateIteratorResult iter(createIterator(*spi, b, createSelection("the muppet show"))); if (iter.getErrorCode() == Result::ErrorType::NONE) { - IterateResult result(spi->iterate(iter.getIteratorId(), 4_Ki, context)); + IterateResult result(spi->iterate(iter.getIteratorId(), 4_Ki)); EXPECT_EQ(Result::ErrorType::NONE, result.getErrorCode()); EXPECT_EQ(size_t(0), result.getEntries().size()); EXPECT_EQ(true, result.isCompleted()); @@ -1363,7 +1334,7 @@ TEST_F(ConformanceTest, testIterateBadDocumentSelection) { CreateIteratorResult iter(createIterator(*spi, b, createSelection("unknownddoctype.something=thatthing"))); if (iter.getErrorCode() == Result::ErrorType::NONE) { - IterateResult result(spi->iterate(iter.getIteratorId(), 4_Ki, context)); + IterateResult result(spi->iterate(iter.getIteratorId(), 4_Ki)); EXPECT_EQ(Result::ErrorType::NONE, result.getErrorCode()); EXPECT_EQ(size_t(0), result.getEntries().size()); EXPECT_EQ(true, result.isCompleted()); @@ -1379,9 +1350,8 @@ TEST_F(ConformanceTest, testIterateAlreadyCompleted) document::TestDocMan testDocMan; _factory->clear(); PersistenceProviderUP spi(getSpi(*_factory, testDocMan)); - Context context(Priority(0), Trace::TraceLevel(0)); Bucket b(makeSpiBucket(BucketId(8, 0x1))); - spi->createBucket(b, context); + spi->createBucket(b); std::vector<DocAndTimestamp> docs = feedDocs(*spi, testDocMan, b, 10); Selection sel(createSelection("")); @@ -1390,12 +1360,12 @@ TEST_F(ConformanceTest, testIterateAlreadyCompleted) std::vector<Chunk> chunks = doIterate(*spi, iter.getIteratorId(), 4_Ki); verifyDocs(docs, chunks); - IterateResult result(spi->iterate(iter.getIteratorId(), 4_Ki, context)); + IterateResult result(spi->iterate(iter.getIteratorId(), 4_Ki)); EXPECT_EQ(Result::ErrorType::NONE, result.getErrorCode()); EXPECT_EQ(size_t(0), result.getEntries().size()); EXPECT_TRUE(result.isCompleted()); - spi->destroyIterator(iter.getIteratorId(), context); + spi->destroyIterator(iter.getIteratorId()); } void @@ -1404,21 +1374,20 @@ ConformanceTest::test_iterate_empty_or_missing_bucket(bool bucket_exists) document::TestDocMan testDocMan; _factory->clear(); PersistenceProviderUP spi(getSpi(*_factory, testDocMan)); - Context context(Priority(0), Trace::TraceLevel(0)); Bucket b(makeSpiBucket(BucketId(8, 0x1))); if (bucket_exists) { - spi->createBucket(b, context); + spi->createBucket(b); } Selection sel(createSelection("")); CreateIteratorResult iter(createIterator(*spi, b, sel)); - IterateResult result(spi->iterate(iter.getIteratorId(), 4_Ki, context)); + IterateResult result(spi->iterate(iter.getIteratorId(), 4_Ki)); EXPECT_EQ(Result::ErrorType::NONE, result.getErrorCode()); EXPECT_EQ(size_t(0), result.getEntries().size()); EXPECT_TRUE(result.isCompleted()); - spi->destroyIterator(iter.getIteratorId(), context); + spi->destroyIterator(iter.getIteratorId()); } TEST_F(ConformanceTest, test_iterate_empty_bucket) @@ -1436,15 +1405,14 @@ TEST_F(ConformanceTest, testDeleteBucket) document::TestDocMan testDocMan; _factory->clear(); PersistenceProviderUP spi(getSpi(*_factory, testDocMan)); - Context context(Priority(0), Trace::TraceLevel(0)); Document::SP doc1 = testDocMan.createRandomDocumentAtLocation(0x01, 1); Bucket bucket(makeSpiBucket(BucketId(8, 0x01))); - spi->createBucket(bucket, context); + spi->createBucket(bucket); - spi->put(bucket, Timestamp(3), doc1, context); + spi->put(bucket, Timestamp(3), doc1); - spi->deleteBucket(bucket, context); + spi->deleteBucket(bucket); testDeleteBucketPostCondition(*spi, bucket, *doc1); if (_factory->hasPersistence()) { spi.reset(); @@ -1457,9 +1425,7 @@ TEST_F(ConformanceTest, testDeleteBucket) void ConformanceTest:: -testDeleteBucketPostCondition(const PersistenceProvider &spi, - const Bucket &bucket, - const Document &doc1) +testDeleteBucketPostCondition(const PersistenceProvider &spi, const Bucket &bucket, const Document &doc1) { Context context(Priority(0), Trace::TraceLevel(0)); { @@ -1476,26 +1442,25 @@ TEST_F(ConformanceTest, testSplitNormalCase) document::TestDocMan testDocMan; _factory->clear(); PersistenceProviderUP spi(getSpi(*_factory, testDocMan)); - Context context(Priority(0), Trace::TraceLevel(0)); Bucket bucketA(makeSpiBucket(BucketId(3, 0x02))); Bucket bucketB(makeSpiBucket(BucketId(3, 0x06))); Bucket bucketC(makeSpiBucket(BucketId(2, 0x02))); - spi->createBucket(bucketC, context); + spi->createBucket(bucketC); TimestampList tsList; for (uint32_t i = 0; i < 10; ++i) { Document::SP doc1 = testDocMan.createRandomDocumentAtLocation(0x02, i); - spi->put(bucketC, Timestamp(i + 1), doc1, context); + spi->put(bucketC, Timestamp(i + 1), doc1); } for (uint32_t i = 10; i < 20; ++i) { Document::SP doc1 = testDocMan.createRandomDocumentAtLocation(0x06, i); - spi->put(bucketC, Timestamp(i + 1), doc1, context); + spi->put(bucketC, Timestamp(i + 1), doc1); } - spi->split(bucketC, bucketA, bucketB, context); + spi->split(bucketC, bucketA, bucketB); testSplitNormalCasePostCondition(*spi, bucketA, bucketB, bucketC, testDocMan); if (_factory->hasPersistence()) { spi.reset(); @@ -1539,39 +1504,38 @@ TEST_F(ConformanceTest, testSplitTargetExists) document::TestDocMan testDocMan; _factory->clear(); PersistenceProviderUP spi(getSpi(*_factory, testDocMan)); - Context context(Priority(0), Trace::TraceLevel(0)); Bucket bucketA(makeSpiBucket(BucketId(3, 0x02))); Bucket bucketB(makeSpiBucket(BucketId(3, 0x06))); - spi->createBucket(bucketB, context); + spi->createBucket(bucketB); Bucket bucketC(makeSpiBucket(BucketId(2, 0x02))); - spi->createBucket(bucketC, context); + spi->createBucket(bucketC); TimestampList tsList; for (uint32_t i = 0; i < 10; ++i) { Document::SP doc1 = testDocMan.createRandomDocumentAtLocation(0x02, i); - spi->put(bucketC, Timestamp(i + 1), doc1, context); + spi->put(bucketC, Timestamp(i + 1), doc1); } for (uint32_t i = 10; i < 20; ++i) { Document::SP doc1 = testDocMan.createRandomDocumentAtLocation(0x06, i); - spi->put(bucketB, Timestamp(i + 1), doc1, context); + spi->put(bucketB, Timestamp(i + 1), doc1); } EXPECT_TRUE(!spi->getBucketInfo(bucketB).getBucketInfo().isActive()); for (uint32_t i = 10; i < 20; ++i) { Document::SP doc1 = testDocMan.createRandomDocumentAtLocation(0x06, i); - spi->put(bucketC, Timestamp(i + 1), doc1, context); + spi->put(bucketC, Timestamp(i + 1), doc1); } for (uint32_t i = 20; i < 25; ++i) { Document::SP doc1 = testDocMan.createRandomDocumentAtLocation(0x06, i); - spi->put(bucketB, Timestamp(i + 1), doc1, context); + spi->put(bucketB, Timestamp(i + 1), doc1); } - spi->split(bucketC, bucketA, bucketB, context); + spi->split(bucketC, bucketA, bucketB); testSplitTargetExistsPostCondition(*spi, bucketA, bucketB, bucketC,testDocMan); if (_factory->hasPersistence()) { spi.reset(); @@ -1615,19 +1579,18 @@ TEST_F(ConformanceTest, testSplitSingleDocumentInSource) document::TestDocMan testDocMan; _factory->clear(); PersistenceProviderUP spi(getSpi(*_factory, testDocMan)); - Context context(Priority(0), Trace::TraceLevel(0)); Bucket target1(makeSpiBucket(BucketId(3, 0x02))); Bucket target2(makeSpiBucket(BucketId(3, 0x06))); Bucket source(makeSpiBucket(BucketId(2, 0x02))); - spi->createBucket(source, context); + spi->createBucket(source); // Create doc belonging in target2 after split. Document::SP doc = testDocMan.createRandomDocumentAtLocation(0x06, 0); - spi->put(source, Timestamp(1), doc, context); + spi->put(source, Timestamp(1), doc); - spi->split(source, target1, target2, context); + spi->split(source, target1, target2); testSplitSingleDocumentInSourcePostCondition(*spi, source, target1, target2, testDocMan); if (_factory->hasPersistence()) { @@ -1665,19 +1628,17 @@ ConformanceTest::createAndPopulateJoinSourceBuckets( const Bucket& source2, document::TestDocMan& testDocMan) { - Context context(Priority(0), Trace::TraceLevel(0)); - - spi.createBucket(source1, context); - spi.createBucket(source2, context); + spi.createBucket(source1); + spi.createBucket(source2); for (uint32_t i = 0; i < 10; ++i) { Document::SP doc(testDocMan.createRandomDocumentAtLocation(source1.getBucketId().getId(), i)); - spi.put(source1, Timestamp(i + 1), doc, context); + spi.put(source1, Timestamp(i + 1), doc); } for (uint32_t i = 10; i < 20; ++i) { Document::SP doc(testDocMan.createRandomDocumentAtLocation(source2.getBucketId().getId(), i)); - spi.put(source2, Timestamp(i + 1), doc, context); + spi.put(source2, Timestamp(i + 1), doc); } } @@ -1692,8 +1653,7 @@ ConformanceTest::doTestJoinNormalCase(const Bucket& source1, createAndPopulateJoinSourceBuckets(*spi, source1, source2, testDocMan); - Context context(Priority(0), Trace::TraceLevel(0)); - spi->join(source1, source2, target, context); + spi->join(source1, source2, target); testJoinNormalCasePostCondition(*spi, source1, source2, target, testDocMan); if (_factory->hasPersistence()) { @@ -1751,34 +1711,33 @@ TEST_F(ConformanceTest, testJoinTargetExists) document::TestDocMan testDocMan; _factory->clear(); PersistenceProviderUP spi(getSpi(*_factory, testDocMan)); - Context context(Priority(0), Trace::TraceLevel(0)); Bucket bucketA(makeSpiBucket(BucketId(3, 0x02))); - spi->createBucket(bucketA, context); + spi->createBucket(bucketA); Bucket bucketB(makeSpiBucket(BucketId(3, 0x06))); - spi->createBucket(bucketB, context); + spi->createBucket(bucketB); Bucket bucketC(makeSpiBucket(BucketId(2, 0x02))); - spi->createBucket(bucketC, context); + spi->createBucket(bucketC); for (uint32_t i = 0; i < 10; ++i) { Document::SP doc1 = testDocMan.createRandomDocumentAtLocation(0x02, i); - spi->put(bucketA, Timestamp(i + 1), doc1, context); + spi->put(bucketA, Timestamp(i + 1), doc1); } for (uint32_t i = 10; i < 20; ++i) { Document::SP doc1 = testDocMan.createRandomDocumentAtLocation(0x06, i); - spi->put(bucketB, Timestamp(i + 1), doc1, context); + spi->put(bucketB, Timestamp(i + 1), doc1); } for (uint32_t i = 20; i < 30; ++i) { Document::SP doc1 = testDocMan.createRandomDocumentAtLocation(0x06, i); - spi->put(bucketC, Timestamp(i + 1), doc1, context); + spi->put(bucketC, Timestamp(i + 1), doc1); } - spi->join(bucketA, bucketB, bucketC, context); + spi->join(bucketA, bucketB, bucketC); testJoinTargetExistsPostCondition(*spi, bucketA, bucketB, bucketC, testDocMan); if (_factory->hasPersistence()) { spi.reset(); @@ -1822,7 +1781,6 @@ testJoinTargetExistsPostCondition(const PersistenceProvider &spi, void ConformanceTest::populateBucket(const Bucket& b, PersistenceProvider& spi, - Context& context, uint32_t from, uint32_t to, document::TestDocMan& testDocMan) @@ -1831,7 +1789,7 @@ ConformanceTest::populateBucket(const Bucket& b, for (uint32_t i = from; i < to; ++i) { const uint32_t location = b.getBucketId().getId(); Document::SP doc1 = testDocMan.createRandomDocumentAtLocation(location, i); - spi.put(b, Timestamp(i + 1), doc1, context); + spi.put(b, Timestamp(i + 1), doc1); } } @@ -1840,17 +1798,15 @@ TEST_F(ConformanceTest, testJoinOneBucket) document::TestDocMan testDocMan; _factory->clear(); PersistenceProviderUP spi(getSpi(*_factory, testDocMan)); - Context context(Priority(0), Trace::TraceLevel(0)); - Bucket bucketA(makeSpiBucket(BucketId(3, 0x02))); - spi->createBucket(bucketA, context); + spi->createBucket(bucketA); Bucket bucketB(makeSpiBucket(BucketId(3, 0x06))); Bucket bucketC(makeSpiBucket(BucketId(2, 0x02))); - populateBucket(bucketA, *spi, context, 0, 10, testDocMan); + populateBucket(bucketA, *spi, 0, 10, testDocMan); - spi->join(bucketA, bucketB, bucketC, context); + spi->join(bucketA, bucketB, bucketC); testJoinOneBucketPostCondition(*spi, bucketA, bucketC, testDocMan); if (_factory->hasPersistence()) { spi.reset(); @@ -1896,12 +1852,11 @@ ConformanceTest::doTestJoinSameSourceBuckets(const Bucket& source, const Bucket& document::TestDocMan testDocMan; _factory->clear(); PersistenceProviderUP spi(getSpi(*_factory, testDocMan)); - Context context(Priority(0), Trace::TraceLevel(0)); - spi->createBucket(source, context); - populateBucket(source, *spi, context, 0, 10, testDocMan); + spi->createBucket(source); + populateBucket(source, *spi, 0, 10, testDocMan); - spi->join(source, source, target, context); + spi->join(source, source, target); testJoinSameSourceBucketsPostCondition(*spi, source, target, testDocMan); if (_factory->hasPersistence()) { spi.reset(); @@ -1948,18 +1903,17 @@ TEST_F(ConformanceTest, testJoinSameSourceBucketsTargetExists) document::TestDocMan testDocMan; _factory->clear(); PersistenceProviderUP spi(getSpi(*_factory, testDocMan)); - Context context(Priority(0), Trace::TraceLevel(0)); Bucket source(makeSpiBucket(BucketId(3, 0x02))); - spi->createBucket(source, context); + spi->createBucket(source); Bucket target(makeSpiBucket(BucketId(2, 0x02))); - spi->createBucket(target, context); + spi->createBucket(target); - populateBucket(source, *spi, context, 0, 10, testDocMan); - populateBucket(target, *spi, context, 10, 20, testDocMan); + populateBucket(source, *spi, 0, 10, testDocMan); + populateBucket(target, *spi, 10, 20, testDocMan); - spi->join(source, source, target, context); + spi->join(source, source, target); testJoinSameSourceBucketsTargetExistsPostCondition(*spi, source, target, testDocMan); if (_factory->hasPersistence()) { spi.reset(); @@ -1986,11 +1940,10 @@ TEST_F(ConformanceTest, testBucketActivation) document::TestDocMan testDocMan; _factory->clear(); PersistenceProviderUP spi(getSpi(*_factory, testDocMan)); - Context context(Priority(0), Trace::TraceLevel(0)); Bucket bucket(makeSpiBucket(BucketId(8, 0x01))); spi->setClusterState(makeBucketSpace(), createClusterState()); - spi->createBucket(bucket, context); + spi->createBucket(bucket); EXPECT_TRUE(!spi->getBucketInfo(bucket).getBucketInfo().isActive()); spi->setActiveState(bucket, BucketInfo::ACTIVE); @@ -1999,8 +1952,8 @@ TEST_F(ConformanceTest, testBucketActivation) // Add and remove a document, so document goes to zero, to check that // active state isn't cleared then. Document::SP doc1 = testDocMan.createRandomDocumentAtLocation(0x01, 1); - EXPECT_EQ(Result(), Result(spi->put(bucket, Timestamp(1), doc1, context))); - EXPECT_EQ(Result(), Result(spi->remove(bucket, Timestamp(5), doc1->getId(), context))); + EXPECT_EQ(Result(), Result(spi->put(bucket, Timestamp(1), doc1))); + EXPECT_EQ(Result(), Result(spi->remove(bucket, Timestamp(5), doc1->getId()))); EXPECT_TRUE(spi->getBucketInfo(bucket).getBucketInfo().isActive()); // Setting node down should clear active flag. @@ -2025,7 +1978,6 @@ TEST_F(SingleDocTypeConformanceTest, testBucketActivationSplitAndJoin) document::TestDocMan testDocMan; _factory->clear(); PersistenceProviderUP spi(getSpi(*_factory, testDocMan)); - Context context(Priority(0), Trace::TraceLevel(0)); Bucket bucketA(makeSpiBucket(BucketId(3, 0x02))); Bucket bucketB(makeSpiBucket(BucketId(3, 0x06))); @@ -2034,62 +1986,62 @@ TEST_F(SingleDocTypeConformanceTest, testBucketActivationSplitAndJoin) Document::SP doc2 = testDocMan.createRandomDocumentAtLocation(0x06, 2); spi->setClusterState(makeBucketSpace(), createClusterState()); - spi->createBucket(bucketC, context); - spi->put(bucketC, Timestamp(1), doc1, context); - spi->put(bucketC, Timestamp(2), doc2, context); + spi->createBucket(bucketC); + spi->put(bucketC, Timestamp(1), doc1); + spi->put(bucketC, Timestamp(2), doc2); spi->setActiveState(bucketC, BucketInfo::ACTIVE); EXPECT_TRUE(spi->getBucketInfo(bucketC).getBucketInfo().isActive()); - spi->split(bucketC, bucketA, bucketB, context); + spi->split(bucketC, bucketA, bucketB); EXPECT_TRUE(spi->getBucketInfo(bucketA).getBucketInfo().isActive()); EXPECT_TRUE(spi->getBucketInfo(bucketB).getBucketInfo().isActive()); EXPECT_TRUE(!spi->getBucketInfo(bucketC).getBucketInfo().isActive()); spi->setActiveState(bucketA, BucketInfo::NOT_ACTIVE); spi->setActiveState(bucketB, BucketInfo::NOT_ACTIVE); - spi->join(bucketA, bucketB, bucketC, context); + spi->join(bucketA, bucketB, bucketC); EXPECT_TRUE(!spi->getBucketInfo(bucketA).getBucketInfo().isActive()); EXPECT_TRUE(!spi->getBucketInfo(bucketB).getBucketInfo().isActive()); EXPECT_TRUE(!spi->getBucketInfo(bucketC).getBucketInfo().isActive()); - spi->split(bucketC, bucketA, bucketB, context); + spi->split(bucketC, bucketA, bucketB); EXPECT_TRUE(!spi->getBucketInfo(bucketA).getBucketInfo().isActive()); EXPECT_TRUE(!spi->getBucketInfo(bucketB).getBucketInfo().isActive()); EXPECT_TRUE(!spi->getBucketInfo(bucketC).getBucketInfo().isActive()); spi->setActiveState(bucketA, BucketInfo::ACTIVE); - spi->join(bucketA, bucketB, bucketC, context); + spi->join(bucketA, bucketB, bucketC); EXPECT_TRUE(!spi->getBucketInfo(bucketA).getBucketInfo().isActive()); EXPECT_TRUE(!spi->getBucketInfo(bucketB).getBucketInfo().isActive()); EXPECT_TRUE(spi->getBucketInfo(bucketC).getBucketInfo().isActive()); // Redo test with empty bucket, to ensure new buckets are generated // even if empty - spi->deleteBucket(bucketA, context); - spi->deleteBucket(bucketB, context); - spi->deleteBucket(bucketC, context); + spi->deleteBucket(bucketA); + spi->deleteBucket(bucketB); + spi->deleteBucket(bucketC); - spi->createBucket(bucketC, context); + spi->createBucket(bucketC); spi->setActiveState(bucketC, BucketInfo::NOT_ACTIVE); - spi->split(bucketC, bucketA, bucketB, context); + spi->split(bucketC, bucketA, bucketB); EXPECT_TRUE(!spi->getBucketInfo(bucketA).getBucketInfo().isActive()); EXPECT_TRUE(!spi->getBucketInfo(bucketB).getBucketInfo().isActive()); - spi->join(bucketA, bucketB, bucketC, context); + spi->join(bucketA, bucketB, bucketC); EXPECT_TRUE(!spi->getBucketInfo(bucketA).getBucketInfo().isActive()); EXPECT_TRUE(!spi->getBucketInfo(bucketB).getBucketInfo().isActive()); EXPECT_TRUE(!spi->getBucketInfo(bucketC).getBucketInfo().isActive()); - spi->deleteBucket(bucketA, context); - spi->deleteBucket(bucketB, context); - spi->deleteBucket(bucketC, context); + spi->deleteBucket(bucketA); + spi->deleteBucket(bucketB); + spi->deleteBucket(bucketC); - spi->createBucket(bucketC, context); + spi->createBucket(bucketC); spi->setActiveState(bucketC, BucketInfo::ACTIVE); - spi->split(bucketC, bucketA, bucketB, context); + spi->split(bucketC, bucketA, bucketB); EXPECT_TRUE(spi->getBucketInfo(bucketA).getBucketInfo().isActive()); EXPECT_TRUE(spi->getBucketInfo(bucketB).getBucketInfo().isActive()); EXPECT_TRUE(!spi->getBucketInfo(bucketC).getBucketInfo().isActive()); - spi->join(bucketA, bucketB, bucketC, context); + spi->join(bucketA, bucketB, bucketC); EXPECT_TRUE(!spi->getBucketInfo(bucketA).getBucketInfo().isActive()); EXPECT_TRUE(!spi->getBucketInfo(bucketB).getBucketInfo().isActive()); EXPECT_TRUE(spi->getBucketInfo(bucketC).getBucketInfo().isActive()); @@ -2103,39 +2055,37 @@ TEST_F(ConformanceTest, testRemoveEntry) document::TestDocMan testDocMan; _factory->clear(); PersistenceProviderUP spi(getSpi(*_factory, testDocMan)); - Context context(Priority(0), Trace::TraceLevel(0)); - Bucket bucket(makeSpiBucket(BucketId(8, 0x01))); Document::SP doc1 = testDocMan.createRandomDocumentAtLocation(0x01, 1); Document::SP doc2 = testDocMan.createRandomDocumentAtLocation(0x01, 2); - spi->createBucket(bucket, context); + spi->createBucket(bucket); - spi->put(bucket, Timestamp(3), doc1, context); + spi->put(bucket, Timestamp(3), doc1); BucketInfo info1 = spi->getBucketInfo(bucket).getBucketInfo(); { - spi->put(bucket, Timestamp(4), doc2, context); - spi->removeEntry(bucket, Timestamp(4), context); + spi->put(bucket, Timestamp(4), doc2); + spi->removeEntry(bucket, Timestamp(4)); BucketInfo info2 = spi->getBucketInfo(bucket).getBucketInfo(); EXPECT_EQ(info1, info2); } // Test case where there exists a previous version of the document. { - spi->put(bucket, Timestamp(5), doc1, context); - spi->removeEntry(bucket, Timestamp(5), context); + spi->put(bucket, Timestamp(5), doc1); + spi->removeEntry(bucket, Timestamp(5)); BucketInfo info2 = spi->getBucketInfo(bucket).getBucketInfo(); EXPECT_EQ(info1, info2); } // Test case where the newest document version after removeEntrying is a remove. { - spi->remove(bucket, Timestamp(6), doc1->getId(), context); + spi->remove(bucket, Timestamp(6), doc1->getId()); BucketInfo info2 = spi->getBucketInfo(bucket).getBucketInfo(); EXPECT_EQ(uint32_t(0), info2.getDocumentCount()); - spi->put(bucket, Timestamp(7), doc1, context); - spi->removeEntry(bucket, Timestamp(7), context); + spi->put(bucket, Timestamp(7), doc1); + spi->removeEntry(bucket, Timestamp(7)); BucketInfo info3 = spi->getBucketInfo(bucket).getBucketInfo(); EXPECT_EQ(info2, info3); } @@ -2171,7 +2121,6 @@ TEST_F(ConformanceTest, testBucketSpaces) document::TestDocMan testDocMan; _factory->clear(); PersistenceProviderUP spi(getSpi(*_factory, testDocMan)); - Context context(Priority(0), Trace::TraceLevel(0)); BucketSpace bucketSpace0(makeBucketSpace("testdoctype1")); BucketSpace bucketSpace1(makeBucketSpace("testdoctype2")); BucketSpace bucketSpace2(makeBucketSpace("no")); @@ -2185,13 +2134,13 @@ TEST_F(ConformanceTest, testBucketSpaces) Document::SP doc2 = testDocMan.createDocument("content", "id:test:testdoctype1:n=1:2", "testdoctype1"); Document::SP doc3 = testDocMan.createDocument("content", "id:test:testdoctype2:n=1:3", "testdoctype2"); Document::SP doc4 = testDocMan.createDocument("content", "id:test:testdoctype2:n=2:4", "testdoctype2"); - spi->createBucket(bucket01, context); - spi->createBucket(bucket11, context); - spi->createBucket(bucket12, context); - spi->put(bucket01, Timestamp(3), doc1, context); - spi->put(bucket01, Timestamp(4), doc2, context); - spi->put(bucket11, Timestamp(5), doc3, context); - spi->put(bucket12, Timestamp(6), doc4, context); + spi->createBucket(bucket01); + spi->createBucket(bucket11); + spi->createBucket(bucket12); + spi->put(bucket01, Timestamp(3), doc1); + spi->put(bucket01, Timestamp(4), doc2); + spi->put(bucket11, Timestamp(5), doc3); + spi->put(bucket12, Timestamp(6), doc4); // Check bucket lists assertBucketList(*spi, bucketSpace0, { bucketId1 }); assertBucketList(*spi, bucketSpace1, { bucketId1, bucketId2 }); @@ -2220,11 +2169,10 @@ ConformanceTest::test_empty_bucket_info(bool bucket_exists, bool active) document::TestDocMan testDocMan; _factory->clear(); PersistenceProviderUP spi(getSpi(*_factory, testDocMan)); - Context context(Priority(0), Trace::TraceLevel(0)); Bucket bucket(makeSpiBucket(BucketId(8, 0x01))); spi->setClusterState(makeBucketSpace(), createClusterState()); if (bucket_exists) { - spi->createBucket(bucket, context); + spi->createBucket(bucket); } if (active) { spi->setActiveState(bucket, BucketInfo::ACTIVE); @@ -2263,10 +2211,9 @@ TEST_F(ConformanceTest, test_put_to_missing_bucket) document::TestDocMan testDocMan; _factory->clear(); PersistenceProviderUP spi(getSpi(*_factory, testDocMan)); - Context context(Priority(0), Trace::TraceLevel(0)); Bucket bucket(makeSpiBucket(BucketId(8, 0x01))); std::shared_ptr<Document> doc1 = testDocMan.createRandomDocumentAtLocation(0x01, 1); - auto put_result = spi->put(bucket, Timestamp(1), doc1, context); + auto put_result = spi->put(bucket, Timestamp(1), doc1); EXPECT_TRUE(!put_result.hasError()); auto info_result = spi->getBucketInfo(bucket); EXPECT_TRUE(!info_result.hasError()); @@ -2280,10 +2227,9 @@ TEST_F(ConformanceTest, test_remove_to_missing_bucket) document::TestDocMan testDocMan; _factory->clear(); PersistenceProviderUP spi(getSpi(*_factory, testDocMan)); - Context context(Priority(0), Trace::TraceLevel(0)); Bucket bucket(makeSpiBucket(BucketId(8, 0x01))); std::shared_ptr<Document> doc1 = testDocMan.createRandomDocumentAtLocation(0x01, 1); - auto remove_result = spi->remove(bucket, Timestamp(1), doc1->getId(), context); + auto remove_result = spi->remove(bucket, Timestamp(1), doc1->getId()); EXPECT_TRUE(!remove_result.hasError()); auto info_result = spi->getBucketInfo(bucket); EXPECT_TRUE(!info_result.hasError()); diff --git a/persistence/src/vespa/persistence/conformancetest/conformancetest.h b/persistence/src/vespa/persistence/conformancetest/conformancetest.h index e0ef1652163..57c67bbb641 100644 --- a/persistence/src/vespa/persistence/conformancetest/conformancetest.h +++ b/persistence/src/vespa/persistence/conformancetest/conformancetest.h @@ -67,7 +67,6 @@ protected: void populateBucket(const Bucket& b, PersistenceProvider& spi, - Context& context, uint32_t from, uint32_t to, document::TestDocMan& testDocMan); diff --git a/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp b/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp index 33770004aba..81bfdf7f9a3 100644 --- a/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp +++ b/persistence/src/vespa/persistence/dummyimpl/dummypersistence.cpp @@ -413,7 +413,7 @@ DummyPersistence::getBucketInfo(const Bucket& b) const } void -DummyPersistence::putAsync(const Bucket& b, Timestamp t, Document::SP doc, Context&, OperationComplete::UP onComplete) +DummyPersistence::putAsync(const Bucket& b, Timestamp t, Document::SP doc, OperationComplete::UP onComplete) { DUMMYPERSISTENCE_VERIFY_INITIALIZED; LOG(debug, "put(%s, %" PRIu64 ", %s)", @@ -443,8 +443,9 @@ DummyPersistence::putAsync(const Bucket& b, Timestamp t, Document::SP doc, Conte } void -DummyPersistence::updateAsync(const Bucket& bucket, Timestamp ts, DocumentUpdateSP upd, Context& context, OperationComplete::UP onComplete) +DummyPersistence::updateAsync(const Bucket& bucket, Timestamp ts, DocumentUpdateSP upd, OperationComplete::UP onComplete) { + Context context(0x80, 0); GetResult getResult = get(bucket, document::AllFields(), upd->getId(), context); if (getResult.hasError()) { @@ -465,7 +466,7 @@ DummyPersistence::updateAsync(const Bucket& bucket, Timestamp ts, DocumentUpdate upd->applyTo(*docToUpdate); - Result putResult = put(bucket, ts, std::move(docToUpdate), context); + Result putResult = put(bucket, ts, std::move(docToUpdate)); if (putResult.hasError()) { onComplete->onComplete(std::make_unique<UpdateResult>(putResult.getErrorCode(), putResult.getErrorMessage())); @@ -475,7 +476,7 @@ DummyPersistence::updateAsync(const Bucket& bucket, Timestamp ts, DocumentUpdate } void -DummyPersistence::removeAsync(const Bucket& b, std::vector<TimeStampAndDocumentId> ids, Context &, OperationComplete::UP onComplete) +DummyPersistence::removeAsync(const Bucket& b, std::vector<TimeStampAndDocumentId> ids, OperationComplete::UP onComplete) { DUMMYPERSISTENCE_VERIFY_INITIALIZED; assert(b.getBucketSpace() == FixedBucketSpaces::default_space()); @@ -619,11 +620,10 @@ DummyPersistence::createIterator(const Bucket &b, FieldSetSP fs, const Selection } IterateResult -DummyPersistence::iterate(IteratorId id, uint64_t maxByteSize, Context& ctx) const +DummyPersistence::iterate(IteratorId id, uint64_t maxByteSize) const { DUMMYPERSISTENCE_VERIFY_INITIALIZED; LOG(debug, "iterate(%" PRIu64 ", %" PRIu64 ")", uint64_t(id), maxByteSize); - ctx.trace(9, "started iterate()"); Iterator* it; { std::lock_guard lock(_monitor); @@ -637,7 +637,6 @@ DummyPersistence::iterate(IteratorId id, uint64_t maxByteSize, Context& ctx) con BucketContentGuard::UP bc(acquireBucketWithLock(it->_bucket, LockMode::Shared)); if (!bc.get()) { - ctx.trace(9, "finished iterate(); bucket not found"); return IterateResult(std::vector<DocEntry::UP>(), true); } LOG(debug, "Iterator %" PRIu64 " acquired bucket lock", uint64_t(id)); @@ -668,10 +667,7 @@ DummyPersistence::iterate(IteratorId id, uint64_t maxByteSize, Context& ctx) con } it->_leftToIterate.pop_back(); } - if (ctx.shouldTrace(9)) { - ctx.trace(9, make_string("finished iterate(), returning %zu documents with %u bytes of data", - entries.size(), currentSize)); - } + LOG(debug, "finished iterate(%" PRIu64 ", %" PRIu64 "), returning %zu documents " "with %u bytes of data. %u docs cloned in fast path", uint64_t(id), @@ -687,7 +683,7 @@ DummyPersistence::iterate(IteratorId id, uint64_t maxByteSize, Context& ctx) con } Result -DummyPersistence::destroyIterator(IteratorId id, Context&) +DummyPersistence::destroyIterator(IteratorId id) { DUMMYPERSISTENCE_VERIFY_INITIALIZED; LOG(debug, "destroyIterator(%" PRIu64 ")", uint64_t(id)); @@ -699,7 +695,7 @@ DummyPersistence::destroyIterator(IteratorId id, Context&) } void -DummyPersistence::createBucketAsync(const Bucket& b, Context&, OperationComplete::UP onComplete) noexcept +DummyPersistence::createBucketAsync(const Bucket& b, OperationComplete::UP onComplete) noexcept { DUMMYPERSISTENCE_VERIFY_INITIALIZED; LOG(debug, "createBucket(%s)", b.toString().c_str()); @@ -715,7 +711,7 @@ DummyPersistence::createBucketAsync(const Bucket& b, Context&, OperationComplete } void -DummyPersistence::deleteBucketAsync(const Bucket& b, Context&, OperationComplete::UP onComplete) noexcept +DummyPersistence::deleteBucketAsync(const Bucket& b, OperationComplete::UP onComplete) noexcept { DUMMYPERSISTENCE_VERIFY_INITIALIZED; LOG(debug, "deleteBucket(%s)", b.toString().c_str()); @@ -729,10 +725,7 @@ DummyPersistence::deleteBucketAsync(const Bucket& b, Context&, OperationComplete } Result -DummyPersistence::split(const Bucket& source, - const Bucket& target1, - const Bucket& target2, - Context& context) +DummyPersistence::split(const Bucket& source, const Bucket& target1, const Bucket& target2) { DUMMYPERSISTENCE_VERIFY_INITIALIZED; LOG(debug, "split(%s -> %s, %s)", @@ -742,9 +735,9 @@ DummyPersistence::split(const Bucket& source, assert(source.getBucketSpace() == FixedBucketSpaces::default_space()); assert(target1.getBucketSpace() == FixedBucketSpaces::default_space()); assert(target2.getBucketSpace() == FixedBucketSpaces::default_space()); - createBucket(source, context); - createBucket(target1, context); - createBucket(target2, context); + createBucket(source); + createBucket(target1); + createBucket(target2); BucketContentGuard::UP sourceGuard(acquireBucketWithLock(source)); if (!sourceGuard.get()) { @@ -781,14 +774,13 @@ DummyPersistence::split(const Bucket& source, sourceGuard.reset(0); LOG(debug, "erasing split source %s", source.toString().c_str()); - deleteBucket(source, context); + deleteBucket(source); return Result(); } Result -DummyPersistence::join(const Bucket& source1, const Bucket& source2, - const Bucket& target, Context& context) +DummyPersistence::join(const Bucket& source1, const Bucket& source2, const Bucket& target) { DUMMYPERSISTENCE_VERIFY_INITIALIZED; LOG(debug, "join(%s, %s -> %s)", @@ -798,7 +790,7 @@ DummyPersistence::join(const Bucket& source1, const Bucket& source2, assert(source1.getBucketSpace() == FixedBucketSpaces::default_space()); assert(source2.getBucketSpace() == FixedBucketSpaces::default_space()); assert(target.getBucketSpace() == FixedBucketSpaces::default_space()); - createBucket(target, context); + createBucket(target); BucketContentGuard::UP targetGuard(acquireBucketWithLock(target)); assert(targetGuard.get()); @@ -818,7 +810,7 @@ DummyPersistence::join(const Bucket& source1, const Bucket& source2, (*targetGuard)->insert(std::move(entry)); } sourceGuard.reset(0); - deleteBucket(source, context); + deleteBucket(source); } (*targetGuard)->setActive(active); diff --git a/persistence/src/vespa/persistence/dummyimpl/dummypersistence.h b/persistence/src/vespa/persistence/dummyimpl/dummypersistence.h index 683a738255f..e015185e5b0 100644 --- a/persistence/src/vespa/persistence/dummyimpl/dummypersistence.h +++ b/persistence/src/vespa/persistence/dummyimpl/dummypersistence.h @@ -159,22 +159,22 @@ public: void setActiveStateAsync(const Bucket&, BucketInfo::ActiveState, OperationComplete::UP) override; BucketInfoResult getBucketInfo(const Bucket&) const override; GetResult get(const Bucket&, const document::FieldSet&, const DocumentId&, Context&) const override; - void putAsync(const Bucket&, Timestamp, DocumentSP, Context&, OperationComplete::UP) override; - void removeAsync(const Bucket& b, std::vector<TimeStampAndDocumentId> ids, Context&, OperationComplete::UP) override; - void updateAsync(const Bucket&, Timestamp, DocumentUpdateSP, Context&, OperationComplete::UP) override; + void putAsync(const Bucket&, Timestamp, DocumentSP, OperationComplete::UP) override; + void removeAsync(const Bucket& b, std::vector<TimeStampAndDocumentId> ids, OperationComplete::UP) override; + void updateAsync(const Bucket&, Timestamp, DocumentUpdateSP, OperationComplete::UP) override; CreateIteratorResult createIterator(const Bucket &bucket, FieldSetSP fs, const Selection &, IncludedVersions, Context &context) override; - IterateResult iterate(IteratorId, uint64_t maxByteSize, Context&) const override; - Result destroyIterator(IteratorId, Context&) override; + IterateResult iterate(IteratorId, uint64_t maxByteSize) const override; + Result destroyIterator(IteratorId) override; - void createBucketAsync(const Bucket&, Context&, OperationComplete::UP) noexcept override; - void deleteBucketAsync(const Bucket&, Context&, OperationComplete::UP) noexcept override; + void createBucketAsync(const Bucket&, OperationComplete::UP) noexcept override; + void deleteBucketAsync(const Bucket&, OperationComplete::UP) noexcept override; - Result split(const Bucket& source, const Bucket& target1, const Bucket& target2, Context&) override; + Result split(const Bucket& source, const Bucket& target1, const Bucket& target2) override; - Result join(const Bucket& source1, const Bucket& source2, const Bucket& target, Context&) override; + Result join(const Bucket& source1, const Bucket& source2, const Bucket& target) override; std::unique_ptr<vespalib::IDestructorCallback> register_resource_usage_listener(IResourceUsageListener& listener) override; std::unique_ptr<vespalib::IDestructorCallback> register_executor(std::shared_ptr<BucketExecutor>) override; diff --git a/persistence/src/vespa/persistence/spi/abstractpersistenceprovider.cpp b/persistence/src/vespa/persistence/spi/abstractpersistenceprovider.cpp index 6ee99e49798..f301a9c5428 100644 --- a/persistence/src/vespa/persistence/spi/abstractpersistenceprovider.cpp +++ b/persistence/src/vespa/persistence/spi/abstractpersistenceprovider.cpp @@ -8,11 +8,11 @@ namespace storage::spi { void AbstractPersistenceProvider::removeIfFoundAsync(const Bucket& b, Timestamp timestamp, - const DocumentId& id, Context& context, OperationComplete::UP onComplete) + const DocumentId& id, OperationComplete::UP onComplete) { std::vector<TimeStampAndDocumentId> ids; ids.emplace_back(timestamp, id); - removeAsync(b, std::move(ids), context, std::move(onComplete)); + removeAsync(b, std::move(ids), std::move(onComplete)); } BucketIdListResult diff --git a/persistence/src/vespa/persistence/spi/abstractpersistenceprovider.h b/persistence/src/vespa/persistence/spi/abstractpersistenceprovider.h index 3b59f20ca96..0d90761a0e8 100644 --- a/persistence/src/vespa/persistence/spi/abstractpersistenceprovider.h +++ b/persistence/src/vespa/persistence/spi/abstractpersistenceprovider.h @@ -15,8 +15,8 @@ class AbstractPersistenceProvider : public PersistenceProvider { public: Result initialize() override { return Result(); }; - Result removeEntry(const Bucket&, Timestamp, Context&) override { return Result(); } - void removeIfFoundAsync(const Bucket&, Timestamp, const DocumentId&, Context&, OperationComplete::UP) override; + Result removeEntry(const Bucket&, Timestamp) override { return Result(); } + void removeIfFoundAsync(const Bucket&, Timestamp, const DocumentId&, OperationComplete::UP) override; Result setClusterState(BucketSpace, const ClusterState&) override { return Result(); } BucketIdListResult getModifiedBuckets(BucketSpace bucketSpace) const override; }; diff --git a/persistence/src/vespa/persistence/spi/context.cpp b/persistence/src/vespa/persistence/spi/context.cpp index 561a0cbfc68..b77161de77b 100644 --- a/persistence/src/vespa/persistence/spi/context.cpp +++ b/persistence/src/vespa/persistence/spi/context.cpp @@ -4,7 +4,7 @@ namespace storage::spi { -Context::Context(Priority pri, int maxTraceLevel) +Context::Context(Priority pri, int maxTraceLevel) noexcept : _priority(pri), _trace(maxTraceLevel), _readConsistency(ReadConsistency::STRONG) diff --git a/persistence/src/vespa/persistence/spi/context.h b/persistence/src/vespa/persistence/spi/context.h index b832d9b7af7..ab55f0d1844 100644 --- a/persistence/src/vespa/persistence/spi/context.h +++ b/persistence/src/vespa/persistence/spi/context.h @@ -46,12 +46,12 @@ class Context { vespalib::Trace _trace; ReadConsistency _readConsistency; public: - Context(Context &&) = default; - Context & operator = (Context &&) = default; - Context(Priority pri, int maxTraceLevel); + Context(Context &&) noexcept = default; + Context & operator = (Context &&) noexcept = default; + Context(Priority pri, int maxTraceLevel) noexcept; ~Context(); - Priority getPriority() const { return _priority; } + Priority getPriority() const noexcept { return _priority; } /** * A read operation might choose to relax its consistency requirements, @@ -69,11 +69,11 @@ public: return _readConsistency; } - vespalib::Trace && steal_trace() { return std::move(_trace); } - vespalib::Trace& getTrace() { return _trace; } - const vespalib::Trace& getTrace() const { return _trace; } + vespalib::Trace && steal_trace() noexcept { return std::move(_trace); } + vespalib::Trace& getTrace() noexcept { return _trace; } + const vespalib::Trace& getTrace() const noexcept { return _trace; } - bool shouldTrace(int level) { return _trace.shouldTrace(level); } + bool shouldTrace(int level) noexcept { return _trace.shouldTrace(level); } void trace(int level, vespalib::stringref msg, bool addTime = true) { _trace.trace(level, msg, addTime); } diff --git a/persistence/src/vespa/persistence/spi/persistenceprovider.cpp b/persistence/src/vespa/persistence/spi/persistenceprovider.cpp index e6733dc4150..03cefb8df89 100644 --- a/persistence/src/vespa/persistence/spi/persistenceprovider.cpp +++ b/persistence/src/vespa/persistence/spi/persistenceprovider.cpp @@ -2,7 +2,6 @@ #include "persistenceprovider.h" #include "catchresult.h" -#include <vespa/document/base/documentid.h> #include <future> namespace storage::spi { @@ -18,52 +17,52 @@ PersistenceProvider::setActiveState(const Bucket& bucket, BucketInfo::ActiveStat } Result -PersistenceProvider::createBucket(const Bucket& bucket, Context& context) { +PersistenceProvider::createBucket(const Bucket& bucket) { auto catcher = std::make_unique<CatchResult>(); auto future = catcher->future_result(); - createBucketAsync(bucket, context, std::move(catcher)); + createBucketAsync(bucket, std::move(catcher)); return *future.get(); } Result -PersistenceProvider::deleteBucket(const Bucket& bucket, Context& context) { +PersistenceProvider::deleteBucket(const Bucket& bucket) { auto catcher = std::make_unique<CatchResult>(); auto future = catcher->future_result(); - deleteBucketAsync(bucket, context, std::move(catcher)); + deleteBucketAsync(bucket, std::move(catcher)); return *future.get(); } Result -PersistenceProvider::put(const Bucket& bucket, Timestamp timestamp, DocumentSP doc, Context& context) { +PersistenceProvider::put(const Bucket& bucket, Timestamp timestamp, DocumentSP doc) { auto catcher = std::make_unique<CatchResult>(); auto future = catcher->future_result(); - putAsync(bucket, timestamp, std::move(doc), context, std::move(catcher)); + putAsync(bucket, timestamp, std::move(doc), std::move(catcher)); return *future.get(); } RemoveResult -PersistenceProvider::remove(const Bucket& bucket, Timestamp timestamp, const DocumentId & docId, Context& context) { +PersistenceProvider::remove(const Bucket& bucket, Timestamp timestamp, const DocumentId & docId) { auto catcher = std::make_unique<CatchResult>(); auto future = catcher->future_result(); std::vector<TimeStampAndDocumentId> ids; ids.emplace_back(timestamp, docId); - removeAsync(bucket, std::move(ids), context, std::move(catcher)); + removeAsync(bucket, std::move(ids), std::move(catcher)); return dynamic_cast<const RemoveResult &>(*future.get()); } RemoveResult -PersistenceProvider::removeIfFound(const Bucket& bucket, Timestamp timestamp, const DocumentId & docId, Context& context) { +PersistenceProvider::removeIfFound(const Bucket& bucket, Timestamp timestamp, const DocumentId & docId) { auto catcher = std::make_unique<CatchResult>(); auto future = catcher->future_result(); - removeIfFoundAsync(bucket, timestamp, docId, context, std::move(catcher)); + removeIfFoundAsync(bucket, timestamp, docId, std::move(catcher)); return dynamic_cast<const RemoveResult &>(*future.get()); } UpdateResult -PersistenceProvider::update(const Bucket& bucket, Timestamp timestamp, DocumentUpdateSP upd, Context& context) { +PersistenceProvider::update(const Bucket& bucket, Timestamp timestamp, DocumentUpdateSP upd) { auto catcher = std::make_unique<CatchResult>(); auto future = catcher->future_result(); - updateAsync(bucket, timestamp, std::move(upd), context, std::move(catcher)); + updateAsync(bucket, timestamp, std::move(upd), std::move(catcher)); return dynamic_cast<const UpdateResult &>(*future.get()); } diff --git a/persistence/src/vespa/persistence/spi/persistenceprovider.h b/persistence/src/vespa/persistence/spi/persistenceprovider.h index 38c86454255..a90d39e8334 100644 --- a/persistence/src/vespa/persistence/spi/persistenceprovider.h +++ b/persistence/src/vespa/persistence/spi/persistenceprovider.h @@ -60,13 +60,13 @@ struct PersistenceProvider virtual ~PersistenceProvider(); // TODO Move to utility class for use in tests only - Result createBucket(const Bucket&, Context&); - Result deleteBucket(const Bucket&, Context&); - Result put(const Bucket&, Timestamp, DocumentSP, Context&); + Result createBucket(const Bucket&); + Result deleteBucket(const Bucket&); + Result put(const Bucket&, Timestamp, DocumentSP); Result setActiveState(const Bucket&, BucketInfo::ActiveState); - RemoveResult remove(const Bucket&, Timestamp timestamp, const DocumentId& id, Context&); - RemoveResult removeIfFound(const Bucket&, Timestamp timestamp, const DocumentId& id, Context&); - UpdateResult update(const Bucket&, Timestamp timestamp, DocumentUpdateSP update, Context&); + RemoveResult remove(const Bucket&, Timestamp timestamp, const DocumentId& id); + RemoveResult removeIfFound(const Bucket&, Timestamp timestamp, const DocumentId& id); + UpdateResult update(const Bucket&, Timestamp timestamp, DocumentUpdateSP update); /** * Initializes the persistence provider. This function is called exactly @@ -109,7 +109,7 @@ struct PersistenceProvider /** * Store the given document at the given microsecond time. */ - virtual void putAsync(const Bucket &, Timestamp , DocumentSP , Context &, OperationComplete::UP ) = 0; + virtual void putAsync(const Bucket &, Timestamp , DocumentSP, OperationComplete::UP ) = 0; /** * This remove function assumes that there exist something to be removed. @@ -170,7 +170,7 @@ struct PersistenceProvider * @param timestamp The timestamp for the new bucket entry. * @param id The ID to remove */ - virtual void removeAsync(const Bucket&, std::vector<TimeStampAndDocumentId> ids, Context&, OperationComplete::UP) = 0; + virtual void removeAsync(const Bucket&, std::vector<TimeStampAndDocumentId> ids, OperationComplete::UP) = 0; /** * @see remove() @@ -188,7 +188,7 @@ struct PersistenceProvider * @param timestamp The timestamp for the new bucket entry. * @param id The ID to remove */ - virtual void removeIfFoundAsync(const Bucket&, Timestamp timestamp, const DocumentId& id, Context&, OperationComplete::UP) = 0; + virtual void removeIfFoundAsync(const Bucket&, Timestamp timestamp, const DocumentId& id, OperationComplete::UP) = 0; /** * Remove any trace of the entry with the given timestamp. (Be it a document @@ -197,7 +197,7 @@ struct PersistenceProvider * failed to insert. This operation should be successful even if there * doesn't exist such an entry. */ - virtual Result removeEntry(const Bucket&, Timestamp, Context&) = 0; + virtual Result removeEntry(const Bucket&, Timestamp) = 0; /** * Partially modifies a document referenced by the document update. @@ -207,7 +207,7 @@ struct PersistenceProvider * @param timestamp The timestamp to use for the new update entry. * @param update The document update to apply to the stored document. */ - virtual void updateAsync(const Bucket&, Timestamp timestamp, DocumentUpdateSP update, Context&, OperationComplete::UP) = 0; + virtual void updateAsync(const Bucket&, Timestamp timestamp, DocumentUpdateSP update, OperationComplete::UP) = 0; /** * Retrieves the latest version of the document specified by the @@ -315,7 +315,7 @@ struct PersistenceProvider * @param maxByteSize An indication of the maximum number of bytes that * should be returned. */ - virtual IterateResult iterate(IteratorId id, uint64_t maxByteSize, Context&) const = 0; + virtual IterateResult iterate(IteratorId id, uint64_t maxByteSize) const = 0; /** * Destroys the iterator specified by the given id. @@ -333,20 +333,20 @@ struct PersistenceProvider * <p/> * @param id The iterator id previously returned by createIterator. */ - virtual Result destroyIterator(IteratorId id, Context&) = 0; + virtual Result destroyIterator(IteratorId id) = 0; /** * Tells the provider that the given bucket has been created in the * service layer. There is no requirement to do anything here. */ - virtual void createBucketAsync(const Bucket&, Context&, OperationComplete::UP) noexcept = 0; + virtual void createBucketAsync(const Bucket&, OperationComplete::UP) noexcept = 0; /** * Deletes the given bucket and all entries contained in that bucket. * After this operation has succeeded, a restart of the provider should * not yield the bucket in getBucketList(). */ - virtual void deleteBucketAsync(const Bucket&, Context&, OperationComplete::UP) noexcept = 0; + virtual void deleteBucketAsync(const Bucket&, OperationComplete::UP) noexcept = 0; /** * This function is called continuously by the service layer. It allows the @@ -374,13 +374,13 @@ struct PersistenceProvider * don't want to split far enough to split content in two. In these cases * target2 will specify invalid bucket 0 (with 0 used bits). */ - virtual Result split(const Bucket& source, const Bucket& target1, const Bucket& target2, Context&) = 0; + virtual Result split(const Bucket& source, const Bucket& target1, const Bucket& target2) = 0; /** * Joins two buckets into one. After the join, all documents from * source1 and source2 should be stored in the target bucket. */ - virtual Result join(const Bucket& source1, const Bucket& source2, const Bucket& target, Context&) = 0; + virtual Result join(const Bucket& source1, const Bucket& source2, const Bucket& target) = 0; /* * Register a listener for updates to resource usage. |