Skip to content

Commit

Permalink
Reset PG after failures
Browse files Browse the repository at this point in the history
  • Loading branch information
yuwmao committed Dec 25, 2024
1 parent a64147b commit bc80900
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/lib/homestore_backend/replication_state_machine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,12 +363,12 @@ void ReplicationStateMachine::write_snapshot_obj(std::shared_ptr< homestore::sna

auto pg_data = GetSizePrefixedResyncPGMetaData(data_buf);

// Check if the snapshot context is same as the current snapshot context.
// If not, drop the previous context and re-init a new one
if (m_snp_rcv_handler->get_context_lsn() != context->get_lsn()) {
//Check if pg exists, if yes, clean the stale pg resources, may be due to previous snapshot failure. Let's resync on a pristine base
if (home_object_->pg_exists(pg_data->pg_id())) {
LOGI("pg already exists, clean pg resources before snapshot, pg_id:{} {}", pg_data->pg_id(), log_suffix);
home_object_->pg_destroy(pg_data->pg_id());
LOGI("reset context from lsn:{} to lsn:{}", m_snp_rcv_handler->get_context_lsn(), context->get_lsn());
m_snp_rcv_handler->reset_context(context->get_lsn(), pg_data->pg_id());
// TODO: Reset all data of current PG - let's resync on a pristine base
}

auto ret = m_snp_rcv_handler->process_pg_snapshot_data(*pg_data);
Expand Down

0 comments on commit bc80900

Please sign in to comment.