aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/tests/proton/documentdb/documentbucketmover/bucketmover_common.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'searchcore/src/tests/proton/documentdb/documentbucketmover/bucketmover_common.cpp')
-rw-r--r--searchcore/src/tests/proton/documentdb/documentbucketmover/bucketmover_common.cpp15
1 files changed, 14 insertions, 1 deletions
diff --git a/searchcore/src/tests/proton/documentdb/documentbucketmover/bucketmover_common.cpp b/searchcore/src/tests/proton/documentdb/documentbucketmover/bucketmover_common.cpp
index ff44d898997..5c4cfb393a4 100644
--- a/searchcore/src/tests/proton/documentdb/documentbucketmover/bucketmover_common.cpp
+++ b/searchcore/src/tests/proton/documentdb/documentbucketmover/bucketmover_common.cpp
@@ -21,7 +21,9 @@ MyBucketModifiedHandler::notifyBucketModified(const BucketId &bucket) {
MyMoveHandler::MyMoveHandler(bucketdb::BucketDBOwner &bucketDb, bool storeMoveDoneContext)
: _bucketDb(bucketDb),
_moves(),
- _numCachedBuckets(),
+ _lids2Fail(),
+ _numFailedMoves(0),
+ _numCachedBuckets(0),
_storeMoveDoneContexts(storeMoveDoneContext),
_moveDoneContexts()
{}
@@ -30,6 +32,10 @@ MyMoveHandler::~MyMoveHandler() = default;
IDocumentMoveHandler::MoveResult
MyMoveHandler::handleMove(MoveOperation &op, IDestructorCallback::SP moveDoneCtx) {
+ if (_lids2Fail.contains(op.getPrevLid())) {
+ _numFailedMoves++;
+ return MoveResult::FAILURE;
+ }
_moves.push_back(op);
if (_bucketDb.takeGuard()->isCachedBucket(op.getBucketId())) {
++_numCachedBuckets;
@@ -71,6 +77,13 @@ MySubDb::insertDocs(const UserDocuments &docs_) {
}
bool
+MySubDb::remove(uint32_t subDbId, uint32_t lid) {
+ if (_subDb.sub_db_id() != subDbId) return false;
+ if (!_metaStore.validLid(lid)) return false;
+ return _metaStore.remove(lid, 0u);
+}
+
+bool
assertEqual(const document::BucketId &bucket, const proton::test::Document &doc,
uint32_t sourceSubDbId, uint32_t targetSubDbId, const MoveOperation &op) {
if (!EXPECT_EQUAL(bucket, op.getBucketId())) return false;