summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorDan Lambright <dlambrig@redhat.com>2016-01-22 17:31:48 -0500
committerDan Lambright <dlambrig@redhat.com>2016-02-03 08:15:20 -0800
commit58a91f36f639de21f6e77d1f43f5eb091ae96fb0 (patch)
treebce13a950f22824606ae8ed66d6499ab48d3af94 /xlators
parentd9e5977b08259580deccad2e0eed3a106094820a (diff)
cluster/tier: break out of iterating query file once cycle time ends
When iterating the query file during migration, tiering should break out of the loop once cycle time completes. Otherwise it may be possible to stay in the loop for a long time. If that happens updates to files will become stale and have not impact migration. Change-Id: Ib60cf74bc84e8646e6a0da21ff04954b1b83c414 BUG: 1301227 Signed-off-by: Dan Lambright <dlambrig@redhat.com> Reviewed-on: http://review.gluster.org/13284 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/cluster/dht/src/tier.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/xlators/cluster/dht/src/tier.c b/xlators/cluster/dht/src/tier.c
index 522ac547e6e..2b3838ff5f6 100644
--- a/xlators/cluster/dht/src/tier.c
+++ b/xlators/cluster/dht/src/tier.c
@@ -281,6 +281,10 @@ tier_migrate_using_query_file (void *_args)
uint64_t total_migrated_bytes = 0;
int total_files = 0;
loc_t root_loc = { 0 };
+ gfdb_time_t start_time = { 0 };
+ gfdb_time_t current_time = { 0 };
+ int total_time = 0;
+ int max_time = 0;
GF_VALIDATE_OR_GOTO ("tier", query_cbk_args, out);
GF_VALIDATE_OR_GOTO ("tier", query_cbk_args->this, out);
@@ -318,6 +322,13 @@ tier_migrate_using_query_file (void *_args)
dht_build_root_loc (defrag->root_inode, &root_loc);
+ ret = gettimeofday (&start_time, NULL);
+ if (query_cbk_args->is_promotion) {
+ max_time = defrag->tier_conf.tier_promote_frequency;
+ } else {
+ max_time = defrag->tier_conf.tier_demote_frequency;
+ }
+
/* Per file */
while ((ret = gfdb_methods.gfdb_read_query_record
(query_fd, &query_record)) != 0) {
@@ -330,6 +341,22 @@ tier_migrate_using_query_file (void *_args)
goto out;
}
+ ret = gettimeofday (&current_time, NULL);
+ if (ret < 0) {
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_LOG_TIER_ERROR,
+ "Could not get current time.");
+ goto out;
+ }
+
+ total_time = current_time.tv_sec - start_time.tv_sec;
+ if (total_time > max_time) {
+ gf_msg (this->name, GF_LOG_ERROR, 0,
+ DHT_MSG_LOG_TIER_STATUS,
+ "Max cycle time reached. Exiting migration.");
+ goto out;
+ }
+
per_file_status = 0;
per_link_status = 0;