summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Wareing <rwareing@fb.com>2014-07-21 12:11:07 -0700
committerKevin Vigor <kvigor@fb.com>2016-12-21 11:19:50 -0800
commit3bb25b0882964b6c9c1623593f3a81902ff69aa0 (patch)
tree81b0fdd07661ba964afe68e89e4cf3c64b1fd3c7
parent9e1e0bf6e025c5fbd463086b47de18652fa3eb2f (diff)
Fix halo-enabled option
Summary: - This option was broken (or shall we say....not fully implemented? :) ), it needs to set the halo-latency to FLT_MAX to gaurentee no bricks will be marked down, and all those presently marked down @ runtime shall be marked back up upon the transition from true to false - Also fixes tests/bugs/fb2518260.t Test Plan: Prove tests (paste coming) Reviewers: cjh, dph, mmckeen Reviewed By: mmckeen Differential Revision: https://phabricator.fb.com/D1435264 Conflicts: xlators/cluster/afr/src/afr-common.c Change-Id: I81209d6f2cc9ea7e562eedf44bf3efbe87e01bf7 Signed-off-by: Kevin Vigor <kvigor@fb.com> Reviewed-on: http://review.gluster.org/16227 CentOS-regression: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Shreyas Siravara <sshreyas@fb.com> Smoke: Gluster Build System <jenkins@build.gluster.org>
-rw-r--r--xlators/cluster/afr/src/afr-common.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
index ed2c6414718..630bee80be3 100644
--- a/xlators/cluster/afr/src/afr-common.c
+++ b/xlators/cluster/afr/src/afr-common.c
@@ -4270,7 +4270,8 @@ _afr_handle_ping_event (xlator_t *this, xlator_t *child_xlator,
if (priv->child_up[i] == 1)
up_children++;
- if (*child_latency_msec > halo_max_latency_msec &&
+ if (priv->halo_enabled &&
+ *child_latency_msec > halo_max_latency_msec &&
priv->child_up[idx] == 1 &&
up_children > priv->halo_min_replicas) {
if ((up_children - 1) <
@@ -4288,13 +4289,14 @@ _afr_handle_ping_event (xlator_t *this, xlator_t *child_xlator,
halo_max_latency_msec);
*event = GF_EVENT_CHILD_DOWN;
}
- } else if (*child_latency_msec < halo_max_latency_msec &&
+ } else if ((priv->halo_enabled == _gf_false ||
+ *child_latency_msec < halo_max_latency_msec) &&
priv->child_up[idx] == 0) {
if (up_children < priv->halo_max_replicas) {
gf_log (child_xlator->name, GF_LOG_INFO,
"Child latency (%ld ms) "
- "below halo threshold (%ld), "
- "marking child up.",
+ "below halo threshold (%ld) or halo is "
+ "disabled, marking child up.",
*child_latency_msec,
halo_max_latency_msec);
*event = GF_EVENT_CHILD_UP;
@@ -4343,7 +4345,8 @@ _afr_handle_child_up_event (xlator_t *this, xlator_t *child_xlator,
* halo_min_replicas even though it's latency exceeds
* halo_max_latency_msec.
*/
- if (up_children > priv->halo_min_replicas) {
+ if (priv->halo_enabled == _gf_true &&
+ up_children > priv->halo_min_replicas) {
worst_up_child = find_worst_up_child (this);
if (worst_up_child >= 0 &&
priv->child_latency[worst_up_child] >
@@ -4360,7 +4363,8 @@ _afr_handle_child_up_event (xlator_t *this, xlator_t *child_xlator,
up_children--;
}
}
- if (up_children > priv->halo_max_replicas &&
+ if (priv->halo_enabled == _gf_true &&
+ up_children > priv->halo_max_replicas &&
!priv->shd.iamshd) {
worst_up_child = find_worst_up_child (this);
if (worst_up_child < 0) {
@@ -4440,7 +4444,8 @@ _afr_handle_child_down_event (xlator_t *this, xlator_t *child_xlator,
* as we want it to be up to date if we are going to
* begin using it synchronously.
*/
- if (up_children < priv->halo_min_replicas) {
+ if (priv->halo_enabled == _gf_true &&
+ up_children < priv->halo_min_replicas) {
best_down_child = find_best_down_child (this);
if (best_down_child >= 0) {
gf_log (this->name, GF_LOG_DEBUG,
@@ -4546,7 +4551,11 @@ afr_notify (xlator_t *this, int32_t event,
had_quorum = priv->quorum_count && afr_has_quorum (priv->child_up,
this);
- halo_max_latency_msec = _afr_get_halo_latency (this);
+ if (!priv->halo_enabled) {
+ halo_max_latency_msec = INT64_MAX;
+ } else {
+ halo_max_latency_msec = _afr_get_halo_latency (this);
+ }
if (event == GF_EVENT_CHILD_PING) {
/* Calculates the child latency and sets event