summaryrefslogtreecommitdiffstats
path: root/xlators/cluster
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/cluster')
-rw-r--r--xlators/cluster/dht/src/dht-common.h4
-rw-r--r--xlators/cluster/dht/src/tier.c21
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 (&current_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,