Skip to content

Commit

Permalink
purge repl dev when destroy pg
Browse files Browse the repository at this point in the history
corresponding to eBay/HomeStore#643
  • Loading branch information
yawzhang committed Feb 11, 2025
1 parent 17416c1 commit 352153f
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

class HomeObjectConan(ConanFile):
name = "homeobject"
version = "2.2.3"
version = "2.2.4"

homepage = "https://github.com/eBay/HomeObject"
description = "Blob Store built on HomeReplication"
Expand Down
7 changes: 7 additions & 0 deletions src/lib/homestore_backend/hs_homeobject.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,13 @@ class HSHomeObject : public HomeObjectImpl {
*/
void mark_pg_destroyed(pg_id_t pg_id);

/**
* @brief Cleans up resources on repl dev associated with the PG identified by pg_id.
*
* @param pg_id The ID of the PG to be
*/
void purge_repl_dev(pg_id_t pg_id);

/**
* @brief Cleans up and recycles resources for shards in the PG located using a PG ID.
*
Expand Down
19 changes: 19 additions & 0 deletions src/lib/homestore_backend/hs_pg_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ std::optional< pg_id_t > HSHomeObject::get_pg_id_with_group_id(homestore::group_

void HSHomeObject::pg_destroy(pg_id_t pg_id) {
mark_pg_destroyed(pg_id);
purge_repl_dev(pg_id);
destroy_shards(pg_id);
chunk_selector_->reset_pg_chunks(pg_id);
destroy_pg_index_table(pg_id);
Expand All @@ -340,6 +341,24 @@ void HSHomeObject::mark_pg_destroyed(pg_id_t pg_id) {
hs_pg->pg_sb_.write();
}

void HSHomeObject::purge_repl_dev(pg_id_t pg_id) {
auto lg = std::scoped_lock(_pg_lock);
auto iter = _pg_map.find(pg_id);
if (iter == _pg_map.end()) {
LOGW("destroy repl dev with unknown pg_id {}", pg_id);
return;
}

auto& pg = iter->second;
auto group_id = pg->pg_info_.replica_set_uuid;
auto v = hs_repl_service().get_repl_dev(group_id);
if (v.hasError()) {
LOGW("get repl dev for group_id={} has failed", boost::uuids::to_string(group_id));
return;
}
v.value()->purge();
}

void HSHomeObject::destroy_pg_index_table(pg_id_t pg_id) {
auto lg = std::scoped_lock(_pg_lock);
auto iter = _pg_map.find(pg_id);
Expand Down

0 comments on commit 352153f

Please sign in to comment.