From 94f53ab6a93aefa007200b97846ce47ea166bd70 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Thu, 31 Mar 2022 13:00:32 +0000 Subject: GC unused Context parameter --- .../conformancetest/conformancetest.cpp | 434 +++++++++------------ .../persistence/conformancetest/conformancetest.h | 1 - .../persistence/dummyimpl/dummypersistence.cpp | 44 +-- .../vespa/persistence/dummyimpl/dummypersistence.h | 18 +- .../spi/abstractpersistenceprovider.cpp | 4 +- .../persistence/spi/abstractpersistenceprovider.h | 4 +- persistence/src/vespa/persistence/spi/context.cpp | 2 +- persistence/src/vespa/persistence/spi/context.h | 16 +- .../vespa/persistence/spi/persistenceprovider.cpp | 25 +- .../vespa/persistence/spi/persistenceprovider.h | 34 +- .../persistenceengine/persistenceengine_test.cpp | 59 ++- .../src/vespa/searchcore/bmcluster/bm_node.cpp | 10 +- .../searchcore/bmcluster/spi_bm_feed_handler.cpp | 6 +- .../proton/persistenceengine/persistenceengine.cpp | 21 +- .../proton/persistenceengine/persistenceengine.h | 18 +- .../persistence/common/filestortestfixture.cpp | 7 +- .../common/persistenceproviderwrapper.cpp | 65 ++- .../common/persistenceproviderwrapper.h | 24 +- .../filestorage/filestormanagertest.cpp | 23 +- .../filestorage/operationabortingtest.cpp | 10 +- .../src/tests/persistence/persistencetestutils.cpp | 31 +- .../persistence/persistencethread_splittest.cpp | 10 +- .../src/tests/persistence/splitbitdetectortest.cpp | 82 ++-- storage/src/tests/persistence/testandsettest.cpp | 6 +- .../src/vespa/storage/persistence/asynchandler.cpp | 15 +- .../vespa/storage/persistence/bucketprocessor.cpp | 14 +- .../persistence/filestorage/filestormanager.cpp | 2 +- .../src/vespa/storage/persistence/mergehandler.cpp | 29 +- .../src/vespa/storage/persistence/mergehandler.h | 1 - .../storage/persistence/provider_error_wrapper.cpp | 46 ++- .../storage/persistence/provider_error_wrapper.h | 22 +- .../storage/persistence/simplemessagehandler.cpp | 4 +- .../vespa/storage/persistence/splitjoinhandler.cpp | 11 +- vespalib/src/vespa/vespalib/trace/trace.h | 14 +- vespalib/src/vespa/vespalib/trace/tracenode.cpp | 4 +- vespalib/src/vespa/vespalib/trace/tracenode.h | 6 +- 36 files changed, 478 insertions(+), 644 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 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().max(), context); + std::numeric_limits().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 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().max(), context); + IterateResult result = spi->iterate(iter.getIteratorId(), std::numeric_limits().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 docs; for (size_t i(0); i < 30; i++) { @@ -775,7 +767,7 @@ TEST_F(ConformanceTest, testRemoveMulti) std::vector 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(); 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(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(std::make_unique(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(*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 docs(feedDocs(*spi, testDocMan, b, 100)); CreateIteratorResult iter(createIterator(*spi, b, createSelection(""))); @@ -1074,7 +1061,7 @@ TEST_F(ConformanceTest, testIterateAllDocs) std::vector 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 docs(feedDocs(*spi, testDocMan, b, 100)); std::vector 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 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 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 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 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 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 docsToVisit; std::vector 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 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 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 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 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 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 docs = feedDocs(*spi, testDocMan, b, 10); Selection sel(createSelection("")); @@ -1390,12 +1360,12 @@ TEST_F(ConformanceTest, testIterateAlreadyCompleted) std::vector 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 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 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(putResult.getErrorCode(), putResult.getErrorMessage())); @@ -475,7 +476,7 @@ DummyPersistence::updateAsync(const Bucket& bucket, Timestamp ts, DocumentUpdate } void -DummyPersistence::removeAsync(const Bucket& b, std::vector ids, Context &, OperationComplete::UP onComplete) +DummyPersistence::removeAsync(const Bucket& b, std::vector 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(), 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 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 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 register_resource_usage_listener(IResourceUsageListener& listener) override; std::unique_ptr register_executor(std::shared_ptr) 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 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 #include 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(); 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(); 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(); 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(); auto future = catcher->future_result(); std::vector 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(*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(); auto future = catcher->future_result(); - removeIfFoundAsync(bucket, timestamp, docId, context, std::move(catcher)); + removeIfFoundAsync(bucket, timestamp, docId, std::move(catcher)); return dynamic_cast(*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(); 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(*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 ids, Context&, OperationComplete::UP) = 0; + virtual void removeAsync(const Bucket&, std::vector 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 *

* @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. diff --git a/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp b/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp index 6fb7a35fffe..cf58056cae8 100644 --- a/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp +++ b/searchcore/src/tests/proton/persistenceengine/persistenceengine_test.cpp @@ -446,17 +446,16 @@ TEST_F("require that getPartitionStates() prepares all handlers", SimpleFixture) TEST_F("require that puts are routed to handler", SimpleFixture) { - Context context(storage::spi::Priority(0), storage::spi::Trace::TraceLevel(0)); - f.engine.put(bucket1, tstamp1, doc1, context); + f.engine.put(bucket1, tstamp1, doc1); TEST_DO(assertHandler(bucket1, tstamp1, docId1, f.hset.handler1)); TEST_DO(assertHandler(bucket0, tstamp0, docId0, f.hset.handler2)); - f.engine.put(bucket1, tstamp1, doc2, context); + f.engine.put(bucket1, tstamp1, doc2); TEST_DO(assertHandler(bucket1, tstamp1, docId1, f.hset.handler1)); TEST_DO(assertHandler(bucket1, tstamp1, docId2, f.hset.handler2)); EXPECT_EQUAL(Result(Result::ErrorType::PERMANENT_ERROR, "No handler for document type 'type3'"), - f.engine.put(bucket1, tstamp1, doc3, context)); + f.engine.put(bucket1, tstamp1, doc3)); } @@ -465,39 +464,35 @@ TEST_F("require that put is rejected if resource limit is reached", SimpleFixtur f._writeFilter._acceptWriteOperation = false; f._writeFilter._message = "Disk is full"; - Context context(storage::spi::Priority(0), storage::spi::Trace::TraceLevel(0)); EXPECT_EQUAL( Result(Result::ErrorType::RESOURCE_EXHAUSTED, "Put operation rejected for document 'id:type3:type3::1': 'Disk is full'"), - f.engine.put(bucket1, tstamp1, doc3, context)); + f.engine.put(bucket1, tstamp1, doc3)); } TEST_F("require that updates are routed to handler", SimpleFixture) { - Context context(storage::spi::Priority(0), storage::spi::Trace::TraceLevel(0)); f.hset.handler1.setExistingTimestamp(tstamp2); - UpdateResult ur = f.engine.update(bucket1, tstamp1, upd1, context); + UpdateResult ur = f.engine.update(bucket1, tstamp1, upd1); TEST_DO(assertHandler(bucket1, tstamp1, docId1, f.hset.handler1)); TEST_DO(assertHandler(bucket0, tstamp0, docId0, f.hset.handler2)); EXPECT_EQUAL(tstamp2, ur.getExistingTimestamp()); f.hset.handler2.setExistingTimestamp(tstamp3); - ur = f.engine.update(bucket1, tstamp1, upd2, context); + ur = f.engine.update(bucket1, tstamp1, upd2); TEST_DO(assertHandler(bucket1, tstamp1, docId1, f.hset.handler1)); TEST_DO(assertHandler(bucket1, tstamp1, docId2, f.hset.handler2)); EXPECT_EQUAL(tstamp3, ur.getExistingTimestamp()); EXPECT_EQUAL(Result(Result::ErrorType::PERMANENT_ERROR, "No handler for document type 'type3'"), - f.engine.update(bucket1, tstamp1, upd3, context)); + f.engine.update(bucket1, tstamp1, upd3)); } TEST_F("require that updates with bad ids are rejected", SimpleFixture) { - Context context(storage::spi::Priority(0), storage::spi::Trace::TraceLevel(0)); - EXPECT_EQUAL(UpdateResult(Result::ErrorType::PERMANENT_ERROR, "Update operation rejected due to bad id (id:type2:type2::1, type1)"), - f.engine.update(bucket1, tstamp1, bad_id_upd, context)); + f.engine.update(bucket1, tstamp1, bad_id_upd)); } TEST_F("require that simple, cheap update is not rejected if resource limit is reached", SimpleFixture) @@ -505,10 +500,8 @@ TEST_F("require that simple, cheap update is not rejected if resource limit is r f._writeFilter._acceptWriteOperation = false; f._writeFilter._message = "Disk is full"; - Context context(storage::spi::Priority(0), storage::spi::Trace::TraceLevel(0)); - EXPECT_EQUAL(Result(Result::ErrorType::NONE, ""), - f.engine.update(bucket1, tstamp1, upd1, context)); + f.engine.update(bucket1, tstamp1, upd1)); } TEST_F("require that update is rejected if resource limit is reached", SimpleFixture) @@ -516,7 +509,6 @@ TEST_F("require that update is rejected if resource limit is reached", SimpleFix f._writeFilter._acceptWriteOperation = false; f._writeFilter._message = "Disk is full"; - Context context(storage::spi::Priority(0), storage::spi::Trace::TraceLevel(0)); DocumentType type(createDocType("type_with_one_string", 1)); document::Field field("string", 1, *document::DataType::STRING); type.addField(field); @@ -526,13 +518,12 @@ TEST_F("require that update is rejected if resource limit is reached", SimpleFix EXPECT_EQUAL( Result(Result::ErrorType::RESOURCE_EXHAUSTED, "Update operation rejected for document 'id:type1:type1::1': 'Disk is full'"), - f.engine.update(bucket1, tstamp1, upd, context)); + f.engine.update(bucket1, tstamp1, upd)); } TEST_F("require that removes are routed to handlers", SimpleFixture) { - Context context(storage::spi::Priority(0), storage::spi::Trace::TraceLevel(0)); - RemoveResult rr = f.engine.remove(bucket1, tstamp1, docId3, context); + RemoveResult rr = f.engine.remove(bucket1, tstamp1, docId3); TEST_DO(assertHandler(bucket0, tstamp0, docId0, f.hset.handler1)); TEST_DO(assertHandler(bucket0, tstamp0, docId0, f.hset.handler2)); EXPECT_FALSE(rr.wasFound()); @@ -540,7 +531,7 @@ TEST_F("require that removes are routed to handlers", SimpleFixture) EXPECT_EQUAL(Result(Result::ErrorType::PERMANENT_ERROR, "No handler for document type 'type3'"), rr); f.hset.handler1.setExistingTimestamp(tstamp2); - rr = f.engine.remove(bucket1, tstamp1, docId1, context); + rr = f.engine.remove(bucket1, tstamp1, docId1); TEST_DO(assertHandler(bucket1, tstamp1, docId1, f.hset.handler1)); TEST_DO(assertHandler(bucket0, tstamp0, docId0, f.hset.handler2)); EXPECT_TRUE(rr.wasFound()); @@ -548,14 +539,14 @@ TEST_F("require that removes are routed to handlers", SimpleFixture) f.hset.handler1.setExistingTimestamp(tstamp0); f.hset.handler2.setExistingTimestamp(tstamp3); - rr = f.engine.remove(bucket1, tstamp1, docId2, context); + rr = f.engine.remove(bucket1, tstamp1, docId2); TEST_DO(assertHandler(bucket1, tstamp1, docId1, f.hset.handler1)); TEST_DO(assertHandler(bucket1, tstamp1, docId2, f.hset.handler2)); EXPECT_TRUE(rr.wasFound()); EXPECT_FALSE(rr.hasError()); f.hset.handler2.setExistingTimestamp(tstamp0); - rr = f.engine.remove(bucket1, tstamp1, docId2, context); + rr = f.engine.remove(bucket1, tstamp1, docId2); TEST_DO(assertHandler(bucket1, tstamp1, docId1, f.hset.handler1)); TEST_DO(assertHandler(bucket1, tstamp1, docId2, f.hset.handler2)); EXPECT_FALSE(rr.wasFound()); @@ -567,9 +558,7 @@ TEST_F("require that remove is NOT rejected if resource limit is reached", Simpl f._writeFilter._acceptWriteOperation = false; f._writeFilter._message = "Disk is full"; - Context context(storage::spi::Priority(0), storage::spi::Trace::TraceLevel(0)); - - EXPECT_EQUAL(RemoveResult(false), f.engine.remove(bucket1, tstamp1, docId1, context)); + EXPECT_EQUAL(RemoveResult(false), f.engine.remove(bucket1, tstamp1, docId1)); } @@ -619,11 +608,10 @@ TEST_F("require that getBucketInfo() is routed to handlers and merged", SimpleFi TEST_F("require that createBucket() is routed to handlers and merged", SimpleFixture) { - Context context(storage::spi::Priority(0), storage::spi::Trace::TraceLevel(0)); f.hset.handler1._createBucketResult = Result(Result::ErrorType::TRANSIENT_ERROR, "err1a"); f.hset.handler2._createBucketResult = Result(Result::ErrorType::PERMANENT_ERROR, "err2a"); - Result result = f.engine.createBucket(bucket1, context); + Result result = f.engine.createBucket(bucket1); EXPECT_EQUAL(Result::ErrorType::PERMANENT_ERROR, result.getErrorCode()); EXPECT_EQUAL("err1a, err2a", result.getErrorMessage()); } @@ -631,11 +619,10 @@ TEST_F("require that createBucket() is routed to handlers and merged", SimpleFix TEST_F("require that deleteBucket() is routed to handlers and merged", SimpleFixture) { - Context context(storage::spi::Priority(0), storage::spi::Trace::TraceLevel(0)); f.hset.handler1.deleteBucketResult = Result(Result::ErrorType::TRANSIENT_ERROR, "err1"); f.hset.handler2.deleteBucketResult = Result(Result::ErrorType::PERMANENT_ERROR, "err2"); - Result result = f.engine.deleteBucket(bucket1, context); + Result result = f.engine.deleteBucket(bucket1); EXPECT_EQUAL(Result::ErrorType::PERMANENT_ERROR, result.getErrorCode()); EXPECT_EQUAL("err1, err2", result.getErrorMessage()); } @@ -680,7 +667,7 @@ TEST_F("require that createIterator does", SimpleFixture) { EXPECT_TRUE(result.getIteratorId()); uint64_t max_size = 1024; - IterateResult it_result = f.engine.iterate(result.getIteratorId(), max_size, context); + IterateResult it_result = f.engine.iterate(result.getIteratorId(), max_size); EXPECT_FALSE(it_result.hasError()); } @@ -700,7 +687,7 @@ TEST_F("require that iterator ids are unique", SimpleFixture) { TEST_F("require that iterate requires valid iterator", SimpleFixture) { uint64_t max_size = 1024; Context context(storage::spi::Priority(0), storage::spi::Trace::TraceLevel(0)); - IterateResult it_result = f.engine.iterate(IteratorId(1), max_size, context); + IterateResult it_result = f.engine.iterate(IteratorId(1), max_size); EXPECT_TRUE(it_result.hasError()); EXPECT_EQUAL(Result::ErrorType::PERMANENT_ERROR, it_result.getErrorCode()); EXPECT_EQUAL("Unknown iterator with id 1", it_result.getErrorMessage()); @@ -710,7 +697,7 @@ TEST_F("require that iterate requires valid iterator", SimpleFixture) { storage::spi::NEWEST_DOCUMENT_ONLY, context); EXPECT_TRUE(result.getIteratorId()); - it_result = f.engine.iterate(result.getIteratorId(), max_size, context); + it_result = f.engine.iterate(result.getIteratorId(), max_size); EXPECT_FALSE(it_result.hasError()); } @@ -725,7 +712,7 @@ TEST_F("require that iterate returns documents", SimpleFixture) { storage::spi::NEWEST_DOCUMENT_ONLY, context); EXPECT_TRUE(result.getIteratorId()); - IterateResult it_result = f.engine.iterate(result.getIteratorId(), max_size, context); + IterateResult it_result = f.engine.iterate(result.getIteratorId(), max_size); EXPECT_FALSE(it_result.hasError()); EXPECT_EQUAL(2u, it_result.getEntries().size()); } @@ -739,11 +726,11 @@ TEST_F("require that destroyIterator prevents iteration", SimpleFixture) { storage::spi::NEWEST_DOCUMENT_ONLY, context); EXPECT_TRUE(create_result.getIteratorId()); - Result result = f.engine.destroyIterator(create_result.getIteratorId(), context); + Result result = f.engine.destroyIterator(create_result.getIteratorId()); EXPECT_FALSE(result.hasError()); uint64_t max_size = 1024; - IterateResult it_result = f.engine.iterate(create_result.getIteratorId(), max_size, context); + IterateResult it_result = f.engine.iterate(create_result.getIteratorId(), max_size); EXPECT_TRUE(it_result.hasError()); EXPECT_EQUAL(Result::ErrorType::PERMANENT_ERROR, it_result.getErrorCode()); string msg_prefix = "Unknown iterator with id"; diff --git a/searchcore/src/vespa/searchcore/bmcluster/bm_node.cpp b/searchcore/src/vespa/searchcore/bmcluster/bm_node.cpp index 9cab70cd72b..4db46ead525 100644 --- a/searchcore/src/vespa/searchcore/bmcluster/bm_node.cpp +++ b/searchcore/src/vespa/searchcore/bmcluster/bm_node.cpp @@ -7,12 +7,7 @@ #include "bm_node_stats.h" #include "bm_storage_chain_builder.h" #include "bm_storage_link_context.h" -#include "document_api_message_bus_bm_feed_handler.h" #include "i_bm_distribution.h" -#include "i_bm_feed_handler.h" -#include "spi_bm_feed_handler.h" -#include "storage_api_chain_bm_feed_handler.h" -#include "storage_api_message_bus_bm_feed_handler.h" #include "storage_api_rpc_bm_feed_handler.h" #include #include @@ -60,7 +55,6 @@ #include #include #include -#include #include #include #include @@ -155,8 +149,6 @@ int port_number(int base_port, PortBias bias) return base_port + static_cast(bias); } -storage::spi::Context context(storage::spi::Priority(0), 0); - template ChainLink* extract_chain_link(Process &process) { @@ -610,7 +602,7 @@ MyBmNode::initialize_persistence_provider() void MyBmNode::create_bucket(const document::Bucket& bucket) { - get_persistence_provider()->createBucket(storage::spi::Bucket(bucket), context); + get_persistence_provider()->createBucket(storage::spi::Bucket(bucket)); } void diff --git a/searchcore/src/vespa/searchcore/bmcluster/spi_bm_feed_handler.cpp b/searchcore/src/vespa/searchcore/bmcluster/spi_bm_feed_handler.cpp index d5421eaaeca..69013e8d7c5 100644 --- a/searchcore/src/vespa/searchcore/bmcluster/spi_bm_feed_handler.cpp +++ b/searchcore/src/vespa/searchcore/bmcluster/spi_bm_feed_handler.cpp @@ -108,7 +108,7 @@ SpiBmFeedHandler::put(const document::Bucket& bucket, std::unique_ptr auto provider = get_provider(bucket); if (provider) { Bucket spi_bucket(bucket); - provider->putAsync(spi_bucket, Timestamp(timestamp), std::move(document), context, std::make_unique(provider, _errors, spi_bucket, tracker)); + provider->putAsync(spi_bucket, Timestamp(timestamp), std::move(document), std::make_unique(provider, _errors, spi_bucket, tracker)); } else { ++_errors; } @@ -121,7 +121,7 @@ SpiBmFeedHandler::update(const document::Bucket& bucket, std::unique_ptrupdateAsync(spi_bucket, Timestamp(timestamp), std::move(document_update), context, std::make_unique(provider, _errors, spi_bucket, tracker)); + provider->updateAsync(spi_bucket, Timestamp(timestamp), std::move(document_update), std::make_unique(provider, _errors, spi_bucket, tracker)); } else { ++_errors; } @@ -136,7 +136,7 @@ SpiBmFeedHandler::remove(const document::Bucket& bucket, const DocumentId& docum Bucket spi_bucket(bucket); std::vector ids; ids.emplace_back(Timestamp(timestamp), document_id); - provider->removeAsync(spi_bucket, std::move(ids), context, std::make_unique(provider, _errors, spi_bucket, tracker)); + provider->removeAsync(spi_bucket, std::move(ids), std::make_unique(provider, _errors, spi_bucket, tracker)); } else { ++_errors; } diff --git a/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.cpp b/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.cpp index 94882bfadf5..0621612aca7 100644 --- a/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.cpp +++ b/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.cpp @@ -343,7 +343,7 @@ PersistenceEngine::getBucketInfo(const Bucket& b) const void -PersistenceEngine::putAsync(const Bucket &bucket, Timestamp ts, storage::spi::DocumentSP doc, Context &, OperationComplete::UP onComplete) +PersistenceEngine::putAsync(const Bucket &bucket, Timestamp ts, storage::spi::DocumentSP doc, OperationComplete::UP onComplete) { if (!_writeFilter.acceptWriteOperation()) { IResourceWriteFilter::State state = _writeFilter.getAcceptState(); @@ -370,7 +370,7 @@ PersistenceEngine::putAsync(const Bucket &bucket, Timestamp ts, storage::spi::Do } void -PersistenceEngine::removeAsync(const Bucket& b, std::vector ids, Context&, OperationComplete::UP onComplete) +PersistenceEngine::removeAsync(const Bucket& b, std::vector ids, OperationComplete::UP onComplete) { if (ids.size() == 1) { removeAsyncSingle(b, ids[0].first, ids[0].second, std::move(onComplete)); @@ -429,7 +429,7 @@ PersistenceEngine::removeAsyncSingle(const Bucket& b, Timestamp t, const Documen void -PersistenceEngine::updateAsync(const Bucket& b, Timestamp t, DocumentUpdate::SP upd, Context&, OperationComplete::UP onComplete) +PersistenceEngine::updateAsync(const Bucket& b, Timestamp t, DocumentUpdate::SP upd, OperationComplete::UP onComplete) { if (!_writeFilter.acceptWriteOperation()) { IResourceWriteFilter::State state = _writeFilter.getAcceptState(); @@ -534,7 +534,7 @@ PersistenceEngine::createIterator(const Bucket &bucket, FieldSetSP fields, const PersistenceEngine::IterateResult -PersistenceEngine::iterate(IteratorId id, uint64_t maxByteSize, Context&) const +PersistenceEngine::iterate(IteratorId id, uint64_t maxByteSize) const { ReadGuard rguard(_rwMutex); IteratorEntry *iteratorEntry; @@ -568,7 +568,7 @@ PersistenceEngine::iterate(IteratorId id, uint64_t maxByteSize, Context&) const Result -PersistenceEngine::destroyIterator(IteratorId id, Context&) +PersistenceEngine::destroyIterator(IteratorId id) { ReadGuard rguard(_rwMutex); std::lock_guard guard(_iterators_lock); @@ -586,7 +586,7 @@ PersistenceEngine::destroyIterator(IteratorId id, Context&) void -PersistenceEngine::createBucketAsync(const Bucket &b, Context &, OperationComplete::UP onComplete) noexcept +PersistenceEngine::createBucketAsync(const Bucket &b, OperationComplete::UP onComplete) noexcept { ReadGuard rguard(_rwMutex); LOG(spam, "createBucket(%s)", b.toString().c_str()); @@ -606,7 +606,7 @@ PersistenceEngine::createBucketAsync(const Bucket &b, Context &, OperationComple void -PersistenceEngine::deleteBucketAsync(const Bucket& b, Context&, OperationComplete::UP onComplete) noexcept +PersistenceEngine::deleteBucketAsync(const Bucket& b, OperationComplete::UP onComplete) noexcept { ReadGuard rguard(_rwMutex); LOG(spam, "deleteBucket(%s)", b.toString().c_str()); @@ -651,7 +651,7 @@ PersistenceEngine::getModifiedBuckets(BucketSpace bucketSpace) const Result -PersistenceEngine::split(const Bucket& source, const Bucket& target1, const Bucket& target2, Context&) +PersistenceEngine::split(const Bucket& source, const Bucket& target1, const Bucket& target2) { ReadGuard rguard(_rwMutex); LOG(spam, "split(%s, %s, %s)", source.toString().c_str(), target1.toString().c_str(), target2.toString().c_str()); @@ -669,7 +669,7 @@ PersistenceEngine::split(const Bucket& source, const Bucket& target1, const Buck Result -PersistenceEngine::join(const Bucket& source1, const Bucket& source2, const Bucket& target, Context&) +PersistenceEngine::join(const Bucket& source1, const Bucket& source2, const Bucket& target) { ReadGuard rguard(_rwMutex); LOG(spam, "join(%s, %s, %s)", source1.toString().c_str(), source2.toString().c_str(), target.toString().c_str()); @@ -694,7 +694,6 @@ PersistenceEngine::register_resource_usage_listener(IResourceUsageListener& list void PersistenceEngine::destroyIterators() { - Context context(storage::spi::Priority(0x80), 0); for (;;) { IteratorId id; { @@ -703,7 +702,7 @@ PersistenceEngine::destroyIterators() break; id = _iterators.begin()->first; } - Result res(destroyIterator(id, context)); + Result res(destroyIterator(id)); if (res.hasError()) { LOG(debug, "%zu iterator left. Can not destroy iterator '%" PRIu64 "'. Reason='%s'", _iterators.size(), id.getValue(), res.toString().c_str()); std::this_thread::sleep_for(100ms); diff --git a/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.h b/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.h index 7c8040fae9d..a8886e19def 100644 --- a/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.h +++ b/searchcore/src/vespa/searchcore/proton/persistenceengine/persistenceengine.h @@ -106,20 +106,20 @@ public: Result setClusterState(BucketSpace bucketSpace, const ClusterState& calc) override; void setActiveStateAsync(const Bucket&, BucketInfo::ActiveState, OperationComplete::UP) override; BucketInfoResult getBucketInfo(const Bucket&) const override; - void putAsync(const Bucket &, Timestamp, storage::spi::DocumentSP, Context &context, OperationComplete::UP) override; - void removeAsync(const Bucket&, std::vector ids, Context&, OperationComplete::UP) override; - void updateAsync(const Bucket&, Timestamp, storage::spi::DocumentUpdateSP, Context&, OperationComplete::UP) override; + void putAsync(const Bucket &, Timestamp, storage::spi::DocumentSP, OperationComplete::UP) override; + void removeAsync(const Bucket&, std::vector ids, OperationComplete::UP) override; + void updateAsync(const Bucket&, Timestamp, storage::spi::DocumentUpdateSP, OperationComplete::UP) override; GetResult get(const Bucket&, const document::FieldSet&, const document::DocumentId&, Context&) const override; CreateIteratorResult createIterator(const Bucket &bucket, FieldSetSP, const Selection &, IncludedVersions, Context &context) override; - IterateResult iterate(IteratorId, uint64_t maxByteSize, Context&) const override; - Result destroyIterator(IteratorId, Context&) override; + IterateResult iterate(IteratorId, uint64_t maxByteSize) const override; + Result destroyIterator(IteratorId) override; - void createBucketAsync(const Bucket &bucketId, Context &, OperationComplete::UP) noexcept override; - void deleteBucketAsync(const Bucket&, Context&, OperationComplete::UP) noexcept override; + void createBucketAsync(const Bucket &bucketId, OperationComplete::UP) noexcept override; + void deleteBucketAsync(const Bucket&, OperationComplete::UP) noexcept override; BucketIdListResult getModifiedBuckets(BucketSpace bucketSpace) const override; - Result split(const Bucket& source, const Bucket& target1, const Bucket& target2, Context&) override; - Result join(const Bucket& source1, const Bucket& source2, const Bucket& target, 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) override; std::unique_ptr register_resource_usage_listener(IResourceUsageListener& listener) override; std::unique_ptr register_executor(std::shared_ptr) override; void destroyIterators(); diff --git a/storage/src/tests/persistence/common/filestortestfixture.cpp b/storage/src/tests/persistence/common/filestortestfixture.cpp index 24504a2006b..0b1eec30b2e 100644 --- a/storage/src/tests/persistence/common/filestortestfixture.cpp +++ b/storage/src/tests/persistence/common/filestortestfixture.cpp @@ -51,12 +51,9 @@ FileStorTestFixture::TearDown() void FileStorTestFixture::createBucket(const document::BucketId& bid) { - spi::Context context(spi::Priority(0), spi::Trace::TraceLevel(0)); - _node->getPersistenceProvider().createBucket(makeSpiBucket(bid), context); - + _node->getPersistenceProvider().createBucket(makeSpiBucket(bid)); StorBucketDatabase::WrappedEntry entry( - _node->getStorageBucketDatabase().get(bid, "foo", - StorBucketDatabase::CREATE_IF_NONEXISTING)); + _node->getStorageBucketDatabase().get(bid, "foo", StorBucketDatabase::CREATE_IF_NONEXISTING)); entry->info = api::BucketInfo(0, 0, 0, 0, 0, true, false); entry.write(); } diff --git a/storage/src/tests/persistence/common/persistenceproviderwrapper.cpp b/storage/src/tests/persistence/common/persistenceproviderwrapper.cpp index 1c47170de6c..7e0b96b1d82 100644 --- a/storage/src/tests/persistence/common/persistenceproviderwrapper.cpp +++ b/storage/src/tests/persistence/common/persistenceproviderwrapper.cpp @@ -81,11 +81,11 @@ PersistenceProviderWrapper::listBuckets(BucketSpace bucketSpace) const } void -PersistenceProviderWrapper::createBucketAsync(const spi::Bucket& bucket, spi::Context& context, spi::OperationComplete::UP onComplete) noexcept +PersistenceProviderWrapper::createBucketAsync(const spi::Bucket& bucket, spi::OperationComplete::UP onComplete) noexcept { LOG_SPI("createBucket(" << bucket << ")"); CHECK_ERROR_ASYNC(spi::Result, FAIL_CREATE_BUCKET, onComplete); - return _spi.createBucketAsync(bucket, context, std::move(onComplete)); + return _spi.createBucketAsync(bucket, std::move(onComplete)); } spi::BucketInfoResult @@ -98,47 +98,45 @@ PersistenceProviderWrapper::getBucketInfo(const spi::Bucket& bucket) const void PersistenceProviderWrapper::putAsync(const spi::Bucket& bucket, spi::Timestamp timestamp, document::Document::SP doc, - spi::Context& context, spi::OperationComplete::UP onComplete) + spi::OperationComplete::UP onComplete) { LOG_SPI("put(" << bucket << ", " << timestamp << ", " << doc->getId() << ")"); CHECK_ERROR_ASYNC(spi::Result, FAIL_PUT, onComplete); - _spi.putAsync(bucket, timestamp, std::move(doc), context, std::move(onComplete)); + _spi.putAsync(bucket, timestamp, std::move(doc), std::move(onComplete)); } void PersistenceProviderWrapper::removeAsync(const spi::Bucket& bucket, std::vector ids, - spi::Context& context, spi::OperationComplete::UP onComplete) + spi::OperationComplete::UP onComplete) { for (const TimeStampAndDocumentId & stampedId : ids) { LOG_SPI("remove(" << bucket << ", " << stampedId.first << ", " << stampedId.second << ")"); } CHECK_ERROR_ASYNC(spi::RemoveResult, FAIL_REMOVE, onComplete); - _spi.removeAsync(bucket, std::move(ids), context, std::move(onComplete)); + _spi.removeAsync(bucket, std::move(ids), std::move(onComplete)); } void PersistenceProviderWrapper::removeIfFoundAsync(const spi::Bucket& bucket, spi::Timestamp timestamp, const spi::DocumentId& id, - spi::Context& context, spi::OperationComplete::UP onComplete) + spi::OperationComplete::UP onComplete) { LOG_SPI("removeIfFound(" << bucket << ", " << timestamp << ", " << id << ")"); CHECK_ERROR_ASYNC(spi::RemoveResult, FAIL_REMOVE_IF_FOUND, onComplete); - _spi.removeIfFoundAsync(bucket, timestamp, id, context, std::move(onComplete)); + _spi.removeIfFoundAsync(bucket, timestamp, id, std::move(onComplete)); } void PersistenceProviderWrapper::updateAsync(const spi::Bucket& bucket, spi::Timestamp timestamp, document::DocumentUpdate::SP upd, - spi::Context& context, spi::OperationComplete::UP onComplete) + spi::OperationComplete::UP onComplete) { LOG_SPI("update(" << bucket << ", " << timestamp << ", " << upd->getId() << ")"); CHECK_ERROR_ASYNC(spi::UpdateResult, FAIL_UPDATE, onComplete); - _spi.updateAsync(bucket, timestamp, std::move(upd), context, std::move(onComplete)); + _spi.updateAsync(bucket, timestamp, std::move(upd), std::move(onComplete)); } spi::GetResult -PersistenceProviderWrapper::get(const spi::Bucket& bucket, - const document::FieldSet& fieldSet, - const spi::DocumentId& id, - spi::Context& context) const +PersistenceProviderWrapper::get(const spi::Bucket& bucket, const document::FieldSet& fieldSet, + const spi::DocumentId& id, spi::Context& context) const { LOG_SPI("get(" << bucket << ", " << id << ")"); CHECK_ERROR(spi::GetResult, FAIL_GET); @@ -147,8 +145,7 @@ PersistenceProviderWrapper::get(const spi::Bucket& bucket, spi::CreateIteratorResult PersistenceProviderWrapper::createIterator(const spi::Bucket &bucket, FieldSetSP fields, const spi::Selection &sel, - spi::IncludedVersions versions, - spi::Context &context) + spi::IncludedVersions versions, spi::Context &context) { // TODO: proper printing of FieldSet and Selection @@ -159,53 +156,43 @@ PersistenceProviderWrapper::createIterator(const spi::Bucket &bucket, FieldSetSP } spi::IterateResult -PersistenceProviderWrapper::iterate(spi::IteratorId iterId, - uint64_t maxByteSize, - spi::Context& context) const +PersistenceProviderWrapper::iterate(spi::IteratorId iterId, uint64_t maxByteSize) const { LOG_SPI("iterate(" << uint64_t(iterId) << ", " << maxByteSize << ")"); CHECK_ERROR(spi::IterateResult, FAIL_ITERATE); - return _spi.iterate(iterId, maxByteSize, context); + return _spi.iterate(iterId, maxByteSize); } spi::Result -PersistenceProviderWrapper::destroyIterator(spi::IteratorId iterId, - spi::Context& context) +PersistenceProviderWrapper::destroyIterator(spi::IteratorId iterId) { LOG_SPI("destroyIterator(" << uint64_t(iterId) << ")"); CHECK_ERROR(spi::Result, FAIL_DESTROY_ITERATOR); - return _spi.destroyIterator(iterId, context); + return _spi.destroyIterator(iterId); } void -PersistenceProviderWrapper::deleteBucketAsync(const spi::Bucket& bucket, spi::Context& context, - spi::OperationComplete::UP operationComplete) noexcept +PersistenceProviderWrapper::deleteBucketAsync(const spi::Bucket& bucket, spi::OperationComplete::UP operationComplete) noexcept { LOG_SPI("deleteBucket(" << bucket << ")"); CHECK_ERROR_ASYNC(spi::Result, FAIL_DELETE_BUCKET, operationComplete); - _spi.deleteBucketAsync(bucket, context, std::move(operationComplete)); + _spi.deleteBucketAsync(bucket, std::move(operationComplete)); } spi::Result -PersistenceProviderWrapper::split(const spi::Bucket& source, - const spi::Bucket& target1, - const spi::Bucket& target2, - spi::Context& context) +PersistenceProviderWrapper::split(const spi::Bucket& source, const spi::Bucket& target1, const spi::Bucket& target2) { LOG_SPI("split(" << source << ", " << target1 << ", " << target2 << ")"); CHECK_ERROR(spi::Result, FAIL_SPLIT); - return _spi.split(source, target1, target2, context); + return _spi.split(source, target1, target2); } spi::Result -PersistenceProviderWrapper::join(const spi::Bucket& source1, - const spi::Bucket& source2, - const spi::Bucket& target, - spi::Context& context) +PersistenceProviderWrapper::join(const spi::Bucket& source1, const spi::Bucket& source2, const spi::Bucket& target) { LOG_SPI("join(" << source1 << ", " << source2 << ", " << target << ")"); CHECK_ERROR(spi::Result, FAIL_JOIN); - return _spi.join(source1, source2, target, context); + return _spi.join(source1, source2, target); } std::unique_ptr @@ -221,13 +208,11 @@ PersistenceProviderWrapper::register_executor(std::shared_ptr ids, spi::Context&, spi::OperationComplete::UP) override; - void removeIfFoundAsync(const spi::Bucket&, spi::Timestamp, const spi::DocumentId&, spi::Context&, spi::OperationComplete::UP) override; - void updateAsync(const spi::Bucket&, spi::Timestamp, spi::DocumentUpdateSP, spi::Context&, spi::OperationComplete::UP) override; + void putAsync(const spi::Bucket&, spi::Timestamp, spi::DocumentSP, spi::OperationComplete::UP) override; + void removeAsync(const spi::Bucket&, std::vector ids, spi::OperationComplete::UP) override; + void removeIfFoundAsync(const spi::Bucket&, spi::Timestamp, const spi::DocumentId&, spi::OperationComplete::UP) override; + void updateAsync(const spi::Bucket&, spi::Timestamp, spi::DocumentUpdateSP, spi::OperationComplete::UP) override; spi::GetResult get(const spi::Bucket&, const document::FieldSet&, const spi::DocumentId&, spi::Context&) const override; spi::CreateIteratorResult createIterator(const spi::Bucket &bucket, FieldSetSP, const spi::Selection &, spi::IncludedVersions versions, spi::Context &context) override; - spi::IterateResult iterate(spi::IteratorId, uint64_t maxByteSize, spi::Context&) const override; - spi::Result destroyIterator(spi::IteratorId, spi::Context&) override; - void deleteBucketAsync(const spi::Bucket&, spi::Context&, spi::OperationComplete::UP) noexcept override; - spi::Result split(const spi::Bucket& source, const spi::Bucket& target1, - const spi::Bucket& target2, spi::Context&) override; - spi::Result join(const spi::Bucket& source1, const spi::Bucket& source2, - const spi::Bucket& target, spi::Context&) override; - spi::Result removeEntry(const spi::Bucket&, spi::Timestamp, spi::Context&) override; + spi::IterateResult iterate(spi::IteratorId, uint64_t maxByteSize) const override; + spi::Result destroyIterator(spi::IteratorId) override; + void deleteBucketAsync(const spi::Bucket&, spi::OperationComplete::UP) noexcept override; + spi::Result split(const spi::Bucket& source, const spi::Bucket& target1, const spi::Bucket& target2) override; + spi::Result join(const spi::Bucket& source1, const spi::Bucket& source2, const spi::Bucket& target) override; + spi::Result removeEntry(const spi::Bucket&, spi::Timestamp) override; std::unique_ptr register_resource_usage_listener(spi::IResourceUsageListener& listener) override; std::unique_ptr register_executor(std::shared_ptr) override; }; diff --git a/storage/src/tests/persistence/filestorage/filestormanagertest.cpp b/storage/src/tests/persistence/filestorage/filestormanagertest.cpp index 46310819a59..304720f52b7 100644 --- a/storage/src/tests/persistence/filestorage/filestormanagertest.cpp +++ b/storage/src/tests/persistence/filestorage/filestormanagertest.cpp @@ -100,8 +100,7 @@ struct FileStorTestBase : Test { void TearDown() override; void createBucket(document::BucketId bid) { - spi::Context context(spi::Priority(0), spi::Trace::TraceLevel(0)); - _node->getPersistenceProvider().createBucket(makeSpiBucket(bid), context); + _node->getPersistenceProvider().createBucket(makeSpiBucket(bid)); StorBucketDatabase::WrappedEntry entry( _node->getStorageBucketDatabase().get(bid, "foo", StorBucketDatabase::CREATE_IF_NONEXISTING)); @@ -783,10 +782,7 @@ TEST_F(FileStorManagerTest, priority) { // Create buckets in separate, initial pass to avoid races with puts for (uint32_t i=0; igetId()).getRawId()); - - spi::Context context(spi::Priority(0), spi::Trace::TraceLevel(0)); - - _node->getPersistenceProvider().createBucket(makeSpiBucket(bucket), context); + _node->getPersistenceProvider().createBucket(makeSpiBucket(bucket)); } // Populate bucket with the given data @@ -845,13 +841,12 @@ TEST_F(FileStorManagerTest, split1) { documents.push_back(doc); } document::BucketIdFactory factory; - spi::Context context(spi::Priority(0), spi::Trace::TraceLevel(0)); { // Populate bucket with the given data for (uint32_t i=0; igetId()).getRawId()); - _node->getPersistenceProvider().createBucket(makeSpiBucket(bucket), context); + _node->getPersistenceProvider().createBucket(makeSpiBucket(bucket)); auto cmd = std::make_shared(makeDocumentBucket(bucket), documents[i], 100 + i); cmd->setAddress(_Storage3); @@ -950,7 +945,6 @@ TEST_F(FileStorManagerTest, split_single_group) { auto& top = c.top; setClusterState("storage:2 distributor:1"); - spi::Context context(spi::Priority(0), spi::Trace::TraceLevel(0)); for (uint32_t j=0; j<1; ++j) { // Test this twice, once where all the data ends up in file with // splitbit set, and once where all the data ends up in file with @@ -964,18 +958,16 @@ TEST_F(FileStorManagerTest, split_single_group) { std::string content("Here is some content for all documents"); std::ostringstream uri; - uri << "id:footype:testdoctype1:n=" << (state ? 0x10001 : 0x0100001) - << ":mydoc-" << i; + uri << "id:footype:testdoctype1:n=" << (state ? 0x10001 : 0x0100001) << ":mydoc-" << i; documents.emplace_back(createDocument(content, uri.str())); } document::BucketIdFactory factory; // Populate bucket with the given data for (uint32_t i=0; igetId()).getRawId()); + document::BucketId bucket(16, factory.getBucketId(documents[i]->getId()).getRawId()); - _node->getPersistenceProvider().createBucket(makeSpiBucket(bucket), context); + _node->getPersistenceProvider().createBucket(makeSpiBucket(bucket)); auto cmd = std::make_shared(makeDocumentBucket(bucket), documents[i], 100 + i); cmd->setAddress(_Storage3); @@ -1025,12 +1017,11 @@ FileStorTestBase::putDoc(DummyStorageLink& top, const document::BucketId& target, uint32_t docNum) { - spi::Context context(spi::Priority(0), spi::Trace::TraceLevel(0)); document::BucketIdFactory factory; document::DocumentId docId(vespalib::make_string("id:ns:testdoctype1:n=%" PRIu64 ":%d", target.getId(), docNum)); document::BucketId bucket(16, factory.getBucketId(docId).getRawId()); //std::cerr << "doc bucket is " << bucket << " vs source " << source << "\n"; - _node->getPersistenceProvider().createBucket(makeSpiBucket(target), context); + _node->getPersistenceProvider().createBucket(makeSpiBucket(target)); Document::SP doc(new Document(*_testdoctype1, docId)); auto cmd = std::make_shared(makeDocumentBucket(target), doc, docNum+1); cmd->setAddress(_Storage3); diff --git a/storage/src/tests/persistence/filestorage/operationabortingtest.cpp b/storage/src/tests/persistence/filestorage/operationabortingtest.cpp index 1752de5fb80..ecf4ddde911 100644 --- a/storage/src/tests/persistence/filestorage/operationabortingtest.cpp +++ b/storage/src/tests/persistence/filestorage/operationabortingtest.cpp @@ -49,7 +49,7 @@ public: {} void - putAsync(const spi::Bucket&, spi::Timestamp, document::Document::SP, spi::Context&, spi::OperationComplete::UP onComplete) override + putAsync(const spi::Bucket&, spi::Timestamp, document::Document::SP, spi::OperationComplete::UP onComplete) override { _queueBarrier.await(); // message abort stage with active opertion in disk queue @@ -64,15 +64,15 @@ public: return PersistenceProviderWrapper::getBucketInfo(bucket); } - void createBucketAsync(const spi::Bucket& bucket, spi::Context& ctx, spi::OperationComplete::UP onComplete) noexcept override { + void createBucketAsync(const spi::Bucket& bucket, spi::OperationComplete::UP onComplete) noexcept override { ++_createBucketInvocations; - PersistenceProviderWrapper::createBucketAsync(bucket, ctx, std::move(onComplete)); + PersistenceProviderWrapper::createBucketAsync(bucket, std::move(onComplete)); } void - deleteBucketAsync(const spi::Bucket& bucket, spi::Context& ctx, spi::OperationComplete::UP onComplete) noexcept override { + deleteBucketAsync(const spi::Bucket& bucket, spi::OperationComplete::UP onComplete) noexcept override { ++_deleteBucketInvocations; - PersistenceProviderWrapper::deleteBucketAsync(bucket, ctx, std::move(onComplete)); + PersistenceProviderWrapper::deleteBucketAsync(bucket, std::move(onComplete)); } }; diff --git a/storage/src/tests/persistence/persistencetestutils.cpp b/storage/src/tests/persistence/persistencetestutils.cpp index b0efed07fab..b069ac078ef 100644 --- a/storage/src/tests/persistence/persistencetestutils.cpp +++ b/storage/src/tests/persistence/persistencetestutils.cpp @@ -170,17 +170,13 @@ PersistenceTestUtils::getBucketStatus(const document::BucketId& id) } document::Document::SP -PersistenceTestUtils::doPutOnDisk( - uint32_t location, - spi::Timestamp timestamp, - uint32_t minSize, - uint32_t maxSize) +PersistenceTestUtils::doPutOnDisk(uint32_t location, spi::Timestamp timestamp, uint32_t minSize, uint32_t maxSize) { document::Document::SP doc(createRandomDocumentAtLocation(location, timestamp, minSize, maxSize)); spi::Bucket b(makeSpiBucket(document::BucketId(16, location))); spi::Context context(spi::Priority(0), spi::Trace::TraceLevel(0)); - getPersistenceProvider().createBucket(b, context); - getPersistenceProvider().put(spi::Bucket(b), timestamp, doc, context); + getPersistenceProvider().createBucket(b); + getPersistenceProvider().put(spi::Bucket(b), timestamp, doc); return doc; } @@ -191,12 +187,11 @@ PersistenceTestUtils::doRemoveOnDisk( spi::Timestamp timestamp, bool persistRemove) { - spi::Context context(spi::Priority(0), spi::Trace::TraceLevel(0)); if (persistRemove) { - spi::RemoveResult result = getPersistenceProvider().removeIfFound(makeSpiBucket(bucketId),timestamp, docId, context); + spi::RemoveResult result = getPersistenceProvider().removeIfFound(makeSpiBucket(bucketId),timestamp, docId); return result.wasFound(); } - spi::RemoveResult result = getPersistenceProvider().remove(makeSpiBucket(bucketId), timestamp, docId, context); + spi::RemoveResult result = getPersistenceProvider().remove(makeSpiBucket(bucketId), timestamp, docId); return result.wasFound(); } @@ -207,8 +202,7 @@ PersistenceTestUtils::doUnrevertableRemoveOnDisk( const document::DocumentId& docId, spi::Timestamp timestamp) { - spi::Context context(spi::Priority(0),spi::Trace::TraceLevel(0)); - spi::RemoveResult result = getPersistenceProvider().remove(makeSpiBucket(bucketId), timestamp, docId, context); + spi::RemoveResult result = getPersistenceProvider().remove(makeSpiBucket(bucketId), timestamp, docId); return result.wasFound(); } @@ -250,9 +244,8 @@ void PersistenceTestUtils::doPut(const document::Document::SP& doc, document::BucketId bid, spi::Timestamp time) { spi::Bucket b(makeSpiBucket(bid)); - spi::Context context(spi::Priority(0), spi::Trace::TraceLevel(0)); - getPersistenceProvider().createBucket(b, context); - getPersistenceProvider().put(b, time, std::move(doc), context); + getPersistenceProvider().createBucket(b); + getPersistenceProvider().put(b, time, std::move(doc)); } spi::UpdateResult @@ -261,7 +254,7 @@ PersistenceTestUtils::doUpdate(document::BucketId bid, spi::Timestamp time) { spi::Context context(spi::Priority(0), spi::Trace::TraceLevel(0)); - return getPersistenceProvider().update(makeSpiBucket(bid), time, update, context); + return getPersistenceProvider().update(makeSpiBucket(bid), time, update); } void @@ -273,11 +266,9 @@ PersistenceTestUtils::doRemove(const document::DocumentId& id, spi::Timestamp ti bucket.setUsedBits(usedBits); spi::Context context(spi::Priority(0), spi::Trace::TraceLevel(0)); if (unrevertableRemove) { - getPersistenceProvider().remove( - makeSpiBucket(bucket), time, id, context); + getPersistenceProvider().remove(makeSpiBucket(bucket), time, id); } else { - spi::RemoveResult result = getPersistenceProvider().removeIfFound( - makeSpiBucket(bucket), time, id, context); + spi::RemoveResult result = getPersistenceProvider().removeIfFound(makeSpiBucket(bucket), time, id); if (!result.wasFound()) { throw vespalib::IllegalStateException( "Attempted to remove non-existing doc " + id.toString(), diff --git a/storage/src/tests/persistence/persistencethread_splittest.cpp b/storage/src/tests/persistence/persistencethread_splittest.cpp index 1739f4dff18..97151a8984e 100644 --- a/storage/src/tests/persistence/persistencethread_splittest.cpp +++ b/storage/src/tests/persistence/persistencethread_splittest.cpp @@ -181,11 +181,10 @@ PersistenceThreadSplitTest::doTest(SplitCase splitCase) uint64_t location = 0; uint64_t splitMask = 1ULL << (splitLevelToDivide - 1); - spi::Context context(spi::Priority(0), spi::Trace::TraceLevel(0)); spi::Bucket bucket(makeSpiBucket(document::BucketId(currentSplitLevel, 1))); spi::PersistenceProvider& spi(getPersistenceProvider()); - spi.deleteBucket(bucket, context); - spi.createBucket(bucket, context); + spi.deleteBucket(bucket); + spi.createBucket(bucket); document::TestDocMan testDocMan; for (uint32_t i=0; i testDoc; document::DocumentId testDocId; - spi::Context context; TestAndSetTest() : persistenceHandler(), - asyncHandler(nullptr), - context(0, 0) + asyncHandler(nullptr) {} void SetUp() override { PersistenceTestUtils::SetUp(); createBucket(BUCKET_ID); - getPersistenceProvider().createBucket(makeSpiBucket(BUCKET_ID),context); + getPersistenceProvider().createBucket(makeSpiBucket(BUCKET_ID)); testDoc = createTestDocument(); testDocId = testDoc->getId(); diff --git a/storage/src/vespa/storage/persistence/asynchandler.cpp b/storage/src/vespa/storage/persistence/asynchandler.cpp index a55889652a8..f5d29fb32a7 100644 --- a/storage/src/vespa/storage/persistence/asynchandler.cpp +++ b/storage/src/vespa/storage/persistence/asynchandler.cpp @@ -13,7 +13,6 @@ #include #include #include -#include #include #include @@ -172,7 +171,7 @@ AsyncHandler::handlePut(api::PutCommand& cmd, MessageTracker::UP trackerUP) cons tracker->checkForError(*response); tracker->sendReply(); }); - _spi.putAsync(bucket, spi::Timestamp(cmd.getTimestamp()), std::move(cmd.getDocument()), tracker.context(), + _spi.putAsync(bucket, spi::Timestamp(cmd.getTimestamp()), std::move(cmd.getDocument()), std::make_unique(_sequencedExecutor, cmd.getBucketId(), std::move(task))); return trackerUP; @@ -194,10 +193,10 @@ AsyncHandler::handleCreateBucket(api::CreateBucketCommand& cmd, MessageTracker:: }); if (cmd.getActive()) { - _spi.createBucketAsync(bucket, tracker->context(), std::make_unique()); + _spi.createBucketAsync(bucket, std::make_unique()); _spi.setActiveStateAsync(bucket, spi::BucketInfo::ACTIVE, std::make_unique(_sequencedExecutor, bucket, std::move(task))); } else { - _spi.createBucketAsync(bucket, tracker->context(), std::make_unique(_sequencedExecutor, bucket, std::move(task))); + _spi.createBucketAsync(bucket, std::make_unique(_sequencedExecutor, bucket, std::move(task))); } return tracker; @@ -240,7 +239,7 @@ AsyncHandler::handleDeleteBucket(api::DeleteBucketCommand& cmd, MessageTracker:: } tracker->sendReply(); }); - _spi.deleteBucketAsync(bucket, tracker->context(), std::make_unique(_sequencedExecutor, cmd.getBucketId(), std::move(task))); + _spi.deleteBucketAsync(bucket, std::make_unique(_sequencedExecutor, cmd.getBucketId(), std::move(task))); return tracker; } @@ -301,7 +300,7 @@ AsyncHandler::handleUpdate(api::UpdateCommand& cmd, MessageTracker::UP trackerUP } tracker->sendReply(); }); - _spi.updateAsync(bucket, spi::Timestamp(cmd.getTimestamp()), std::move(cmd.getUpdate()), tracker.context(), + _spi.updateAsync(bucket, spi::Timestamp(cmd.getTimestamp()), std::move(cmd.getUpdate()), std::make_unique(_sequencedExecutor, cmd.getBucketId(), std::move(task))); return trackerUP; } @@ -332,7 +331,7 @@ AsyncHandler::handleRemove(api::RemoveCommand& cmd, MessageTracker::UP trackerUP } tracker->sendReply(); }); - _spi.removeIfFoundAsync(bucket, spi::Timestamp(cmd.getTimestamp()), cmd.getDocumentId(), tracker.context(), + _spi.removeIfFoundAsync(bucket, spi::Timestamp(cmd.getTimestamp()), cmd.getDocumentId(), std::make_unique(_sequencedExecutor, cmd.getBucketId(), std::move(task))); return trackerUP; } @@ -428,7 +427,7 @@ AsyncHandler::handleRemoveLocation(api::RemoveLocationCommand& cmd, MessageTrack tracker->sendReply(); }); - _spi.removeAsync(bucket, std::move(to_remove), tracker->context(), + _spi.removeAsync(bucket, std::move(to_remove), std::make_unique(_sequencedExecutor, cmd.getBucketId(), std::move(task))); return tracker; diff --git a/storage/src/vespa/storage/persistence/bucketprocessor.cpp b/storage/src/vespa/storage/persistence/bucketprocessor.cpp index 39ad18175e6..e0f9bcebf02 100644 --- a/storage/src/vespa/storage/persistence/bucketprocessor.cpp +++ b/storage/src/vespa/storage/persistence/bucketprocessor.cpp @@ -16,20 +16,16 @@ class IteratorGuard private: spi::PersistenceProvider& _spi; spi::IteratorId _iteratorId; - spi::Context& _context; public: - IteratorGuard(spi::PersistenceProvider& spi, - spi::IteratorId iteratorId, - spi::Context& context) + IteratorGuard(spi::PersistenceProvider& spi, spi::IteratorId iteratorId) : _spi(spi), - _iteratorId(iteratorId), - _context(context) + _iteratorId(iteratorId) { } ~IteratorGuard() { assert(_iteratorId != 0); - _spi.destroyIterator(_iteratorId, _context); + _spi.destroyIterator(_iteratorId); } spi::IteratorId getIteratorId() const { return _iteratorId; } spi::PersistenceProvider& getPersistenceProvider() const { return _spi; } @@ -62,10 +58,10 @@ BucketProcessor::iterateAll(spi::PersistenceProvider& provider, } spi::IteratorId iteratorId(createIterResult.getIteratorId()); - IteratorGuard iteratorGuard(provider, iteratorId, context); + IteratorGuard iteratorGuard(provider, iteratorId); while (true) { - spi::IterateResult result(provider.iterate(iteratorId, UINT64_MAX, context)); + spi::IterateResult result(provider.iterate(iteratorId, UINT64_MAX)); if (result.getErrorCode() != spi::Result::ErrorType::NONE) { vespalib::asciistream ss; ss << "Failed: " << result.getErrorMessage(); diff --git a/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp b/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp index 09bd842c308..cab6c26f2a0 100644 --- a/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp +++ b/storage/src/vespa/storage/persistence/filestorage/filestormanager.cpp @@ -743,7 +743,7 @@ FileStorManager::onInternal(const shared_ptr& msg) { spi::Context context(msg->getPriority(), msg->getTrace().getLevel()); shared_ptr cmd(std::static_pointer_cast(msg)); - _provider->destroyIterator(cmd->getIteratorId(), context); + _provider->destroyIterator(cmd->getIteratorId()); msg->getTrace().addChild(context.steal_trace()); return true; } diff --git a/storage/src/vespa/storage/persistence/mergehandler.cpp b/storage/src/vespa/storage/persistence/mergehandler.cpp index 73361c7e8d6..012d5c2619d 100644 --- a/storage/src/vespa/storage/persistence/mergehandler.cpp +++ b/storage/src/vespa/storage/persistence/mergehandler.cpp @@ -57,18 +57,14 @@ constexpr int getDeleteFlag() { class IteratorGuard { spi::PersistenceProvider& _spi; spi::IteratorId _iteratorId; - spi::Context& _context; public: - IteratorGuard(spi::PersistenceProvider& spi, - spi::IteratorId iteratorId, - spi::Context& context) + IteratorGuard(spi::PersistenceProvider& spi, spi::IteratorId iteratorId) : _spi(spi), - _iteratorId(iteratorId), - _context(context) + _iteratorId(iteratorId) {} ~IteratorGuard() { assert(_iteratorId != 0); - _spi.destroyIterator(_iteratorId, _context); + _spi.destroyIterator(_iteratorId); } }; @@ -152,10 +148,10 @@ MergeHandler::populateMetaData(const spi::Bucket& bucket, Timestamp maxTimestamp throw std::runtime_error(ss.str()); } spi::IteratorId iteratorId(createIterResult.getIteratorId()); - IteratorGuard iteratorGuard(_spi, iteratorId, context); + IteratorGuard iteratorGuard(_spi, iteratorId); while (true) { - spi::IterateResult result(_spi.iterate(iteratorId, UINT64_MAX, context)); + spi::IterateResult result(_spi.iterate(iteratorId, UINT64_MAX)); if (result.getErrorCode() != spi::Result::ErrorType::NONE) { std::ostringstream ss; ss << "Failed to iterate for " @@ -393,7 +389,7 @@ MergeHandler::fetchLocalData( throw std::runtime_error(ss.str()); } spi::IteratorId iteratorId(createIterResult.getIteratorId()); - IteratorGuard iteratorGuard(_spi, iteratorId, context); + IteratorGuard iteratorGuard(_spi, iteratorId); // Fetch all entries DocEntryList entries; @@ -401,7 +397,7 @@ MergeHandler::fetchLocalData( bool fetchedAllLocalData = false; bool chunkLimitReached = false; while (true) { - spi::IterateResult result(_spi.iterate(iteratorId, remainingSize, context)); + spi::IterateResult result(_spi.iterate(iteratorId, remainingSize)); if (result.getErrorCode() != spi::Result::ErrorType::NONE) { std::ostringstream ss; ss << "Failed to iterate for " @@ -512,7 +508,6 @@ void MergeHandler::applyDiffEntry(std::shared_ptr async_results, const spi::Bucket& bucket, const api::ApplyBucketDiffCommand::Entry& e, - spi::Context& context, const document::DocumentTypeRepo& repo) const { auto throttle_token = throttle_merge_feed_ops() ? _env._fileStorHandler.operation_throttler().blocking_acquire_one() @@ -525,14 +520,14 @@ MergeHandler::applyDiffEntry(std::shared_ptr async_results auto complete = std::make_unique(std::move(async_results), std::move(docId), std::move(throttle_token), "put", _clock, _env._metrics.merge_handler_metrics.put_latency); - _spi.putAsync(bucket, timestamp, std::move(doc), context, std::move(complete)); + _spi.putAsync(bucket, timestamp, std::move(doc), std::move(complete)); } else { std::vector ids; ids.emplace_back(timestamp, e._docName); auto complete = std::make_unique(std::move(async_results), ids[0].second, std::move(throttle_token), "remove", _clock, _env._metrics.merge_handler_metrics.remove_latency); - _spi.removeAsync(bucket, std::move(ids), context, std::move(complete)); + _spi.removeAsync(bucket, std::move(ids), std::move(complete)); } } @@ -594,7 +589,7 @@ MergeHandler::applyDiffLocally( ++i; LOG(spam, "ApplyBucketDiff(%s): Adding slot %s", bucket.toString().c_str(), e.toString().c_str()); - applyDiffEntry(async_results, bucket, e, context, repo); + applyDiffEntry(async_results, bucket, e, repo); } else { assert(spi::Timestamp(e._entry._timestamp) == existing.getTimestamp()); // Diffing for existing timestamp; should either both be put @@ -607,7 +602,7 @@ MergeHandler::applyDiffLocally( "timestamp in %s. Diff slot: %s. Existing slot: %s", bucket.toString().c_str(), e.toString().c_str(), existing.toString().c_str()); - applyDiffEntry(async_results, bucket, e, context, repo); + applyDiffEntry(async_results, bucket, e, repo); } else { // Duplicate put, just ignore it. LOG(debug, "During diff apply, attempting to add slot " @@ -639,7 +634,7 @@ MergeHandler::applyDiffLocally( LOG(spam, "ApplyBucketDiff(%s): Adding slot %s", bucket.toString().c_str(), e.toString().c_str()); - applyDiffEntry(async_results, bucket, e, context, repo); + applyDiffEntry(async_results, bucket, e, repo); byteCount += e._headerBlob.size() + e._bodyBlob.size(); } if (byteCount + notNeededByteCount != 0) { diff --git a/storage/src/vespa/storage/persistence/mergehandler.h b/storage/src/vespa/storage/persistence/mergehandler.h index 3f631acbef5..b579677ac24 100644 --- a/storage/src/vespa/storage/persistence/mergehandler.h +++ b/storage/src/vespa/storage/persistence/mergehandler.h @@ -116,7 +116,6 @@ private: void applyDiffEntry(std::shared_ptr async_results, const spi::Bucket&, const api::ApplyBucketDiffCommand::Entry&, - spi::Context& context, const document::DocumentTypeRepo& repo) const; /** diff --git a/storage/src/vespa/storage/persistence/provider_error_wrapper.cpp b/storage/src/vespa/storage/persistence/provider_error_wrapper.cpp index 6d15cc06cdf..1be9679c641 100644 --- a/storage/src/vespa/storage/persistence/provider_error_wrapper.cpp +++ b/storage/src/vespa/storage/persistence/provider_error_wrapper.cpp @@ -88,29 +88,29 @@ ProviderErrorWrapper::createIterator(const spi::Bucket &bucket, FieldSetSP field } spi::IterateResult -ProviderErrorWrapper::iterate(spi::IteratorId iteratorId, uint64_t maxByteSize, spi::Context& context) const +ProviderErrorWrapper::iterate(spi::IteratorId iteratorId, uint64_t maxByteSize) const { - return checkResult(_impl.iterate(iteratorId, maxByteSize, context)); + return checkResult(_impl.iterate(iteratorId, maxByteSize)); } spi::Result -ProviderErrorWrapper::destroyIterator(spi::IteratorId iteratorId, spi::Context& context) +ProviderErrorWrapper::destroyIterator(spi::IteratorId iteratorId) { - return checkResult(_impl.destroyIterator(iteratorId, context)); + return checkResult(_impl.destroyIterator(iteratorId)); } void -ProviderErrorWrapper::deleteBucketAsync(const spi::Bucket& bucket, spi::Context& context, spi::OperationComplete::UP onComplete) noexcept +ProviderErrorWrapper::deleteBucketAsync(const spi::Bucket& bucket, spi::OperationComplete::UP onComplete) noexcept { onComplete->addResultHandler(this); - _impl.deleteBucketAsync(bucket, context, std::move(onComplete)); + _impl.deleteBucketAsync(bucket, std::move(onComplete)); } void -ProviderErrorWrapper::createBucketAsync(const spi::Bucket& bucket, spi::Context& context, spi::OperationComplete::UP onComplete) noexcept +ProviderErrorWrapper::createBucketAsync(const spi::Bucket& bucket, spi::OperationComplete::UP onComplete) noexcept { onComplete->addResultHandler(this); - _impl.createBucketAsync(bucket, context, std::move(onComplete)); + _impl.createBucketAsync(bucket, std::move(onComplete)); } spi::BucketIdListResult @@ -120,17 +120,15 @@ ProviderErrorWrapper::getModifiedBuckets(BucketSpace bucketSpace) const } spi::Result -ProviderErrorWrapper::split(const spi::Bucket& source, const spi::Bucket& target1, - const spi::Bucket& target2, spi::Context& context) +ProviderErrorWrapper::split(const spi::Bucket& source, const spi::Bucket& target1, const spi::Bucket& target2) { - return checkResult(_impl.split(source, target1, target2, context)); + return checkResult(_impl.split(source, target1, target2)); } spi::Result -ProviderErrorWrapper::join(const spi::Bucket& source1, const spi::Bucket& source2, - const spi::Bucket& target, spi::Context& context) +ProviderErrorWrapper::join(const spi::Bucket& source1, const spi::Bucket& source2, const spi::Bucket& target) { - return checkResult(_impl.join(source1, source2, target, context)); + return checkResult(_impl.join(source1, source2, target)); } std::unique_ptr @@ -140,41 +138,41 @@ ProviderErrorWrapper::register_resource_usage_listener(spi::IResourceUsageListen } spi::Result -ProviderErrorWrapper::removeEntry(const spi::Bucket& bucket, spi::Timestamp ts, spi::Context& context) +ProviderErrorWrapper::removeEntry(const spi::Bucket& bucket, spi::Timestamp ts) { - return checkResult(_impl.removeEntry(bucket, ts, context)); + return checkResult(_impl.removeEntry(bucket, ts)); } void ProviderErrorWrapper::putAsync(const spi::Bucket &bucket, spi::Timestamp ts, spi::DocumentSP doc, - spi::Context &context, spi::OperationComplete::UP onComplete) + spi::OperationComplete::UP onComplete) { onComplete->addResultHandler(this); - _impl.putAsync(bucket, ts, std::move(doc), context, std::move(onComplete)); + _impl.putAsync(bucket, ts, std::move(doc), std::move(onComplete)); } void ProviderErrorWrapper::removeAsync(const spi::Bucket &bucket, std::vector ids, - spi::Context & context, spi::OperationComplete::UP onComplete) + spi::OperationComplete::UP onComplete) { onComplete->addResultHandler(this); - _impl.removeAsync(bucket, std::move(ids), context, std::move(onComplete)); + _impl.removeAsync(bucket, std::move(ids), std::move(onComplete)); } void ProviderErrorWrapper::removeIfFoundAsync(const spi::Bucket &bucket, spi::Timestamp ts, const document::DocumentId &docId, - spi::Context & context, spi::OperationComplete::UP onComplete) + spi::OperationComplete::UP onComplete) { onComplete->addResultHandler(this); - _impl.removeIfFoundAsync(bucket, ts, docId, context, std::move(onComplete)); + _impl.removeIfFoundAsync(bucket, ts, docId, std::move(onComplete)); } void ProviderErrorWrapper::updateAsync(const spi::Bucket &bucket, spi::Timestamp ts, spi::DocumentUpdateSP upd, - spi::Context &context, spi::OperationComplete::UP onComplete) + spi::OperationComplete::UP onComplete) { onComplete->addResultHandler(this); - _impl.updateAsync(bucket, ts, std::move(upd), context, std::move(onComplete)); + _impl.updateAsync(bucket, ts, std::move(upd), std::move(onComplete)); } std::unique_ptr diff --git a/storage/src/vespa/storage/persistence/provider_error_wrapper.h b/storage/src/vespa/storage/persistence/provider_error_wrapper.h index 7285c405d5c..7bd406a8758 100644 --- a/storage/src/vespa/storage/persistence/provider_error_wrapper.h +++ b/storage/src/vespa/storage/persistence/provider_error_wrapper.h @@ -47,23 +47,23 @@ public: spi::CreateIteratorResult createIterator(const spi::Bucket &bucket, FieldSetSP, const spi::Selection &, spi::IncludedVersions versions, spi::Context &context) override; - spi::IterateResult iterate(spi::IteratorId, uint64_t maxByteSize, spi::Context&) const override; - spi::Result destroyIterator(spi::IteratorId, spi::Context&) override; + spi::IterateResult iterate(spi::IteratorId, uint64_t maxByteSize) const override; + spi::Result destroyIterator(spi::IteratorId) override; spi::BucketIdListResult getModifiedBuckets(BucketSpace bucketSpace) const override; - spi::Result split(const spi::Bucket& source, const spi::Bucket& target1, const spi::Bucket& target2, spi::Context&) override; - spi::Result join(const spi::Bucket& source1, const spi::Bucket& source2, const spi::Bucket& target, spi::Context&) override; + spi::Result split(const spi::Bucket& source, const spi::Bucket& target1, const spi::Bucket& target2) override; + spi::Result join(const spi::Bucket& source1, const spi::Bucket& source2, const spi::Bucket& target) override; std::unique_ptr register_resource_usage_listener(spi::IResourceUsageListener& listener) override; - spi::Result removeEntry(const spi::Bucket&, spi::Timestamp, spi::Context&) override; + spi::Result removeEntry(const spi::Bucket&, spi::Timestamp) override; void register_error_listener(std::shared_ptr listener); - void putAsync(const spi::Bucket &, spi::Timestamp, spi::DocumentSP, spi::Context &, spi::OperationComplete::UP) override; - void removeAsync(const spi::Bucket&, std::vector, spi::Context&, spi::OperationComplete::UP) override; - void removeIfFoundAsync(const spi::Bucket&, spi::Timestamp, const document::DocumentId&, spi::Context&, spi::OperationComplete::UP) override; - void updateAsync(const spi::Bucket &, spi::Timestamp, spi::DocumentUpdateSP, spi::Context &, spi::OperationComplete::UP) override; + void putAsync(const spi::Bucket &, spi::Timestamp, spi::DocumentSP, spi::OperationComplete::UP) override; + void removeAsync(const spi::Bucket&, std::vector, spi::OperationComplete::UP) override; + void removeIfFoundAsync(const spi::Bucket&, spi::Timestamp, const document::DocumentId&, spi::OperationComplete::UP) override; + void updateAsync(const spi::Bucket &, spi::Timestamp, spi::DocumentUpdateSP, spi::OperationComplete::UP) override; void setActiveStateAsync(const spi::Bucket& b, spi::BucketInfo::ActiveState newState, spi::OperationComplete::UP onComplete) override; - void createBucketAsync(const spi::Bucket&, spi::Context&, spi::OperationComplete::UP) noexcept override; - void deleteBucketAsync(const spi::Bucket&, spi::Context&, spi::OperationComplete::UP) noexcept override; + void createBucketAsync(const spi::Bucket&, spi::OperationComplete::UP) noexcept override; + void deleteBucketAsync(const spi::Bucket&, spi::OperationComplete::UP) noexcept override; std::unique_ptr register_executor(std::shared_ptr executor) override; private: template diff --git a/storage/src/vespa/storage/persistence/simplemessagehandler.cpp b/storage/src/vespa/storage/persistence/simplemessagehandler.cpp index 74813e2e891..e83d460f47a 100644 --- a/storage/src/vespa/storage/persistence/simplemessagehandler.cpp +++ b/storage/src/vespa/storage/persistence/simplemessagehandler.cpp @@ -83,7 +83,7 @@ SimpleMessageHandler::handleRevert(api::RevertCommand& cmd, MessageTracker::UP t spi::Bucket b = spi::Bucket(cmd.getBucket()); const std::vector & tokens = cmd.getRevertTokens(); for (const api::Timestamp & token : tokens) { - spi::Result result = _spi.removeEntry(b, spi::Timestamp(token), tracker->context()); + spi::Result result = _spi.removeEntry(b, spi::Timestamp(token)); } return tracker; } @@ -92,7 +92,7 @@ MessageTracker::UP SimpleMessageHandler::handleGetIter(GetIterCommand& cmd, MessageTracker::UP tracker) const { tracker->setMetric(_env._metrics.visit); - spi::IterateResult result(_spi.iterate(cmd.getIteratorId(), cmd.getMaxByteSize(), tracker->context())); + spi::IterateResult result(_spi.iterate(cmd.getIteratorId(), cmd.getMaxByteSize())); if (tracker->checkForError(result)) { auto reply = std::make_shared(cmd); reply->getEntries() = result.steal_entries(); diff --git a/storage/src/vespa/storage/persistence/splitjoinhandler.cpp b/storage/src/vespa/storage/persistence/splitjoinhandler.cpp index d5b44cc1911..f86a65efd91 100644 --- a/storage/src/vespa/storage/persistence/splitjoinhandler.cpp +++ b/storage/src/vespa/storage/persistence/splitjoinhandler.cpp @@ -68,8 +68,7 @@ SplitJoinHandler::handleSplitBucket(api::SplitBucketCommand& cmd, MessageTracker PersistenceUtil::LockResult lock1(_env.lockAndGetDisk(target1)); PersistenceUtil::LockResult lock2(_env.lockAndGetDisk(target2)); - spi::Result result = _spi.split(spiBucket, spi::Bucket(target1), - spi::Bucket(target2), tracker->context()); + spi::Result result = _spi.split(spiBucket, spi::Bucket(target1), spi::Bucket(target2)); if (result.hasError()) { tracker->fail(PersistenceUtil::convertErrorCode(result), result.getErrorMessage()); return tracker; @@ -124,7 +123,7 @@ SplitJoinHandler::handleSplitBucket(api::SplitBucketCommand& cmd, MessageTracker spi::Bucket createTarget(target.second.bucket); LOG(debug, "Split target %s was empty, but re-creating it since there are remapped operations queued to it", createTarget.toString().c_str()); - _spi.createBucket(createTarget, tracker->context()); + _spi.createBucket(createTarget); } splitReply.getSplitInfo().emplace_back(target.second.bucket.getBucketId(), target.first->getBucketInfo()); @@ -203,11 +202,7 @@ SplitJoinHandler::handleJoinBuckets(api::JoinBucketsCommand& cmd, MessageTracker lock2 = _env.lockAndGetDisk(secondBucket); } - spi::Result result = - _spi.join(spi::Bucket(firstBucket), - spi::Bucket(secondBucket), - spi::Bucket(destBucket), - tracker->context()); + spi::Result result = _spi.join(spi::Bucket(firstBucket), spi::Bucket(secondBucket), spi::Bucket(destBucket)); if (!tracker->checkForError(result)) { return tracker; } diff --git a/vespalib/src/vespa/vespalib/trace/trace.h b/vespalib/src/vespa/vespalib/trace/trace.h index f6645f922b3..0040989c961 100644 --- a/vespalib/src/vespa/vespalib/trace/trace.h +++ b/vespalib/src/vespa/vespalib/trace/trace.h @@ -24,10 +24,10 @@ public: /** * Create an empty Trace with level set to 0 (no tracing) */ - Trace() : Trace(0) {} - explicit Trace(uint32_t level) : _root(), _level(level) { } - Trace & operator = (Trace &&) = default; - Trace(Trace &&) = default; + Trace() noexcept : Trace(0) {} + explicit Trace(uint32_t level) noexcept : _root(), _level(level) { } + Trace & operator = (Trace &&) noexcept = default; + Trace(Trace &&) noexcept = default; Trace(const Trace &); Trace & operator = (const Trace &) = delete; ~Trace() = default; @@ -53,7 +53,7 @@ public: _level = std::min(level, 9u); } - uint32_t getLevel() const { return _level; } + uint32_t getLevel() const noexcept { return _level; } /** * Check if information with the given level should be traced. This method @@ -63,7 +63,7 @@ public: * @param level The trace level to test. * @return True if tracing is enabled for the given level, false otherwise. */ - bool shouldTrace(uint32_t level) const { return level <= _level; } + bool shouldTrace(uint32_t level) const noexcept { return level <= _level; } /** * Add the given note to the trace information if tracing is enabled for @@ -99,7 +99,7 @@ public: bool isEmpty() const { return !_root || _root->isEmpty(); } - uint32_t getNumChildren() const { return _root ? _root->getNumChildren() : 0; } + uint32_t getNumChildren() const noexcept { return _root ? _root->getNumChildren() : 0; } const TraceNode & getChild(uint32_t child) const { return getRoot().getChild(child); } string encode() const; diff --git a/vespalib/src/vespa/vespalib/trace/tracenode.cpp b/vespalib/src/vespa/vespalib/trace/tracenode.cpp index 072d76d8f32..881b9cc3300 100644 --- a/vespalib/src/vespa/vespalib/trace/tracenode.cpp +++ b/vespalib/src/vespa/vespalib/trace/tracenode.cpp @@ -46,7 +46,7 @@ sortChildren(std::vector & children) { } // namespace -TraceNode::TraceNode() +TraceNode::TraceNode() noexcept : _note(""), _children(), _parent(nullptr), @@ -80,7 +80,7 @@ TraceNode::TraceNode(const string ¬e, system_time timestamp) _hasNote(true) { } -TraceNode::TraceNode(system_time timestamp) +TraceNode::TraceNode(system_time timestamp) noexcept : _note(""), _children(), _parent(nullptr), diff --git a/vespalib/src/vespa/vespalib/trace/tracenode.h b/vespalib/src/vespa/vespalib/trace/tracenode.h index 1abf440ea53..4062dc78d3f 100644 --- a/vespalib/src/vespa/vespalib/trace/tracenode.h +++ b/vespalib/src/vespa/vespalib/trace/tracenode.h @@ -34,7 +34,7 @@ public: /** * Create an empty trace tree. */ - TraceNode(); + TraceNode() noexcept; /** * Create a leaf node with the given note and timestamp. @@ -47,11 +47,11 @@ public: * Create a leaf node with no note and a time stamp. * @param timestamp The timestamp to give to node. */ - explicit TraceNode(system_time timestamp); + explicit TraceNode(system_time timestamp) noexcept; TraceNode & operator =(const TraceNode &); TraceNode(TraceNode &&) noexcept; - TraceNode & operator =(TraceNode &&) = default; + TraceNode & operator =(TraceNode &&) noexcept = default; ~TraceNode(); /** -- cgit v1.2.3