From 1d1452e070f990cc91fea87408ea4905abde2fb7 Mon Sep 17 00:00:00 2001 From: shishir gowda Date: Thu, 14 Apr 2011 04:21:48 +0000 Subject: DHT: Add xlator-option assert_no_child_down If this is set, when CHILD_DOWN event is received, call exit Signed-off-by: shishir gowda Signed-off-by: Anand Avati BUG: 2536 (gsync service introspection) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2536 --- xlators/cluster/dht/src/dht-common.c | 6 ++++++ xlators/cluster/dht/src/dht-common.h | 1 + xlators/cluster/dht/src/dht.c | 17 +++++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index c89b809b49f..5cf19d017a9 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -5164,6 +5164,12 @@ dht_notify (xlator_t *this, int event, void *data, ...) case GF_EVENT_CHILD_DOWN: subvol = data; + if (conf->assert_no_child_down) { + gf_log (this->name, GF_LOG_WARNING, + "Received CHILD_DOWN. Exiting"); + exit(0); + } + for (i = 0; i < conf->subvolume_cnt; i++) { if (subvol == conf->subvolumes[i]) { cnt = i; diff --git a/xlators/cluster/dht/src/dht-common.h b/xlators/cluster/dht/src/dht-common.h index 9c39d0d63b8..67cc16e4304 100644 --- a/xlators/cluster/dht/src/dht-common.h +++ b/xlators/cluster/dht/src/dht-common.h @@ -165,6 +165,7 @@ struct dht_conf { dht */ gf_boolean_t use_readdirp; char vol_uuid[UUID_SIZE + 1]; + gf_boolean_t assert_no_child_down; }; typedef struct dht_conf dht_conf_t; diff --git a/xlators/cluster/dht/src/dht.c b/xlators/cluster/dht/src/dht.c index c9b77d64428..ad83d8d4f03 100644 --- a/xlators/cluster/dht/src/dht.c +++ b/xlators/cluster/dht/src/dht.c @@ -419,6 +419,19 @@ init (xlator_t *this) } } + conf->assert_no_child_down = 0; + + if (!dict_get_str (this->options, "assert-no-child-down", &temp_str)) { + if (!strncmp (temp_str, "on", strlen (temp_str))) { + conf->assert_no_child_down = 1; + gf_log (this->name, GF_LOG_INFO, + "assert-no-child-down set to on"); + } else { + conf->assert_no_child_down = 0; + gf_log (this->name, GF_LOG_INFO, + "assert-no-child-down set to off"); + } + } ret = dht_init_subvolumes (this, conf); if (ret == -1) { @@ -543,5 +556,9 @@ struct volume_options options[] = { { .key = {"use-readdirp"}, .type = GF_OPTION_TYPE_BOOL }, + { .key = {"assert-no-child-down"}, + .value = {"on", "off"}, + .type = GF_OPTION_TYPE_STR + }, { .key = {NULL} }, }; -- cgit