diff options
author | Joseph Fernandes <josferna@redhat.com> | 2015-10-29 12:06:57 +0530 |
---|---|---|
committer | Dan Lambright <dlambrig@redhat.com> | 2015-11-05 18:31:35 -0800 |
commit | b65ffa6519a1a141aa6e8d1abed5315f4851c995 (patch) | |
tree | 3c694005ccb45278afbc8b4c84775e7787e682bf /xlators/cluster | |
parent | 7ca6ec092dfe4065b2e192beceba27d3df79ba4e (diff) |
tier/dht: Ignoring replica for migration counting
We used to count replica files for migration counting even though
they were ignore for migration as the replica brick didnt have
the ownership (as per the replication xlator either AFR/EC).
As a result the number of files migrated would show a wrong count,
i.e each replicated file would be counted 1 + number of replica.
This patch ignores such cases.
Backport of http://review.gluster.org/#/c/12453/
Change-Id: Ib005fedaee16f171e0499782b91f3eeedf8860ed
BUG: 1262860
Signed-off-by: Joseph Fernandes <josferna@redhat.com>
Reviewed-on: http://review.gluster.org/12511
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
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')
-rw-r--r-- | xlators/cluster/dht/src/tier.c | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/xlators/cluster/dht/src/tier.c b/xlators/cluster/dht/src/tier.c index b152a43f72e..31d5e8b627e 100644 --- a/xlators/cluster/dht/src/tier.c +++ b/xlators/cluster/dht/src/tier.c @@ -104,14 +104,14 @@ tier_check_same_node (xlator_t *this, loc_t *loc, gf_defrag_info_t *defrag) } if (gf_uuid_parse (uuid_str, node_uuid)) { - gf_msg (this->name, GF_LOG_INFO, 0, DHT_MSG_LOG_TIER_ERROR, + gf_msg (this->name, GF_LOG_ERROR, 0, DHT_MSG_LOG_TIER_ERROR, "uuid_parse failed for %s", loc->path); goto out; } if (gf_uuid_compare (node_uuid, defrag->node_uuid)) { - gf_msg_trace (this->name, 0, - "%s does not belong to this node", loc->path); + gf_msg_trace (this->name, 0, + "%s does not belong to this node", loc->path); ret = 1; goto out; } @@ -258,6 +258,12 @@ tier_migrate_using_query_file (void *_args) loc_t loc = {0,}; dict_t *migrate_data = NULL; inode_t *linked_inode = NULL; + /* + * per_file_status and per_link_status + * 0 : success + * -1 : failure + * 1 : ignore the status and dont count for migration + * */ int per_file_status = 0; int per_link_status = 0; int total_status = 0; @@ -496,9 +502,18 @@ tier_migrate_using_query_file (void *_args) src_subvol->name, loc.name); - if (tier_check_same_node (this, &loc, defrag)) { - if (ret < 0) + + ret = tier_check_same_node (this, &loc, defrag); + if (ret != 0) { + if (ret < 0) { per_link_status = -1; + goto abort; + } + ret = 0; + /* By setting per_linl_status to 1 we are + * ignoring this status and will not be counting + * this file for migration */ + per_link_status = 1; goto abort; } @@ -571,14 +586,16 @@ abort: } per_file_status = per_link_status; per_file_out: - if (per_file_status) { + if (per_file_status < 0) {/* Failure */ pthread_mutex_lock (&dm_stat_mutex); defrag->total_failures++; pthread_mutex_unlock (&dm_stat_mutex); - } else { + } else if (per_file_status == 0) {/* Success */ pthread_mutex_lock (&dm_stat_mutex); defrag->total_files++; pthread_mutex_unlock (&dm_stat_mutex); + } else if (per_file_status == 1) {/* Ignore */ + per_file_status = 0; } total_status = total_status + per_file_status; per_link_status = 0; |