aboutsummaryrefslogtreecommitdiffstats
path: root/searchcore/src/tests/proton/bucketdb
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2022-09-09 10:31:56 +0000
committerHenning Baldersheim <balder@yahoo-inc.com>2022-09-09 10:31:56 +0000
commit9f6fb069ec73285b1d60f67c0ee2408f9b3e204b (patch)
tree8d6b394d767156defaeabe233786f91560ee98d0 /searchcore/src/tests/proton/bucketdb
parente9a3c57bfdcece52a9cc7c184799adc42107acc6 (diff)
Track number of active documents in the BucketDB.
Use atomic counter to allow reading the counter without holding the lock. Use relaxed ordering as updates happens while a guard is held.
Diffstat (limited to 'searchcore/src/tests/proton/bucketdb')
-rw-r--r--searchcore/src/tests/proton/bucketdb/bucketdb/bucketdb_test.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/searchcore/src/tests/proton/bucketdb/bucketdb/bucketdb_test.cpp b/searchcore/src/tests/proton/bucketdb/bucketdb/bucketdb_test.cpp
index 8f10f4b8045..c5f396d817a 100644
--- a/searchcore/src/tests/proton/bucketdb/bucketdb/bucketdb_test.cpp
+++ b/searchcore/src/tests/proton/bucketdb/bucketdb/bucketdb_test.cpp
@@ -94,9 +94,12 @@ struct Fixture
void add(const GlobalId &gid, const Timestamp &timestamp, uint32_t docSize, SubDbType subDbType) {
BucketId bucket(bucket_bits, gid.convertToBucketId().getRawId());
_db.add(gid, bucket, timestamp, docSize, subDbType);
+ ASSERT_TRUE(_db.validateIntegrity());
}
const BucketState &add(const Timestamp &timestamp, uint32_t docSize, SubDbType subDbType) {
- return _db.add(GID_1, BUCKET_1, timestamp, docSize, subDbType);
+ const auto & state = _db.add(GID_1, BUCKET_1, timestamp, docSize, subDbType);
+ ASSERT_TRUE(_db.validateIntegrity());
+ return state;
}
const BucketState &add(const Timestamp &timestamp, SubDbType subDbType) {
return add(timestamp, DOCSIZE_1, subDbType);
@@ -104,9 +107,11 @@ struct Fixture
void remove(const GlobalId& gid, const Timestamp &timestamp, uint32_t docSize, SubDbType subDbType) {
BucketId bucket(bucket_bits, gid.convertToBucketId().getRawId());
_db.remove(gid, bucket, timestamp, docSize, subDbType);
+ ASSERT_TRUE(_db.validateIntegrity());
}
BucketState remove(const Timestamp &timestamp, uint32_t docSize, SubDbType subDbType) {
_db.remove(GID_1, BUCKET_1, timestamp, docSize, subDbType);
+ ASSERT_TRUE(_db.validateIntegrity());
return get();
}
BucketState remove(const Timestamp &timestamp, SubDbType subDbType) {
@@ -114,8 +119,10 @@ struct Fixture
}
void remove_batch(const std::vector<RemoveBatchEntry> &removed, SubDbType sub_db_type) {
_db.remove_batch(removed, sub_db_type);
+ ASSERT_TRUE(_db.validateIntegrity());
}
BucketState get(BucketId bucket_id) const {
+ ASSERT_TRUE(_db.validateIntegrity());
return _db.get(bucket_id);
}
BucketState get() const {