diff --git a/src/include/homestore/replication/repl_dev.h b/src/include/homestore/replication/repl_dev.h index 27727c943..cde618396 100644 --- a/src/include/homestore/replication/repl_dev.h +++ b/src/include/homestore/replication/repl_dev.h @@ -101,8 +101,8 @@ class ReplDevListener { public: virtual ~ReplDevListener() = default; - void set_repl_dev(ReplDev* rdev) { m_repl_dev = rdev; } - virtual ReplDev* repl_dev() { return m_repl_dev; } + void set_repl_dev(shared< ReplDev > rdev) { m_repl_dev = rdev; } + virtual shared< ReplDev > repl_dev() { return m_repl_dev; } /// @brief Called when the log entry has been committed in the replica set. /// @@ -170,7 +170,7 @@ class ReplDevListener { virtual void on_replica_stop() = 0; private: - ReplDev* m_repl_dev; + shared< ReplDev > m_repl_dev; }; class ReplDev { diff --git a/src/lib/replication/service/generic_repl_svc.cpp b/src/lib/replication/service/generic_repl_svc.cpp index d169d4ce2..585605d36 100644 --- a/src/lib/replication/service/generic_repl_svc.cpp +++ b/src/lib/replication/service/generic_repl_svc.cpp @@ -89,7 +89,7 @@ AsyncReplResult< shared< ReplDev > > SoloReplService::create_repl_dev(group_id_t auto rdev = std::make_shared< SoloReplDev >(std::move(rd_sb), false /* load_existing */); auto listener = m_repl_app->create_repl_dev_listener(group_id); - listener->set_repl_dev(rdev.get()); + listener->set_repl_dev(rdev); rdev->attach_listener(std::move(listener)); { @@ -114,13 +114,13 @@ void SoloReplService::load_repl_dev(sisl::byte_view const& buf, void* meta_cooki auto rdev = std::make_shared< SoloReplDev >(std::move(rd_sb), true /* load_existing */); auto listener = m_repl_app->create_repl_dev_listener(group_id); - listener->set_repl_dev(rdev.get()); + listener->set_repl_dev(rdev); rdev->attach_listener(std::move(listener)); { std::unique_lock lg(m_rd_map_mtx); auto [_, happened] = m_rd_map.emplace(group_id, rdev); - (void) happened; + (void)happened; HS_DBG_ASSERT(happened, "Unable to put the repl_dev in rd map for group_id={}", group_id); } } diff --git a/src/lib/replication/service/raft_repl_service.cpp b/src/lib/replication/service/raft_repl_service.cpp index 3262ce5b8..a50941846 100644 --- a/src/lib/replication/service/raft_repl_service.cpp +++ b/src/lib/replication/service/raft_repl_service.cpp @@ -140,7 +140,7 @@ shared< nuraft_mesg::mesg_state_mgr > RaftReplService::create_state_mgr(int32_t // Attach the listener to the raft auto listener = m_repl_app->create_repl_dev_listener(group_id); - listener->set_repl_dev(rdev.get()); + listener->set_repl_dev(rdev); rdev->attach_listener(std::move(listener)); // Add the repl dev to the map