summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht/src/tier.c
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/cluster/dht/src/tier.c')
-rw-r--r--xlators/cluster/dht/src/tier.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/xlators/cluster/dht/src/tier.c b/xlators/cluster/dht/src/tier.c
index c8c6ad94c7e..650414c50d9 100644
--- a/xlators/cluster/dht/src/tier.c
+++ b/xlators/cluster/dht/src/tier.c
@@ -776,6 +776,8 @@ tier_start (xlator_t *this, gf_defrag_info_t *defrag)
pthread_t demote_thread;
gf_boolean_t is_promotion_triggered = _gf_false;
gf_boolean_t is_demotion_triggered = _gf_false;
+ xlator_t *any = NULL;
+ xlator_t *xlator = NULL;
conf = this->private;
@@ -798,6 +800,20 @@ tier_start (xlator_t *this, gf_defrag_info_t *defrag)
while (1) {
+ /*
+ * Check if a graph switch occured. If so, stop migration
+ * thread. It will need to be restarted manually.
+ */
+ any = THIS->ctx->active->first;
+ xlator = xlator_search_by_name(any, this->name);
+
+ if (xlator != this) {
+ gf_msg (this->name, GF_LOG_INFO, 0,
+ DHT_MSG_LOG_TIER_STATUS,
+ "Detected graph switch. Exiting migration daemon.");
+ goto out;
+ }
+
sleep(1);
if (defrag->defrag_status != GF_DEFRAG_STATUS_STARTED) {