|
|
cb8e9e |
From 3ca2971df5aeb8f67a39f5fa2866e68a54fdd9ce Mon Sep 17 00:00:00 2001
|
|
|
cb8e9e |
From: Dan Lambright <dlambrig@redhat.com>
|
|
|
cb8e9e |
Date: Thu, 11 Jun 2015 10:50:41 -0400
|
|
|
cb8e9e |
Subject: [PATCH 54/57] cluster/tier: account for reordered layouts
|
|
|
cb8e9e |
|
|
|
cb8e9e |
This is a backport of fix 11092.
|
|
|
cb8e9e |
|
|
|
cb8e9e |
> For a tiered volume the cold subvolume is always at a fixed
|
|
|
cb8e9e |
> position in the graph. DHT's layout array, on the other hand,
|
|
|
cb8e9e |
> may have the cold subvolume in either the first or second
|
|
|
cb8e9e |
> index, therefore code cannot make any assumptions. The fix
|
|
|
cb8e9e |
> searches the layout for the correct position dynamically
|
|
|
cb8e9e |
> rather than statically.
|
|
|
cb8e9e |
|
|
|
cb8e9e |
> The bug manifested itself in NFS, in which a newly attached
|
|
|
cb8e9e |
> subvolume had not received an existing directory. This case
|
|
|
cb8e9e |
> is a "stale entry" and marked as such in the layout for
|
|
|
cb8e9e |
> that directory. The code did not see this, because it
|
|
|
cb8e9e |
> looked at the wrong index in the layout array.
|
|
|
cb8e9e |
|
|
|
cb8e9e |
> The fix also adds the check for decomissioned bricks, and
|
|
|
cb8e9e |
> fixes a problem in detach tier related to starting the
|
|
|
cb8e9e |
> rebalance process: we never received the right defrag
|
|
|
cb8e9e |
> command and it did not get directed to the tier translator.
|
|
|
cb8e9e |
|
|
|
cb8e9e |
> Change-Id: I77cdf9fbb0a777640c98003188565a79be9d0b56
|
|
|
cb8e9e |
> BUG: 1214289
|
|
|
cb8e9e |
> Signed-off-by: Dan Lambright <dlambrig@redhat.com>
|
|
|
cb8e9e |
> Signed-off-by: Dan Lambright <dlambrig@redhat.com>
|
|
|
cb8e9e |
|
|
|
cb8e9e |
Change-Id: I402105623c8fe0af416c4b7e22ed77f1b95d9847
|
|
|
cb8e9e |
BUG: 1228643
|
|
|
cb8e9e |
Signed-off-by: Dan Lambright <dlambrig@redhat.com>
|
|
|
cb8e9e |
Reviewed-on: https://code.engineering.redhat.com/gerrit/50560
|
|
|
cb8e9e |
Tested-by: Joseph Fernandes <josferna@redhat.com>
|
|
|
cb8e9e |
Reviewed-by: Joseph Fernandes <josferna@redhat.com>
|
|
|
cb8e9e |
Reviewed-by: Shyam Ranganathan <srangana@redhat.com>
|
|
|
cb8e9e |
---
|
|
|
cb8e9e |
xlators/cluster/dht/src/dht-common.c | 3 +-
|
|
|
cb8e9e |
xlators/cluster/dht/src/tier.c | 43 ++++++++++++++++-------
|
|
|
cb8e9e |
xlators/mgmt/glusterd/src/glusterd-brick-ops.c | 6 +++-
|
|
|
cb8e9e |
3 files changed, 37 insertions(+), 15 deletions(-)
|
|
|
cb8e9e |
|
|
|
cb8e9e |
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
|
|
|
cb8e9e |
index 6d70f82..8870a30 100644
|
|
|
cb8e9e |
--- a/xlators/cluster/dht/src/dht-common.c
|
|
|
cb8e9e |
+++ b/xlators/cluster/dht/src/dht-common.c
|
|
|
cb8e9e |
@@ -7089,7 +7089,8 @@ int32_t dht_migration_needed(xlator_t *this)
|
|
|
cb8e9e |
|
|
|
cb8e9e |
defrag = conf->defrag;
|
|
|
cb8e9e |
|
|
|
cb8e9e |
- if (defrag->cmd != GF_DEFRAG_CMD_START_TIER)
|
|
|
cb8e9e |
+ if ((defrag->cmd != GF_DEFRAG_CMD_START_TIER) &&
|
|
|
cb8e9e |
+ (defrag->cmd != GF_DEFRAG_CMD_START_DETACH_TIER))
|
|
|
cb8e9e |
ret = 1;
|
|
|
cb8e9e |
|
|
|
cb8e9e |
out:
|
|
|
cb8e9e |
diff --git a/xlators/cluster/dht/src/tier.c b/xlators/cluster/dht/src/tier.c
|
|
|
cb8e9e |
index 0a9c073..cef4f5c 100644
|
|
|
cb8e9e |
--- a/xlators/cluster/dht/src/tier.c
|
|
|
cb8e9e |
+++ b/xlators/cluster/dht/src/tier.c
|
|
|
cb8e9e |
@@ -916,7 +916,8 @@ tier_migration_needed (xlator_t *this)
|
|
|
cb8e9e |
|
|
|
cb8e9e |
defrag = conf->defrag;
|
|
|
cb8e9e |
|
|
|
cb8e9e |
- if (defrag->cmd == GF_DEFRAG_CMD_START_TIER)
|
|
|
cb8e9e |
+ if ((defrag->cmd == GF_DEFRAG_CMD_START_TIER) ||
|
|
|
cb8e9e |
+ (defrag->cmd == GF_DEFRAG_CMD_START_DETACH_TIER))
|
|
|
cb8e9e |
ret = 1;
|
|
|
cb8e9e |
out:
|
|
|
cb8e9e |
return ret;
|
|
|
cb8e9e |
@@ -958,9 +959,11 @@ tier_search (xlator_t *this, dht_layout_t *layout, const char *name)
|
|
|
cb8e9e |
{
|
|
|
cb8e9e |
xlator_t *subvol = NULL;
|
|
|
cb8e9e |
void *value;
|
|
|
cb8e9e |
- int search_first_subvol = 0;
|
|
|
cb8e9e |
+ int search_subvol = 0;
|
|
|
cb8e9e |
dht_conf_t *conf = NULL;
|
|
|
cb8e9e |
gf_defrag_info_t *defrag = NULL;
|
|
|
cb8e9e |
+ int layout_cold = 0;
|
|
|
cb8e9e |
+ int layout_hot = 1;
|
|
|
cb8e9e |
|
|
|
cb8e9e |
GF_VALIDATE_OR_GOTO("tier", this, out);
|
|
|
cb8e9e |
GF_VALIDATE_OR_GOTO(this->name, layout, out);
|
|
|
cb8e9e |
@@ -969,28 +972,42 @@ tier_search (xlator_t *this, dht_layout_t *layout, const char *name)
|
|
|
cb8e9e |
|
|
|
cb8e9e |
conf = this->private;
|
|
|
cb8e9e |
|
|
|
cb8e9e |
+ /* The first subvolume in the graph is always cold. */
|
|
|
cb8e9e |
+ /* Find the position of the cold subvolume in the layout. */
|
|
|
cb8e9e |
+ layout_cold = 0;
|
|
|
cb8e9e |
+ layout_hot = 1;
|
|
|
cb8e9e |
+ if (conf->subvolumes[0] != layout->list[0].xlator) {
|
|
|
cb8e9e |
+ layout_cold = 1;
|
|
|
cb8e9e |
+ layout_hot = 0;
|
|
|
cb8e9e |
+ }
|
|
|
cb8e9e |
+
|
|
|
cb8e9e |
+ search_subvol = layout_hot;
|
|
|
cb8e9e |
+
|
|
|
cb8e9e |
defrag = conf->defrag;
|
|
|
cb8e9e |
if (defrag && defrag->cmd == GF_DEFRAG_CMD_START_DETACH_TIER)
|
|
|
cb8e9e |
- search_first_subvol = 1;
|
|
|
cb8e9e |
+ search_subvol = layout_cold;
|
|
|
cb8e9e |
|
|
|
cb8e9e |
+ /* "decommission_subvols_cnt" can only be non-zero on detach. */
|
|
|
cb8e9e |
+ /* This will change once brick add/remove is supported for */
|
|
|
cb8e9e |
+ /* tiered volumes. */
|
|
|
cb8e9e |
+ else if (conf->decommission_subvols_cnt) {
|
|
|
cb8e9e |
+ search_subvol = layout_cold;
|
|
|
cb8e9e |
+ }
|
|
|
cb8e9e |
else if (!dict_get_ptr (this->options, "rule", &value) &&
|
|
|
cb8e9e |
- !strcmp(layout->list[0].xlator->name, value)) {
|
|
|
cb8e9e |
- search_first_subvol = 1;
|
|
|
cb8e9e |
+ !strcmp(layout->list[layout_cold].xlator->name, value)) {
|
|
|
cb8e9e |
+ search_subvol = layout_cold;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
- if ((layout->list[0].err > 0) && (layout->list[0].err != ENOTCONN))
|
|
|
cb8e9e |
- search_first_subvol = 0;
|
|
|
cb8e9e |
+ if ((layout->list[search_subvol].err > 0) &&
|
|
|
cb8e9e |
+ (layout->list[search_subvol].err != ENOTCONN))
|
|
|
cb8e9e |
+ search_subvol = layout_cold;
|
|
|
cb8e9e |
|
|
|
cb8e9e |
- if (search_first_subvol)
|
|
|
cb8e9e |
- subvol = layout->list[0].xlator;
|
|
|
cb8e9e |
- else
|
|
|
cb8e9e |
- subvol = layout->list[1].xlator;
|
|
|
cb8e9e |
+ subvol = layout->list[search_subvol].xlator;
|
|
|
cb8e9e |
+ out:
|
|
|
cb8e9e |
|
|
|
cb8e9e |
-out:
|
|
|
cb8e9e |
return subvol;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
|
|
|
cb8e9e |
-
|
|
|
cb8e9e |
dht_methods_t tier_methods = {
|
|
|
cb8e9e |
.migration_get_dst_subvol = tier_migration_get_dst,
|
|
|
cb8e9e |
.migration_other = tier_start,
|
|
|
cb8e9e |
diff --git a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
|
|
|
cb8e9e |
index 0af86f5..aa3a6c9 100644
|
|
|
cb8e9e |
--- a/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
|
|
|
cb8e9e |
+++ b/xlators/mgmt/glusterd/src/glusterd-brick-ops.c
|
|
|
cb8e9e |
@@ -2039,6 +2039,7 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr)
|
|
|
cb8e9e |
char *brick_tmpstr = NULL;
|
|
|
cb8e9e |
int start_remove = 0;
|
|
|
cb8e9e |
uint32_t commit_hash = 0;
|
|
|
cb8e9e |
+ int defrag_cmd = 0;
|
|
|
cb8e9e |
|
|
|
cb8e9e |
this = THIS;
|
|
|
cb8e9e |
GF_ASSERT (this);
|
|
|
cb8e9e |
@@ -2309,9 +2310,12 @@ glusterd_op_remove_brick (dict_t *dict, char **op_errstr)
|
|
|
cb8e9e |
volinfo->rebal.commit_hash = commit_hash;
|
|
|
cb8e9e |
}
|
|
|
cb8e9e |
/* perform the rebalance operations */
|
|
|
cb8e9e |
+ defrag_cmd = GF_DEFRAG_CMD_START_FORCE;
|
|
|
cb8e9e |
+ if (cmd == GF_OP_CMD_DETACH_START)
|
|
|
cb8e9e |
+ defrag_cmd = GF_DEFRAG_CMD_START_DETACH_TIER;
|
|
|
cb8e9e |
ret = glusterd_handle_defrag_start
|
|
|
cb8e9e |
(volinfo, err_str, sizeof (err_str),
|
|
|
cb8e9e |
- GF_DEFRAG_CMD_START_FORCE,
|
|
|
cb8e9e |
+ defrag_cmd,
|
|
|
cb8e9e |
glusterd_remove_brick_migrate_cbk, GD_OP_REMOVE_BRICK);
|
|
|
cb8e9e |
|
|
|
cb8e9e |
if (!ret)
|
|
|
cb8e9e |
--
|
|
|
cb8e9e |
1.7.1
|
|
|
cb8e9e |
|