diff options
author | Joseph Fernandes <josferna@redhat.com> | 2016-04-26 06:10:16 +0530 |
---|---|---|
committer | Dan Lambright <dlambrig@redhat.com> | 2016-04-30 07:30:49 -0700 |
commit | 0d23f5207337fa54be57939eb8d70fe835d4658b (patch) | |
tree | a0db4ead5b70db9a5c718e0c9887796950e60110 /xlators | |
parent | 0eb8e055b739112ac8b70073ef6e4e3f57c43e08 (diff) |
tier/migrator: Fetch the next query file for the next cycle
Problem: When we spawn promote and demote thread, query files
are build. And only query file with index 0 is picked for migration
as the first query file. This may not be suitable for scenarios,
where the file in the query are too big to move in the first cycle,
as a result file in the other query files always get missed. We need to
shuffle so that other query files also get a chance.
Fix: Remember the previous first query file and shift it by one index,
before the migration starts.
Change-Id: I704947bcf4bab6b20b1179a6d9ae4a15a3d51bd9
BUG: 1330353
Signed-off-by: Joseph Fernandes <josferna@redhat.com>
Reviewed-on: http://review.gluster.org/14068
Tested-by: Joseph Fernandes
Smoke: Gluster Build System <jenkins@build.gluster.com>
CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Dan Lambright <dlambrig@redhat.com>
Tested-by: Dan Lambright <dlambrig@redhat.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/cluster/dht/src/dht-common.h | 4 | ||||
-rw-r--r-- | xlators/cluster/dht/src/tier.c | 21 |
2 files changed, 25 insertions, 0 deletions
diff --git a/xlators/cluster/dht/src/dht-common.h b/xlators/cluster/dht/src/dht-common.h index 1dfc5cddaea..a240a72444d 100644 --- a/xlators/cluster/dht/src/dht-common.h +++ b/xlators/cluster/dht/src/dht-common.h @@ -391,6 +391,10 @@ typedef struct gf_tier_conf { int demote_in_progress; /* This Structure is only used in tiering fixlayout */ gf_tier_fix_layout_arg_t tier_fix_layout_arg; + /* Indicates the index of the first queryfile picked + * in the last cycle of promote or demote */ + int32_t last_promote_qfile_index; + int32_t last_demote_qfile_index; } gf_tier_conf_t; struct gf_defrag_info_ { diff --git a/xlators/cluster/dht/src/tier.c b/xlators/cluster/dht/src/tier.c index b99497bc66a..1484589bc47 100644 --- a/xlators/cluster/dht/src/tier.c +++ b/xlators/cluster/dht/src/tier.c @@ -1404,6 +1404,9 @@ tier_migrate_files_using_qfile (migration_args_t *comp, ssize_t qfile_array_size = 0; int count = 0; int temp_fd = 0; + gf_tier_conf_t *tier_conf = NULL; + + tier_conf = &(query_cbk_args->defrag->tier_conf); /* Time format for error query files */ gettimeofday (¤t_time, NULL); @@ -1440,6 +1443,21 @@ tier_migrate_files_using_qfile (migration_args_t *comp, count++; } + /* Moving the query file index to the next, so that we won't the same + * query file every cycle as the first one */ + query_cbk_args->qfile_array->next_index = + (query_cbk_args->is_promotion) ? + tier_conf->last_promote_qfile_index : + tier_conf->last_demote_qfile_index; + shift_next_index (query_cbk_args->qfile_array); + if (query_cbk_args->is_promotion) { + tier_conf->last_promote_qfile_index = + query_cbk_args->qfile_array->next_index; + } else { + tier_conf->last_demote_qfile_index = + query_cbk_args->qfile_array->next_index; + } + /* Migrate files using query file list */ ret = tier_migrate_using_query_file ((void *)query_cbk_args); out: @@ -2139,6 +2157,9 @@ tier_init (xlator_t *this) defrag = conf->defrag; + defrag->tier_conf.last_demote_qfile_index = 0; + defrag->tier_conf.last_promote_qfile_index = 0; + defrag->tier_conf.is_tier = 1; ret = dict_get_int32 (this->options, |