|
|
7f4c2a |
From c12fb1731b7990f951d360bafe9eca49c27f5dcb Mon Sep 17 00:00:00 2001
|
|
|
7f4c2a |
From: Dan Lambright <dlambrig@redhat.com>
|
|
|
7f4c2a |
Date: Tue, 2 Jun 2015 18:48:19 -0400
|
|
|
7f4c2a |
Subject: [PATCH 55/57] cluster/tier: make attach/detach work with new rebalance logic
|
|
|
7f4c2a |
|
|
|
7f4c2a |
This is a backport of 10795
|
|
|
7f4c2a |
|
|
|
7f4c2a |
The new rebalance performance improvements added new
|
|
|
7f4c2a |
datastructures which were not initialized in the
|
|
|
7f4c2a |
tier case. Function dht_find_local_subvol_cbk() needs
|
|
|
7f4c2a |
to accept a list built by lower level DHT translators
|
|
|
7f4c2a |
in order to build the local subvolumes list.
|
|
|
7f4c2a |
|
|
|
7f4c2a |
> Change-Id: Iab03fc8e7fadc22debc08cd5bc781b9e3e270497
|
|
|
7f4c2a |
> BUG: 1222088
|
|
|
7f4c2a |
> Signed-off-by: Dan Lambright <dlambrig@redhat.com>
|
|
|
7f4c2a |
> Reviewed-on: http://review.gluster.org/10795
|
|
|
7f4c2a |
> Tested-by: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
7f4c2a |
> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
|
|
|
7f4c2a |
|
|
|
7f4c2a |
Change-Id: Id1fde62dce51bb91358214721b3c04ad2224c439
|
|
|
7f4c2a |
Signed-off-by: Dan Lambright <dlambrig@redhat.com>
|
|
|
7f4c2a |
Reviewed-on: https://code.engineering.redhat.com/gerrit/49749
|
|
|
7f4c2a |
Tested-by: Joseph Fernandes <josferna@redhat.com>
|
|
|
7f4c2a |
Reviewed-by: Joseph Fernandes <josferna@redhat.com>
|
|
|
7f4c2a |
Reviewed-by: Shyam Ranganathan <srangana@redhat.com>
|
|
|
7f4c2a |
---
|
|
|
7f4c2a |
xlators/cluster/dht/src/dht-common.c | 42 +++++++++++++++++++-----------
|
|
|
7f4c2a |
xlators/cluster/dht/src/dht-rebalance.c | 9 +-----
|
|
|
7f4c2a |
2 files changed, 28 insertions(+), 23 deletions(-)
|
|
|
7f4c2a |
|
|
|
7f4c2a |
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
|
|
|
7f4c2a |
index 8870a30..868cd79 100644
|
|
|
7f4c2a |
--- a/xlators/cluster/dht/src/dht-common.c
|
|
|
7f4c2a |
+++ b/xlators/cluster/dht/src/dht-common.c
|
|
|
7f4c2a |
@@ -2627,6 +2627,9 @@ dht_find_local_subvol_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
7f4c2a |
int this_call_cnt = 0;
|
|
|
7f4c2a |
int ret = 0;
|
|
|
7f4c2a |
char *uuid_str = NULL;
|
|
|
7f4c2a |
+ char *uuid_list = NULL;
|
|
|
7f4c2a |
+ char *next_uuid_str = NULL;
|
|
|
7f4c2a |
+ char *saveptr = NULL;
|
|
|
7f4c2a |
uuid_t node_uuid = {0,};
|
|
|
7f4c2a |
|
|
|
7f4c2a |
|
|
|
7f4c2a |
@@ -2649,7 +2652,7 @@ dht_find_local_subvol_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
7f4c2a |
goto unlock;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
- ret = dict_get_str (xattr, local->xsel, &uuid_str);
|
|
|
7f4c2a |
+ ret = dict_get_str (xattr, local->xsel, &uuid_list);
|
|
|
7f4c2a |
|
|
|
7f4c2a |
if (ret < 0) {
|
|
|
7f4c2a |
gf_log (this->name, GF_LOG_ERROR, "Failed to "
|
|
|
7f4c2a |
@@ -2659,22 +2662,29 @@ dht_find_local_subvol_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
|
|
|
7f4c2a |
goto unlock;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
- if (gf_uuid_parse (uuid_str, node_uuid)) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_ERROR, "Failed to parse uuid"
|
|
|
7f4c2a |
- " failed for %s", prev->this->name);
|
|
|
7f4c2a |
- local->op_ret = -1;
|
|
|
7f4c2a |
- local->op_errno = EINVAL;
|
|
|
7f4c2a |
- goto unlock;
|
|
|
7f4c2a |
- }
|
|
|
7f4c2a |
+ for (uuid_str = strtok_r (uuid_list, " ", &saveptr);
|
|
|
7f4c2a |
+ uuid_str;
|
|
|
7f4c2a |
+ uuid_str = next_uuid_str) {
|
|
|
7f4c2a |
|
|
|
7f4c2a |
- if (gf_uuid_compare (node_uuid, conf->defrag->node_uuid)) {
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_DEBUG, "subvol %s does not"
|
|
|
7f4c2a |
- "belong to this node", prev->this->name);
|
|
|
7f4c2a |
- } else {
|
|
|
7f4c2a |
- conf->local_subvols[(conf->local_subvols_cnt)++]
|
|
|
7f4c2a |
- = prev->this;
|
|
|
7f4c2a |
- gf_log (this->name, GF_LOG_DEBUG, "subvol %s belongs to"
|
|
|
7f4c2a |
- " this node", prev->this->name);
|
|
|
7f4c2a |
+ next_uuid_str = strtok_r (NULL, " ", &saveptr);
|
|
|
7f4c2a |
+ if (gf_uuid_parse (uuid_str, node_uuid)) {
|
|
|
7f4c2a |
+ gf_log (this->name, GF_LOG_ERROR, "Failed to parse uuid"
|
|
|
7f4c2a |
+ " failed for %s", prev->this->name);
|
|
|
7f4c2a |
+ local->op_ret = -1;
|
|
|
7f4c2a |
+ local->op_errno = EINVAL;
|
|
|
7f4c2a |
+ goto unlock;
|
|
|
7f4c2a |
+ }
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
+ if (gf_uuid_compare (node_uuid, conf->defrag->node_uuid)) {
|
|
|
7f4c2a |
+ gf_log (this->name, GF_LOG_DEBUG, "subvol %s does not"
|
|
|
7f4c2a |
+ "belong to this node", prev->this->name);
|
|
|
7f4c2a |
+ } else {
|
|
|
7f4c2a |
+ conf->local_subvols[(conf->local_subvols_cnt)++]
|
|
|
7f4c2a |
+ = prev->this;
|
|
|
7f4c2a |
+ gf_log (this->name, GF_LOG_DEBUG, "subvol %s belongs to"
|
|
|
7f4c2a |
+ " this node", prev->this->name);
|
|
|
7f4c2a |
+ break;
|
|
|
7f4c2a |
+ }
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
diff --git a/xlators/cluster/dht/src/dht-rebalance.c b/xlators/cluster/dht/src/dht-rebalance.c
|
|
|
7f4c2a |
index 89cc3a8..38db3a1 100644
|
|
|
7f4c2a |
--- a/xlators/cluster/dht/src/dht-rebalance.c
|
|
|
7f4c2a |
+++ b/xlators/cluster/dht/src/dht-rebalance.c
|
|
|
7f4c2a |
@@ -2691,8 +2691,7 @@ gf_defrag_start_crawl (void *data)
|
|
|
7f4c2a |
goto out;
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
|
|
|
7f4c2a |
- if ((defrag->cmd != GF_DEFRAG_CMD_START_TIER) &&
|
|
|
7f4c2a |
- (defrag->cmd != GF_DEFRAG_CMD_START_LAYOUT_FIX)) {
|
|
|
7f4c2a |
+ if (defrag->cmd != GF_DEFRAG_CMD_START_LAYOUT_FIX) {
|
|
|
7f4c2a |
migrate_data = dict_new ();
|
|
|
7f4c2a |
if (!migrate_data) {
|
|
|
7f4c2a |
defrag->total_failures++;
|
|
|
7f4c2a |
@@ -2789,11 +2788,7 @@ gf_defrag_start_crawl (void *data)
|
|
|
7f4c2a |
}
|
|
|
7f4c2a |
methods->migration_other(this, defrag);
|
|
|
7f4c2a |
if (defrag->cmd == GF_DEFRAG_CMD_START_DETACH_TIER) {
|
|
|
7f4c2a |
- migrate_data = dict_new ();
|
|
|
7f4c2a |
- if (!migrate_data) {
|
|
|
7f4c2a |
- ret = -1;
|
|
|
7f4c2a |
- goto out;
|
|
|
7f4c2a |
- }
|
|
|
7f4c2a |
+
|
|
|
7f4c2a |
ret = dict_set_str (migrate_data,
|
|
|
7f4c2a |
GF_XATTR_FILE_MIGRATE_KEY,
|
|
|
7f4c2a |
"force");
|
|
|
7f4c2a |
--
|
|
|
7f4c2a |
1.7.1
|
|
|
7f4c2a |
|