From b50be21820e7720cbfe542cb2292ed1fe779863a Mon Sep 17 00:00:00 2001 From: Yingchun Lai Date: Mon, 29 Apr 2024 17:02:33 +0800 Subject: [PATCH] 1 --- src/meta/server_state.cpp | 11 +++++------ src/meta/server_state.h | 5 ++--- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/meta/server_state.cpp b/src/meta/server_state.cpp index f8f9b7516e..0ed2b7d756 100644 --- a/src/meta/server_state.cpp +++ b/src/meta/server_state.cpp @@ -2039,18 +2039,17 @@ void server_state::on_partition_node_dead(std::shared_ptr &app, { partition_configuration &pc = app->partitions[pidx]; if (app->is_stateful) { - if (is_primary(pc, node)) + if (is_primary(pc, node)) { downgrade_primary_to_inactive(app, pidx); - else if (is_secondary(pc, node)) { - if (pc.hp_primary) + } else if (is_secondary(pc, node)) { + if (pc.hp_primary) { downgrade_secondary_to_inactive(app, pidx, node); - else if (is_secondary(pc, node)) { + } else { + CHECK(is_secondary(pc, node), "no primary/secondary on this node: {}", node); LOG_INFO("gpid({}): secondary({}) is down, ignored it due to no primary for this " "partition available", pc.pid, node); - } else { - CHECK(false, "no primary/secondary on this node, node node = {}", node); } } } else { diff --git a/src/meta/server_state.h b/src/meta/server_state.h index 173315d61f..c960df9ade 100644 --- a/src/meta/server_state.h +++ b/src/meta/server_state.h @@ -287,9 +287,8 @@ class server_state void downgrade_stateless_nodes(std::shared_ptr &app, int pidx, const host_port &node); - void on_partition_node_dead(std::shared_ptr &app, - int pidx, - const dsn::host_port &node); + void + on_partition_node_dead(std::shared_ptr &app, int pidx, const dsn::host_port &node); void send_proposal(const host_port &target, const configuration_update_request &proposal); void send_proposal(const configuration_proposal_action &action, const partition_configuration &pc,