diff options
author | Henning Baldersheim <balder@yahoo-inc.com> | 2021-02-14 17:01:58 +0000 |
---|---|---|
committer | Henning Baldersheim <balder@yahoo-inc.com> | 2021-02-14 17:01:58 +0000 |
commit | 66e66d08e509a4eabf394442bcd7e733e228fb25 (patch) | |
tree | e9aa07ff8e2debfc93c5e430377848779b315cd5 /searchcore/src/tests/proton/documentmetastore | |
parent | 76b1a42ae483ae66a2d1e43ef749f41661754e1c (diff) |
When making callbacks like notifying about new bucket show the gurad that is held.
Then this guard can used instead of possibly making a deadlock if trying to take it yourself.
Diffstat (limited to 'searchcore/src/tests/proton/documentmetastore')
-rw-r--r-- | searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp b/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp index 21b32b40c80..fd18979c6e0 100644 --- a/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp +++ b/searchcore/src/tests/proton/documentmetastore/documentmetastore_test.cpp @@ -92,10 +92,10 @@ struct BoolVector : public std::vector<bool> { using PutRes = DocumentMetaStore::Result; using Result = DocumentMetaStore::Result; -BucketDBOwner::SP +std::shared_ptr<bucketdb::BucketDBOwner> createBucketDB() { - return std::make_shared<BucketDBOwner>(); + return std::make_shared<bucketdb::BucketDBOwner>(); } void @@ -774,7 +774,7 @@ requireThatBasicBucketInfoWorks() BucketId prevBucket = m.begin()->first.first; uint32_t cnt = 0u; uint32_t maxcnt = 0u; - BucketDBOwner::Guard bucketDB = dms.getBucketDB().takeGuard(); + bucketdb::Guard bucketDB = dms.getBucketDB().takeGuard(); for (Map::const_iterator i = m.begin(), ie = m.end(); i != ie; ++i) { if (i->first.first == prevBucket) { cksum.add(i->first.second, i->second, 1, SubDbType::READY); @@ -862,7 +862,7 @@ struct Comparator { }; struct UserDocFixture { - std::shared_ptr<BucketDBOwner> _bucketDB; + std::shared_ptr<bucketdb::BucketDBOwner> _bucketDB; DocumentMetaStore dms; std::vector<GlobalId> gids; BucketId bid1; @@ -1106,19 +1106,15 @@ struct MyBucketCreateListener : public IBucketCreateListener { MyBucketCreateListener(); ~MyBucketCreateListener(); - virtual void notifyCreateBucket(const document::BucketId &bucket) override; + void notifyCreateBucket(const bucketdb::Guard & guard, const document::BucketId &bucket) override; }; -MyBucketCreateListener::MyBucketCreateListener() -{ -} +MyBucketCreateListener::MyBucketCreateListener() = default; -MyBucketCreateListener::~MyBucketCreateListener() -{ -} +MyBucketCreateListener::~MyBucketCreateListener() = default; void -MyBucketCreateListener::notifyCreateBucket(const document::BucketId &bucket) +MyBucketCreateListener::notifyCreateBucket(const bucketdb::Guard &, const document::BucketId &bucket) { _buckets.emplace_back(bucket); } @@ -1647,7 +1643,7 @@ TEST(DocumentMetaStoreTest, overlapping_bucket_active_state_works) } struct RemovedFixture { - std::shared_ptr<BucketDBOwner> _bucketDB; + std::shared_ptr<bucketdb::BucketDBOwner> _bucketDB; DocumentMetaStore dms; bucketdb::BucketDBHandler _bucketDBHandler; @@ -1671,7 +1667,7 @@ RemovedFixture::RemovedFixture() { _bucketDBHandler.addDocumentMetaStore(&dms, 0); } -RemovedFixture::~RemovedFixture() {} +RemovedFixture::~RemovedFixture() = default; TEST(DocumentMetaStoreTest, remove_changed_bucket_works) { |