summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Lambright <dlambrig@redhat.com>2016-01-22 17:31:48 -0500
committerDan Lambright <dlambrig@redhat.com>2016-03-16 21:37:48 -0700
commit9fbcf7f862df50925c3e2b83740c30ccd55e80dd (patch)
tree1d5587ffd45f5623aadfd2894c0eb12e399fa450
parent16a535753c4e5ef8b579d3758a5f709c19fb9592 (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. This is a backport of 13284 > 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> Signed-off-by: Dan Lambright <dlambrig@redhat.com> Change-Id: Ia305784b0aa570b70e54f532bf5d68a91b0cf305 BUG: 1318203 Reviewed-on: http://review.gluster.org/13750 Smoke: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: hari gowtham <hari.gowtham005@gmail.com> Tested-by: Dan Lambright <dlambrig@redhat.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Dan Lambright <dlambrig@redhat.com>
-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 b14f006..b9ed755 100644
--- a/xlators/cluster/dht/src/tier.c
+++ b/xlators/cluster/dht/src/tier.c
@@ -457,6 +457,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);
@@ -494,6 +498,13 @@ tier_migrate_using_query_file (void *_args)
}
+ 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 = read_query_record_list (query_cbk_args->qfile_array,
&query_record)) != 0) {
@@ -506,6 +517,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;