summaryrefslogtreecommitdiffstats
path: root/memfilepersistence
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@oath.com>2017-10-04 11:37:21 +0000
committerTor Egge <Tor.Egge@oath.com>2017-10-04 14:20:19 +0000
commit3f419f70b9ae6dffbb07c3f042a8482dc413c278 (patch)
tree0bfa00c37d2b0a00a3815536e3dc1f351e27d70b /memfilepersistence
parent80d54b0d844c964b0ce1cf42cce3f0373ef327a4 (diff)
Use document::Bucket in storage::spi::Bucket to add bucket space.
Diffstat (limited to 'memfilepersistence')
-rw-r--r--memfilepersistence/src/tests/spi/basicoperationhandlertest.cpp38
-rw-r--r--memfilepersistence/src/tests/spi/iteratorhandlertest.cpp33
-rw-r--r--memfilepersistence/src/tests/spi/joinoperationhandlertest.cpp32
-rw-r--r--memfilepersistence/src/tests/spi/memfileautorepairtest.cpp9
-rw-r--r--memfilepersistence/src/tests/spi/memfiletestutils.cpp22
-rw-r--r--memfilepersistence/src/tests/spi/splitoperationhandlertest.cpp20
-rw-r--r--memfilepersistence/src/vespa/memfilepersistence/spi/memfilepersistenceprovider.cpp3
7 files changed, 79 insertions, 78 deletions
diff --git a/memfilepersistence/src/tests/spi/basicoperationhandlertest.cpp b/memfilepersistence/src/tests/spi/basicoperationhandlertest.cpp
index 8011255324b..07bff2038e0 100644
--- a/memfilepersistence/src/tests/spi/basicoperationhandlertest.cpp
+++ b/memfilepersistence/src/tests/spi/basicoperationhandlertest.cpp
@@ -5,8 +5,10 @@
#include "options_builder.h"
#include <vespa/document/fieldset/fieldsetrepo.h>
#include <vespa/document/fieldset/fieldsets.h>
+#include <vespa/persistence/spi/test.h>
#include <vespa/vdstestlib/cppunit/macros.h>
+using storage::spi::test::makeBucket;
namespace storage {
namespace memfile {
@@ -142,8 +144,7 @@ BasicOperationHandlerTest::testRemove()
Timestamp(2),
OperationHandler::PERSIST_REMOVE_IF_FOUND));
- getPersistenceProvider().flush(
- spi::Bucket(bucketId, spi::PartitionId(0)), context);
+ getPersistenceProvider().flush(makeBucket(bucketId), context);
env()._cache.clear();
@@ -177,8 +178,7 @@ BasicOperationHandlerTest::doTestRemoveWithNonMatchingTimestamp(
Timestamp(1233),
persistRemove));
- getPersistenceProvider().flush(
- spi::Bucket(bucketId, spi::PartitionId(0)), context);
+ getPersistenceProvider().flush(makeBucket(bucketId), context);
MemFilePtr file(getMemFile(bucketId));
CPPUNIT_ASSERT_EQUAL(
@@ -241,8 +241,7 @@ BasicOperationHandlerTest::testRemoveForExistingRemoveSameTimestamp()
Timestamp(1235),
OperationHandler::PERSIST_REMOVE_IF_FOUND));
- getPersistenceProvider().flush(
- spi::Bucket(bucketId, spi::PartitionId(0)), context);
+ getPersistenceProvider().flush(makeBucket(bucketId), context);
// Should only be one remove entry still
MemFilePtr file(getMemFile(bucketId));
@@ -272,8 +271,7 @@ BasicOperationHandlerTest::doTestRemoveForExistingRemoveNewTimestamp(
Timestamp(1236),
persistRemove));
- getPersistenceProvider().flush(
- spi::Bucket(bucketId, spi::PartitionId(0)), context);
+ getPersistenceProvider().flush(makeBucket(bucketId), context);
MemFilePtr file(getMemFile(bucketId));
CPPUNIT_ASSERT_EQUAL(
@@ -327,16 +325,14 @@ BasicOperationHandlerTest::testRemoveExistingOlderDocumentVersion()
Timestamp(1235),
OperationHandler::ALWAYS_PERSIST_REMOVE));
- getPersistenceProvider().flush(
- spi::Bucket(bucketId, spi::PartitionId(0)), context);
+ getPersistenceProvider().flush(makeBucket(bucketId), context);
CPPUNIT_ASSERT_EQUAL(true, doRemove(bucketId,
doc->getId(),
Timestamp(1234),
OperationHandler::ALWAYS_PERSIST_REMOVE));
- getPersistenceProvider().flush(
- spi::Bucket(bucketId, spi::PartitionId(0)), context);
+ getPersistenceProvider().flush(makeBucket(bucketId), context);
// Should now be two remove entries.
MemFilePtr file(getMemFile(bucketId));
@@ -366,8 +362,7 @@ BasicOperationHandlerTest::doTestRemoveDocumentNotFound(
Timestamp(1235),
persistRemove));
- getPersistenceProvider().flush(
- spi::Bucket(bucketId, spi::PartitionId(0)), context);
+ getPersistenceProvider().flush(makeBucket(bucketId), context);
MemFilePtr file(getMemFile(bucketId));
CPPUNIT_ASSERT_EQUAL(
@@ -581,12 +576,8 @@ BasicOperationHandlerTest::testRemoveEntry()
Document::SP doc = doPut(4, Timestamp(2345));
doPut(4, Timestamp(3456));
- getPersistenceProvider().removeEntry(
- spi::Bucket(bucketId, spi::PartitionId(0)),
- spi::Timestamp(1234), context);
- getPersistenceProvider().removeEntry(
- spi::Bucket(bucketId, spi::PartitionId(0)),
- spi::Timestamp(3456), context);
+ getPersistenceProvider().removeEntry(makeBucket(bucketId), spi::Timestamp(1234), context);
+ getPersistenceProvider().removeEntry(makeBucket(bucketId), spi::Timestamp(3456), context);
flush(bucketId);
memfile::MemFilePtr file(getMemFile(bucketId));
@@ -683,9 +674,7 @@ BasicOperationHandlerTest::testEraseFromCacheOnMaintainException()
std::unique_ptr<Environment::LazyFileFactory>(
new SimulatedFailureLazyFile::Factory);
- spi::Result result = getPersistenceProvider().maintain(
- spi::Bucket(bucketId, spi::PartitionId(0)),
- spi::HIGH);
+ spi::Result result = getPersistenceProvider().maintain(makeBucket(bucketId), spi::HIGH);
CPPUNIT_ASSERT(result.hasError());
CPPUNIT_ASSERT(result.getErrorMessage().find("A simulated I/O write")
!= vespalib::string::npos);
@@ -720,8 +709,7 @@ BasicOperationHandlerTest::testEraseFromCacheOnDeleteBucketException()
std::unique_ptr<Environment::LazyFileFactory>(factory);
// loadFile will fail
- spi::Result result = getPersistenceProvider().deleteBucket(
- spi::Bucket(bucketId, spi::PartitionId(0)), context);
+ spi::Result result = getPersistenceProvider().deleteBucket(makeBucket(bucketId), context);
CPPUNIT_ASSERT(result.hasError());
CPPUNIT_ASSERT(result.getErrorMessage().find("A simulated I/O read")
!= vespalib::string::npos);
diff --git a/memfilepersistence/src/tests/spi/iteratorhandlertest.cpp b/memfilepersistence/src/tests/spi/iteratorhandlertest.cpp
index 622625be864..6deabc3dfe1 100644
--- a/memfilepersistence/src/tests/spi/iteratorhandlertest.cpp
+++ b/memfilepersistence/src/tests/spi/iteratorhandlertest.cpp
@@ -4,8 +4,11 @@
#include <tests/spi/memfiletestutils.h>
#include <tests/spi/simulatedfailurefile.h>
#include <tests/spi/options_builder.h>
+#include <vespa/persistence/spi/test.h>
#include <vespa/document/select/parser.h>
+using storage::spi::test::makeBucket;
+
namespace storage {
namespace memfile {
namespace {
@@ -119,7 +122,7 @@ IteratorHandlerTest::createSelection(const std::string& docSel) const
void
IteratorHandlerTest::testCreateIterator()
{
- spi::Bucket b(BucketId(16, 1234), spi::PartitionId(0));
+ spi::Bucket b(makeBucket(BucketId(16, 1234)));
spi::CreateIteratorResult iter1(create(b, createSelection("true")));
CPPUNIT_ASSERT_EQUAL(spi::IteratorId(1), iter1.getIteratorId());
@@ -287,7 +290,7 @@ IteratorHandlerTest::testSomeSlotsRemovedBetweenInvocations()
{
std::vector<DocAndTimestamp> docs = feedDocs(100, 4096, 4096);
- spi::Bucket b(BucketId(16, 4), spi::PartitionId(0));
+ spi::Bucket b(makeBucket(BucketId(16, 4)));
spi::Selection sel(createSelection("true"));
spi::CreateIteratorResult iter(create(b, sel));
@@ -327,7 +330,7 @@ IteratorHandlerTest::testAllSlotsRemovedBetweenInvocations()
{
std::vector<DocAndTimestamp> docs = feedDocs(100, 4096, 4096);
- spi::Bucket b(BucketId(16, 4), spi::PartitionId(0));
+ spi::Bucket b(makeBucket(BucketId(16, 4)));
spi::Selection sel(createSelection("true"));
spi::CreateIteratorResult iter(create(b, sel));
@@ -359,7 +362,7 @@ IteratorHandlerTest::testAllSlotsRemovedBetweenInvocations()
void
IteratorHandlerTest::testIterateMetadataOnly()
{
- spi::Bucket b(BucketId(16, 4), spi::PartitionId(0));
+ spi::Bucket b(makeBucket(BucketId(16, 4)));
std::vector<DocAndTimestamp> docs = feedDocs(10);
CPPUNIT_ASSERT(
@@ -415,7 +418,7 @@ IteratorHandlerTest::testIterateHeadersOnly()
clearBody(*docs[i].first);
}
- spi::Bucket b(BucketId(16, 4), spi::PartitionId(0));
+ spi::Bucket b(makeBucket(BucketId(16, 4)));
spi::Selection sel(createSelection("true"));
spi::CreateIteratorResult iter(create(b, sel, spi::NEWEST_DOCUMENT_ONLY,
@@ -436,7 +439,7 @@ IteratorHandlerTest::testIterateLargeDocument()
std::vector<DocAndTimestamp> largedoc;
largedoc.push_back(docs.back());
- spi::Bucket b(BucketId(16, 4), spi::PartitionId(0));
+ spi::Bucket b(makeBucket(BucketId(16, 4)));
spi::Selection sel(createSelection("true"));
spi::CreateIteratorResult iter(create(b, sel));
@@ -455,7 +458,7 @@ IteratorHandlerTest::testDocumentsRemovedBetweenInvocations()
int docCount = 100;
std::vector<DocAndTimestamp> docs = feedDocs(docCount);
- spi::Bucket b(BucketId(16, 4), spi::PartitionId(0));
+ spi::Bucket b(makeBucket(BucketId(16, 4)));
spi::Selection sel(createSelection("true"));
spi::CreateIteratorResult iter(create(b, sel));
@@ -497,7 +500,7 @@ IteratorHandlerTest::doTestUnrevertableRemoveBetweenInvocations(bool includeRemo
int docCount = 100;
std::vector<DocAndTimestamp> docs = feedDocs(docCount);
- spi::Bucket b(BucketId(16, 4), spi::PartitionId(0));
+ spi::Bucket b(makeBucket(BucketId(16, 4)));
spi::Selection sel(createSelection("true"));
spi::CreateIteratorResult iter(
create(b, sel,
@@ -591,7 +594,7 @@ IteratorHandlerTest::testMatchTimestampRangeDocAltered()
OperationHandler::PERSIST_REMOVE_IF_FOUND));
flush(bucketId);
- spi::Bucket b(bucketId, spi::PartitionId(0));
+ spi::Bucket b(makeBucket(bucketId));
{
spi::Selection sel(createSelection("true"));
@@ -696,7 +699,7 @@ IteratorHandlerTest::testMatchTimestampRangeDocAltered()
void
IteratorHandlerTest::testIterateAllVersions()
{
- spi::Bucket b(BucketId(16, 4), spi::PartitionId(0));
+ spi::Bucket b(makeBucket(BucketId(16, 4)));
std::vector<DocAndTimestamp> docs;
Document::SP originalDoc(createRandomDocumentAtLocation(
@@ -733,7 +736,7 @@ IteratorHandlerTest::testIterateAllVersions()
void
IteratorHandlerTest::testFieldSetFiltering()
{
- spi::Bucket b(BucketId(16, 4), spi::PartitionId(0));
+ spi::Bucket b(makeBucket(BucketId(16, 4)));
Document::SP doc(createRandomDocumentAtLocation(
4, 1001, 110, 110));
doc->setValue(doc->getField("headerval"), document::IntFieldValue(42));
@@ -760,7 +763,7 @@ IteratorHandlerTest::testFieldSetFiltering()
void
IteratorHandlerTest::testIteratorInactiveOnException()
{
- spi::Bucket b(BucketId(16, 4), spi::PartitionId(0));
+ spi::Bucket b(makeBucket(BucketId(16, 4)));
feedDocs(10);
env()._cache.clear();
@@ -787,7 +790,7 @@ IteratorHandlerTest::testIteratorInactiveOnException()
void
IteratorHandlerTest::testDocsCachedBeforeDocumentSelection()
{
- spi::Bucket b(BucketId(16, 4), spi::PartitionId(0));
+ spi::Bucket b(makeBucket(BucketId(16, 4)));
std::vector<DocAndTimestamp> docs = feedDocs(100, 4096, 4096);
env()._cache.clear();
@@ -816,7 +819,7 @@ IteratorHandlerTest::testDocsCachedBeforeDocumentSelection()
void
IteratorHandlerTest::testTimestampRangeLimitedPrefetch()
{
- spi::Bucket b(BucketId(16, 4), spi::PartitionId(0));
+ spi::Bucket b(makeBucket(BucketId(16, 4)));
// Feed docs with timestamp range [1000, 1100)
feedDocs(100, 4096, 4096);
@@ -904,7 +907,7 @@ IteratorHandlerTest::testCachePrefetchRequirements()
void
IteratorHandlerTest::testBucketEvictedFromCacheOnIterateException()
{
- spi::Bucket b(BucketId(16, 4), spi::PartitionId(0));
+ spi::Bucket b(makeBucket(BucketId(16, 4)));
feedDocs(10);
env()._cache.clear();
diff --git a/memfilepersistence/src/tests/spi/joinoperationhandlertest.cpp b/memfilepersistence/src/tests/spi/joinoperationhandlertest.cpp
index ce11667f75f..07c2bab5bae 100644
--- a/memfilepersistence/src/tests/spi/joinoperationhandlertest.cpp
+++ b/memfilepersistence/src/tests/spi/joinoperationhandlertest.cpp
@@ -2,8 +2,10 @@
#include "memfiletestutils.h"
#include <vespa/document/datatype/documenttype.h>
+#include <vespa/persistence/spi/test.h>
using document::DocumentType;
+using storage::spi::test::makeBucket;
namespace storage {
namespace memfile {
@@ -138,9 +140,9 @@ JoinOperationHandlerTest::doJoin(const document::BucketId to,
spi::Context context(defaultLoadType, spi::Priority(0),
spi::Trace::TraceLevel(0));
return getPersistenceProvider().join(
- spi::Bucket(from1, spi::PartitionId(0)),
- spi::Bucket(from2, spi::PartitionId(0)),
- spi::Bucket(to, spi::PartitionId(0)),
+ makeBucket(from1),
+ makeBucket(from2),
+ makeBucket(to),
context);
}
@@ -250,9 +252,9 @@ JoinOperationHandlerTest::testMultiDisk()
setupDisks(10);
feedMultiDisk();
- getPersistenceProvider().join(spi::Bucket(SOURCE2, spi::PartitionId(7)),
- spi::Bucket(SOURCE1, spi::PartitionId(4)),
- spi::Bucket(TARGET, spi::PartitionId(3)),
+ getPersistenceProvider().join(makeBucket(SOURCE2, spi::PartitionId(7)),
+ makeBucket(SOURCE1, spi::PartitionId(4)),
+ makeBucket(TARGET, spi::PartitionId(3)),
context);
CPPUNIT_ASSERT_EQUAL(
@@ -276,9 +278,9 @@ JoinOperationHandlerTest::testMultiDiskFlushed()
env()._cache.flushDirtyEntries();
env()._cache.clear();
- getPersistenceProvider().join(spi::Bucket(SOURCE2, spi::PartitionId(7)),
- spi::Bucket(SOURCE1, spi::PartitionId(4)),
- spi::Bucket(TARGET, spi::PartitionId(3)),
+ getPersistenceProvider().join(makeBucket(SOURCE2, spi::PartitionId(7)),
+ makeBucket(SOURCE1, spi::PartitionId(4)),
+ makeBucket(TARGET, spi::PartitionId(3)),
context);
CPPUNIT_ASSERT_EQUAL(
@@ -322,9 +324,9 @@ JoinOperationHandlerTest::testInternalJoin()
mon->overrideRealStat(512, 100000, 50000);
CPPUNIT_ASSERT(!mon->isFull(0, .80f));
- getPersistenceProvider().join(spi::Bucket(SOURCE1, spi::PartitionId(4)),
- spi::Bucket(SOURCE1, spi::PartitionId(4)),
- spi::Bucket(SOURCE1, spi::PartitionId(5)),
+ getPersistenceProvider().join(makeBucket(SOURCE1, spi::PartitionId(4)),
+ makeBucket(SOURCE1, spi::PartitionId(4)),
+ makeBucket(SOURCE1, spi::PartitionId(5)),
context);
env()._cache.clear();
@@ -368,9 +370,9 @@ JoinOperationHandlerTest::testInternalJoinDiskFull()
CPPUNIT_ASSERT(mon->isFull(0, .08f));
spi::Result result =
- getPersistenceProvider().join(spi::Bucket(SOURCE1, spi::PartitionId(4)),
- spi::Bucket(SOURCE1, spi::PartitionId(4)),
- spi::Bucket(SOURCE1, spi::PartitionId(5)),
+ getPersistenceProvider().join(makeBucket(SOURCE1, spi::PartitionId(4)),
+ makeBucket(SOURCE1, spi::PartitionId(4)),
+ makeBucket(SOURCE1, spi::PartitionId(5)),
context);
CPPUNIT_ASSERT(result.hasError());
diff --git a/memfilepersistence/src/tests/spi/memfileautorepairtest.cpp b/memfilepersistence/src/tests/spi/memfileautorepairtest.cpp
index 9984452caed..1bae9d929e3 100644
--- a/memfilepersistence/src/tests/spi/memfileautorepairtest.cpp
+++ b/memfilepersistence/src/tests/spi/memfileautorepairtest.cpp
@@ -4,6 +4,9 @@
#include <vespa/memfilepersistence/mapper/memfile_v1_serializer.h>
#include <vespa/memfilepersistence/mapper/memfile_v1_verifier.h>
#include <tests/spi/memfiletestutils.h>
+#include <vespa/persistence/spi/test.h>
+
+using storage::spi::test::makeBucket;
namespace storage {
namespace memfile {
@@ -223,7 +226,7 @@ MemFileAutoRepairTest::testRepairFailureInMaintainEvictsBucketFromCache()
prepareBucket(*this, *_file);
corruptBodyBlock();
spi::Result result(getPersistenceProvider().maintain(
- spi::Bucket(_bucket, spi::PartitionId(0)), spi::HIGH));
+ makeBucket(_bucket), spi::HIGH));
// File being successfully repaired does not constitute a failure of
// the maintain() call.
CPPUNIT_ASSERT_EQUAL(spi::Result::NONE, result.getErrorCode());
@@ -240,7 +243,7 @@ MemFileAutoRepairTest::testZeroLengthFileIsDeleted()
// No way to deal with zero-length files aside from deleting them.
spi::Result result(getPersistenceProvider().maintain(
- spi::Bucket(_bucket, spi::PartitionId(0)), spi::HIGH));
+ makeBucket(_bucket), spi::HIGH));
CPPUNIT_ASSERT_EQUAL(spi::Result::NONE, result.getErrorCode());
CPPUNIT_ASSERT(!env()._cache.contains(_bucket));
CPPUNIT_ASSERT(!vespalib::fileExists(_file->getPath()));
@@ -272,7 +275,7 @@ MemFileAutoRepairTest::assertDocumentIsSilentlyRemoved(
{
// Corrupted (truncated) slot should be transparently removed during
// loadFile and it should be as if it was never there!
- spi::Bucket spiBucket(bucket, spi::PartitionId(0));
+ spi::Bucket spiBucket(makeBucket(bucket));
spi::GetResult res(doGet(spiBucket, docId, document::AllFields()));
CPPUNIT_ASSERT_EQUAL(spi::Result::NONE, res.getErrorCode());
CPPUNIT_ASSERT(!res.hasDocument());
diff --git a/memfilepersistence/src/tests/spi/memfiletestutils.cpp b/memfilepersistence/src/tests/spi/memfiletestutils.cpp
index 28e8987a2fa..f8e182c1bcb 100644
--- a/memfilepersistence/src/tests/spi/memfiletestutils.cpp
+++ b/memfilepersistence/src/tests/spi/memfiletestutils.cpp
@@ -7,11 +7,13 @@
#include <vespa/memfilepersistence/memfile/memfilecache.h>
#include <vespa/storageframework/defaultimplementation/memory/simplememorylogic.h>
#include <vespa/document/update/assignvalueupdate.h>
+#include <vespa/persistence/spi/test.h>
#include <vespa/vespalib/objects/nbostream.h>
#include <vespa/vespalib/util/exceptions.h>
#include <sys/time.h>
using document::DocumentType;
+using storage::spi::test::makeBucket;
namespace storage {
namespace memfile {
@@ -136,7 +138,7 @@ MemFileTestUtils::flush(const document::BucketId& id, uint16_t disk)
spi::Context context(defaultLoadType, spi::Priority(0),
spi::Trace::TraceLevel(0));
return getPersistenceProvider().flush(
- spi::Bucket(id, spi::PartitionId(disk)), context);
+ makeBucket(id, spi::PartitionId(disk)), context);
}
document::Document::SP
@@ -152,7 +154,7 @@ MemFileTestUtils::doPutOnDisk(
document::Document::SP doc(createRandomDocumentAtLocation(
location, timestamp.getTime(), minSize, maxSize));
getPersistenceProvider().put(
- spi::Bucket(document::BucketId(16, location), spi::PartitionId(disk)),
+ makeBucket(document::BucketId(16, location), spi::PartitionId(disk)),
spi::Timestamp(timestamp.getTime()),
doc,
context);
@@ -171,14 +173,14 @@ MemFileTestUtils::doRemoveOnDisk(
spi::Trace::TraceLevel(0));
if (persistRemove == OperationHandler::PERSIST_REMOVE_IF_FOUND) {
spi::RemoveResult result = getPersistenceProvider().removeIfFound(
- spi::Bucket(bucketId, spi::PartitionId(disk)),
+ makeBucket(bucketId, spi::PartitionId(disk)),
spi::Timestamp(timestamp.getTime()),
docId,
context);
return result.wasFound();
}
spi::RemoveResult result = getPersistenceProvider().remove(
- spi::Bucket(bucketId, spi::PartitionId(disk)),
+ makeBucket(bucketId, spi::PartitionId(disk)),
spi::Timestamp(timestamp.getTime()),
docId,
context);
@@ -197,7 +199,7 @@ MemFileTestUtils::doUnrevertableRemoveOnDisk(
spi::Trace::TraceLevel(0));
spi::RemoveResult result =
getPersistenceProvider().remove(
- spi::Bucket(bucketId, spi::PartitionId(disk)),
+ makeBucket(bucketId, spi::PartitionId(disk)),
spi::Timestamp(timestamp.getTime()),
docId, context);
@@ -214,7 +216,7 @@ MemFileTestUtils::doGetOnDisk(
spi::Context context(defaultLoadType, spi::Priority(0),
spi::Trace::TraceLevel(0));
return getPersistenceProvider().get(
- spi::Bucket(bucketId, spi::PartitionId(disk)),
+ makeBucket(bucketId, spi::PartitionId(disk)),
fields, docId, context);
}
@@ -272,7 +274,7 @@ MemFileTestUtils::doPut(const document::Document::SP& doc,
{
spi::Context context(defaultLoadType, spi::Priority(0),
spi::Trace::TraceLevel(0));
- getPersistenceProvider().put(spi::Bucket(bid, spi::PartitionId(disk)),
+ getPersistenceProvider().put(makeBucket(bid, spi::PartitionId(disk)),
spi::Timestamp(time.getTime()), doc, context);
}
@@ -285,7 +287,7 @@ MemFileTestUtils::doUpdate(document::BucketId bid,
spi::Context context(defaultLoadType, spi::Priority(0),
spi::Trace::TraceLevel(0));
return getPersistenceProvider().update(
- spi::Bucket(bid, spi::PartitionId(disk)),
+ makeBucket(bid, spi::PartitionId(disk)),
spi::Timestamp(time.getTime()), update, context);
}
@@ -301,12 +303,12 @@ MemFileTestUtils::doRemove(const document::DocumentId& id, Timestamp time,
if (unrevertableRemove) {
getPersistenceProvider().remove(
- spi::Bucket(bucket, spi::PartitionId(disk)),
+ makeBucket(bucket, spi::PartitionId(disk)),
spi::Timestamp(time.getTime()),
id, context);
} else {
spi::RemoveResult result = getPersistenceProvider().removeIfFound(
- spi::Bucket(bucket, spi::PartitionId(disk)),
+ makeBucket(bucket, spi::PartitionId(disk)),
spi::Timestamp(time.getTime()),
id, context);
diff --git a/memfilepersistence/src/tests/spi/splitoperationhandlertest.cpp b/memfilepersistence/src/tests/spi/splitoperationhandlertest.cpp
index 43094d80928..98f722e749c 100644
--- a/memfilepersistence/src/tests/spi/splitoperationhandlertest.cpp
+++ b/memfilepersistence/src/tests/spi/splitoperationhandlertest.cpp
@@ -2,8 +2,10 @@
#include "memfiletestutils.h"
#include <vespa/document/datatype/documenttype.h>
+#include <vespa/persistence/spi/test.h>
using document::DocumentType;
+using storage::spi::test::makeBucket;
namespace storage {
namespace memfile {
@@ -60,9 +62,9 @@ SplitOperationHandlerTest::testSimple()
SplitOperationHandler handler(env());
spi::Result result = getPersistenceProvider().split(
- spi::Bucket(sourceBucket, spi::PartitionId(0)),
- spi::Bucket(target1, spi::PartitionId(0)),
- spi::Bucket(target2, spi::PartitionId(0)),
+ makeBucket(sourceBucket),
+ makeBucket(target1),
+ makeBucket(target2),
context);
env()._cache.clear();
@@ -116,9 +118,9 @@ SplitOperationHandlerTest::doTestMultiDisk(uint16_t sourceDisk,
SplitOperationHandler handler(env());
spi::Result result = getPersistenceProvider().split(
- spi::Bucket(sourceBucket, spi::PartitionId(sourceDisk)),
- spi::Bucket(target1, spi::PartitionId(targetDisk0)),
- spi::Bucket(target2, spi::PartitionId(targetDisk1)),
+ makeBucket(sourceBucket, spi::PartitionId(sourceDisk)),
+ makeBucket(target1, spi::PartitionId(targetDisk0)),
+ makeBucket(target2, spi::PartitionId(targetDisk1)),
context);
env()._cache.clear();
@@ -183,9 +185,9 @@ SplitOperationHandlerTest::testExceptionDuringSplittingEvictsAllBuckets()
try {
SplitOperationHandler handler(env());
spi::Result result = getPersistenceProvider().split(
- spi::Bucket(sourceBucket, spi::PartitionId(0)),
- spi::Bucket(target1, spi::PartitionId(0)),
- spi::Bucket(target2, spi::PartitionId(0)),
+ makeBucket(sourceBucket),
+ makeBucket(target1),
+ makeBucket(target2),
context);
CPPUNIT_FAIL("Exception not thrown on flush failure");
} catch (std::exception&) {
diff --git a/memfilepersistence/src/vespa/memfilepersistence/spi/memfilepersistenceprovider.cpp b/memfilepersistence/src/vespa/memfilepersistence/spi/memfilepersistenceprovider.cpp
index ab9a329e92a..09d1e46dc27 100644
--- a/memfilepersistence/src/vespa/memfilepersistence/spi/memfilepersistenceprovider.cpp
+++ b/memfilepersistence/src/vespa/memfilepersistence/spi/memfilepersistenceprovider.cpp
@@ -210,7 +210,8 @@ private:
void
MemFilePersistenceProvider::handleBucketCorruption(const FileSpecification& file) const
{
- spi::Bucket fixBucket(file.getBucketId(),
+ spi::Bucket fixBucket(document::Bucket(document::BucketSpace::placeHolder(),
+ file.getBucketId()),
spi::PartitionId(file.getDirectory().getIndex()));
// const_cast is nasty, but maintain() must necessarily be able to