diff options
author | Dan Lambright <dlambrig@redhat.com> | 2015-11-04 15:33:22 -0500 |
---|---|---|
committer | Dan Lambright <dlambrig@redhat.com> | 2015-11-24 04:13:53 -0800 |
commit | b8c56ebe617327d570c252f8c411c85a84e727e6 (patch) | |
tree | b8a94d37a3768a83ce3fc589d94efe86aea3676e /xlators/cluster/dht/src/tier.c | |
parent | 974837c3da9deb45cd2dc31afe56e5960268cf01 (diff) |
cluster/tier: readdirp to cold tier only
It is possible a file would get migrated in the middle
of a readdir operation. If there are four subvolumes A,B,C,D,
and if readdir reads them in order and reaches subvol B,
then, if a file is moved from D to A, it will not be included
in the readdir output.
This phenonema has pre-existed in DHT migration but is more
apparent in tiering.
When a file is moved off the hashed subvolume a T file is created.
For tiering, we will make the cold subvolume the hashed subvolume.
This will ensure the creation of a T file. Readdir will not skip T
files in the tier translator.
Making the cold subvolume the hashed subvolume ensures the T
files created on promotions or creates will be less likely to
fill the volume.
Creates still put the data on the hot subvolume.
This is a backport of 12530
> Change-Id: Ifde557d3d0e94a4570ca9f115adee3db2ee75407
> BUG: 1281598
> Signed-off-by: Dan Lambright <dlambrig@redhat.com>
> Reviewed-on: http://review.gluster.org/12530
> Tested-by: Gluster Build System <jenkins@build.gluster.com>
> Tested-by: NetBSD Build System <jenkins@build.gluster.org>
> Reviewed-by: N Balachandran <nbalacha@redhat.com>
> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Signed-off-by: Dan Lambright <dlambrig@redhat.com>
Signed-off-by: Dan Lambright <dlambrig@redhat.com>
Conflicts:
xlators/cluster/dht/src/tier.c
Change-Id: I5720a4cd04ae5088e5d7d23439b0f90d6bbc6265
BUG: 1283923
Reviewed-on: http://review.gluster.org/12722
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: N Balachandran <nbalacha@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Dan Lambright <dlambrig@redhat.com>
Tested-by: Dan Lambright <dlambrig@redhat.com>
Diffstat (limited to 'xlators/cluster/dht/src/tier.c')
-rw-r--r-- | xlators/cluster/dht/src/tier.c | 47 |
1 files changed, 6 insertions, 41 deletions
diff --git a/xlators/cluster/dht/src/tier.c b/xlators/cluster/dht/src/tier.c index ce6ba4ce57d..476d3323087 100644 --- a/xlators/cluster/dht/src/tier.c +++ b/xlators/cluster/dht/src/tier.c @@ -16,6 +16,8 @@ #include "dht-common.h" #include "tier.h" +#include "tier-common.h" +#include "syscall.h" /*Hard coded DB info*/ static gfdb_db_type_t dht_tier_db_type = GFDB_SQLITE3; @@ -445,7 +447,7 @@ tier_migrate_using_query_file (void *_args) goto abort; } - gf_msg_trace (this->name, 0, + gf_msg_debug (this->name, 0, "Tier %d" " src_subvol %s file %s", query_cbk_args->is_promotion, @@ -1557,53 +1559,16 @@ xlator_t * tier_search (xlator_t *this, dht_layout_t *layout, const char *name) { xlator_t *subvol = NULL; - void *value; - int search_subvol = 0; dht_conf_t *conf = NULL; - gf_defrag_info_t *defrag = NULL; - int layout_cold = 0; - int layout_hot = 1; 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; - /* The first subvolume in the graph is always cold. */ - /* Find the position of the cold subvolume in the layout. */ - layout_cold = 0; - layout_hot = 1; - if (conf->subvolumes[0] != layout->list[0].xlator) { - layout_cold = 1; - layout_hot = 0; - } - - search_subvol = layout_hot; - - defrag = conf->defrag; - if (defrag && defrag->cmd == GF_DEFRAG_CMD_START_DETACH_TIER) - search_subvol = layout_cold; - - /* "decommission_subvols_cnt" can only be non-zero on detach. */ - /* This will change once brick add/remove is supported for */ - /* tiered volumes. */ - else if (conf->decommission_subvols_cnt) { - search_subvol = layout_cold; - } - else if (!dict_get_ptr (this->options, "rule", &value) && - !strcmp(layout->list[layout_cold].xlator->name, value)) { - search_subvol = layout_cold; - } + subvol = TIER_HASHED_SUBVOL; - if ((layout->list[search_subvol].err > 0) && - (layout->list[search_subvol].err != ENOTCONN)) - search_subvol = layout_cold; - - subvol = layout->list[search_subvol].xlator; out: - return subvol; } @@ -1970,8 +1935,8 @@ struct xlator_fops fops = { .open = dht_open, .statfs = dht_statfs, .opendir = dht_opendir, - .readdir = dht_readdir, - .readdirp = dht_readdirp, + .readdir = tier_readdir, + .readdirp = tier_readdirp, .fsyncdir = dht_fsyncdir, .symlink = dht_symlink, .unlink = dht_unlink, |