diff options
author | Dan Lambright <dlambrig@redhat.com> | 2015-04-13 02:42:12 +0100 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2015-05-09 08:35:14 -0700 |
commit | 99b778cbe179104af602b6eedebd31695bec16ae (patch) | |
tree | 5352721732f773b117b4a1c771577cedfaf329f4 /xlators/cluster | |
parent | 5fd6b3b7e2881d21a1b19fb22366e905314d71bc (diff) |
glusterd: support for tier volumes 'detach start' and 'detach commit'
Back port of http://review.gluster.org/10108
These commands work in a manner analagous to rebalancing when removing a
brick. The existing migration daemon detects "detach start" and switches
to moving data off the hot tier. While in this state all lookups are
directed to the cold tier.
gluster v detach-tier <vol> start
gluster v detach-tier <vol> commit
The status and stop cli commands shall be submitted separately.
>Change-Id: I24fda5cc3ba74f5fb8aa9a3234ad51f18b80a8a0
>BUG: 1205540
>Signed-off-by: Dan Lambright <dlambrig@redhat.com>
>Signed-off-by: root <root@localhost.localdomain>
>Signed-off-by: Dan Lambright <dlambrig@redhat.com>
>Reviewed-on: http://review.gluster.org/10108
>Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Change-Id: I212d748d077fb5870ee84b316c653acbafbea3f7
BUG: 1220047
Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
Reviewed-on: http://review.gluster.org/10708
Reviewed-by: Dan Lambright <dlambrig@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/cluster')
-rw-r--r-- | xlators/cluster/dht/src/dht-common.c | 2 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-common.h | 6 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-rebalance.c | 24 | ||||
-rw-r--r-- | xlators/cluster/dht/src/tier.c | 38 |
4 files changed, 62 insertions, 8 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 9b23cb11c06..6c0afdbec90 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -6417,6 +6417,8 @@ dht_notify (xlator_t *this, int event, void *data, ...) goto unlock; if (cmd == GF_DEFRAG_CMD_STATUS) gf_defrag_status_get (defrag, output); + else if (cmd == GF_DEFRAG_CMD_START_DETACH_TIER) + gf_defrag_start_detach_tier(defrag); else if (cmd == GF_DEFRAG_CMD_STOP) gf_defrag_stop (defrag, GF_DEFRAG_STATUS_STOPPED, output); diff --git a/xlators/cluster/dht/src/dht-common.h b/xlators/cluster/dht/src/dht-common.h index 3a1906c0108..9a6ed1a889a 100644 --- a/xlators/cluster/dht/src/dht-common.h +++ b/xlators/cluster/dht/src/dht-common.h @@ -266,6 +266,9 @@ enum gf_defrag_type { GF_DEFRAG_CMD_START_FORCE = 1 + 4, GF_DEFRAG_CMD_START_TIER = 1 + 5, GF_DEFRAG_CMD_STATUS_TIER = 1 + 6, + GF_DEFRAG_CMD_START_DETACH_TIER = 1 + 7, + GF_DEFRAG_CMD_STOP_DETACH_TIER = 1 + 8, + }; typedef enum gf_defrag_type gf_defrag_type; @@ -893,6 +896,9 @@ int gf_defrag_status_get (gf_defrag_info_t *defrag, dict_t *dict); int +gf_defrag_start_detach_tier (gf_defrag_info_t *defrag); + +int gf_defrag_stop (gf_defrag_info_t *defrag, gf_defrag_status_t status, dict_t *output); diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c index 33f6099c6d1..60f7314efe0 100644 --- a/xlators/cluster/dht/src/dht-rebalance.c +++ b/xlators/cluster/dht/src/dht-rebalance.c @@ -2682,6 +2682,22 @@ gf_defrag_start_crawl (void *data) goto out; } methods->migration_other(this, defrag); + if (defrag->cmd == GF_DEFRAG_CMD_START_DETACH_TIER) { + migrate_data = dict_new (); + if (!migrate_data) { + ret = -1; + goto out; + } + ret = dict_set_str (migrate_data, + GF_XATTR_FILE_MIGRATE_KEY, + "force"); + if (ret) + goto out; + + ret = gf_defrag_fix_layout (this, defrag, &loc, + fix_layout, + migrate_data); + } } gf_log ("DHT", GF_LOG_INFO, "crawling file-system completed"); out: @@ -2901,6 +2917,14 @@ out: } int +gf_defrag_start_detach_tier (gf_defrag_info_t *defrag) +{ + defrag->cmd = GF_DEFRAG_CMD_START_DETACH_TIER; + + return 0; +} + +int gf_defrag_stop (gf_defrag_info_t *defrag, gf_defrag_status_t status, dict_t *output) { diff --git a/xlators/cluster/dht/src/tier.c b/xlators/cluster/dht/src/tier.c index 48604374aa7..92d13f4f04b 100644 --- a/xlators/cluster/dht/src/tier.c +++ b/xlators/cluster/dht/src/tier.c @@ -812,6 +812,15 @@ tier_start (xlator_t *this, gf_defrag_info_t *defrag) goto out; } + if (defrag->cmd == GF_DEFRAG_CMD_START_DETACH_TIER) { + ret = 1; + gf_msg (this->name, GF_LOG_ERROR, 0, + DHT_MSG_LOG_TIER_ERROR, + "defrag->defrag_cmd == " + "GF_DEFRAG_CMD_START_DETACH_TIER"); + goto out; + } + tick = (tick + 1) % TIMER_SECS; if ((next_demote != tick) && (next_promote != tick)) continue; @@ -911,15 +920,19 @@ tier_migration_get_dst (xlator_t *this, dht_local_t *local) { dht_conf_t *conf = NULL; int32_t ret = -1; + gf_defrag_info_t *defrag = NULL; GF_VALIDATE_OR_GOTO("tier", this, out); GF_VALIDATE_OR_GOTO(this->name, this->private, out); conf = this->private; - if (!conf) - goto out; - if (conf->subvolumes[0] == local->cached_subvol) + defrag = conf->defrag; + + if (defrag && defrag->cmd == GF_DEFRAG_CMD_START_DETACH_TIER) { + local->rebalance.target_node = conf->subvolumes[0]; + + } else if (conf->subvolumes[0] == local->cached_subvol) local->rebalance.target_node = conf->subvolumes[1]; else @@ -936,16 +949,25 @@ out: xlator_t * tier_search (xlator_t *this, dht_layout_t *layout, const char *name) { - xlator_t *subvol = NULL; - void *value; - int search_first_subvol = 0; + xlator_t *subvol = NULL; + void *value; + int search_first_subvol = 0; + dht_conf_t *conf = NULL; + gf_defrag_info_t *defrag = NULL; GF_VALIDATE_OR_GOTO("tier", this, out); GF_VALIDATE_OR_GOTO(this->name, layout, out); GF_VALIDATE_OR_GOTO(this->name, name, out); + GF_VALIDATE_OR_GOTO(this->name, this->private, out); + + conf = this->private; + + defrag = conf->defrag; + if (defrag && defrag->cmd == GF_DEFRAG_CMD_START_DETACH_TIER) + search_first_subvol = 1; - if (!dict_get_ptr (this->options, "rule", &value) && - !strcmp(layout->list[0].xlator->name, value)) { + else if (!dict_get_ptr (this->options, "rule", &value) && + !strcmp(layout->list[0].xlator->name, value)) { search_first_subvol = 1; } |