From 875aa01ec80e56d85d0bc6028c6f1417f6ab140f Mon Sep 17 00:00:00 2001 From: Dan Lambright Date: Tue, 23 Jun 2015 16:35:03 -0400 Subject: cluster/tier: stop tier migration after graph switch On a graph switch, a new xlator and private structures are created. The tier migration daemon must stop using the old xlator and private structures and begin using the new ones. Otherwise, when RPCs arrive (such as counter queries from glusterd), the new xlator will be consulted but it will not have up to date information. The fix detects a graph switch and exits the daemon in this case. Typical graph switches for the tier case would be turning off performance translators. Change-Id: Ibfbd4720dc82ea179b77c81b8f534abced21e3c8 BUG: 1226005 Signed-off-by: Dan Lambright Reviewed-on: http://review.gluster.org/11372 --- xlators/cluster/dht/src/tier.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'xlators/cluster') 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) { -- cgit