Skip to content

Commit b1d90a3

Browse files
afr: remove unreachable halo threshold override branch
In __afr_handle_ping_event(), the inner check "(up_children - 1) < halo_min_replicas" is always false when the outer guard "up_children > halo_min_replicas" holds, since up_children > min implies up_children - 1 >= min. The "Overriding halo threshold" log message is never emitted. Remove the dead branch and collapse the if/else. Fixes: #4683 Signed-off-by: Thales Antunes de Oliveira Barretto <thales.barretto.git@gmail.com>
1 parent ae1d696 commit b1d90a3

1 file changed

Lines changed: 9 additions & 16 deletions

File tree

xlators/cluster/afr/src/afr-common.c

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5884,22 +5884,15 @@ __afr_handle_ping_event(xlator_t *this, xlator_t *child_xlator, const int idx,
58845884

58855885
if (child_latency_msec > halo_max_latency_msec &&
58865886
priv->child_up[idx] == 1 && up_children > priv->halo_min_replicas) {
5887-
if ((up_children - 1) < priv->halo_min_replicas) {
5888-
gf_log(child_xlator->name, GF_LOG_INFO,
5889-
"Overriding halo threshold, "
5890-
"min replicas: %d",
5891-
priv->halo_min_replicas);
5892-
} else {
5893-
gf_log(child_xlator->name, GF_LOG_INFO,
5894-
"Child latency (%" PRId64
5895-
" ms) "
5896-
"exceeds halo threshold (%" PRId64
5897-
"), "
5898-
"marking child down.",
5899-
child_latency_msec, halo_max_latency_msec);
5900-
if (priv->halo_child_up[idx]) {
5901-
*event = GF_EVENT_CHILD_DOWN;
5902-
}
5887+
gf_log(child_xlator->name, GF_LOG_INFO,
5888+
"Child latency (%" PRId64
5889+
" ms) "
5890+
"exceeds halo threshold (%" PRId64
5891+
"), "
5892+
"marking child down.",
5893+
child_latency_msec, halo_max_latency_msec);
5894+
if (priv->halo_child_up[idx]) {
5895+
*event = GF_EVENT_CHILD_DOWN;
59035896
}
59045897
} else if (child_latency_msec < halo_max_latency_msec &&
59055898
priv->child_up[idx] == 0) {

0 commit comments

Comments
 (0)