diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2022-09-09 10:31:56 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2022-09-09 10:31:56 +0000 |
commit | 9f6fb069ec73285b1d60f67c0ee2408f9b3e204b (patch) | |
tree | 8d6b394d767156defaeabe233786f91560ee98d0 /searchcore/src/tests/proton/bucketdb | |
parent | e9a3c57bfdcece52a9cc7c184799adc42107acc6 (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.cpp | 9 |
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 ×tamp, 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 ×tamp, 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 ×tamp, SubDbType subDbType) { return add(timestamp, DOCSIZE_1, subDbType); @@ -104,9 +107,11 @@ struct Fixture void remove(const GlobalId& gid, const Timestamp ×tamp, 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 ×tamp, uint32_t docSize, SubDbType subDbType) { _db.remove(GID_1, BUCKET_1, timestamp, docSize, subDbType); + ASSERT_TRUE(_db.validateIntegrity()); return get(); } BucketState remove(const Timestamp ×tamp, 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 { |