cluster/dht: Add "afr.readdir-failover=off" option the rebalance process
By failing over readdir (default behaviour), rebalance could get duplicate files, as readdir would re-read from offset 0. Rebalance should not attempt to migrate these files again. Additionally, we need to handle these cases as failure in rebalance crawl. No test case provided, as we cannot determine the read child in afr. Change-Id: If07508b4f92dacc17e0f695b48a866c7c66004be BUG: 859387 Signed-off-by: shishir gowda <sgowda@redhat.com> Reviewed-on: http://review.gluster.org/4300 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
This commit is contained in:
parent
e0daaed286
commit
5267406e5b
@ -1080,17 +1080,24 @@ gf_defrag_migrate_data (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,
|
||||
|
||||
while ((ret = syncop_readdirp (this, fd, 131072, offset, NULL,
|
||||
&entries)) != 0) {
|
||||
if (ret < 0)
|
||||
break;
|
||||
|
||||
if (ret < 0) {
|
||||
|
||||
gf_log (this->name, GF_LOG_ERROR, "Readdir returned %s."
|
||||
" Aborting migrate-data",
|
||||
strerror(readdir_operrno));
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Need to keep track of ENOENT errno, that means, there is no
|
||||
need to send more readdirp() */
|
||||
readdir_operrno = errno;
|
||||
|
||||
free_entries = _gf_true;
|
||||
|
||||
if (list_empty (&entries.list))
|
||||
break;
|
||||
|
||||
free_entries = _gf_true;
|
||||
|
||||
list_for_each_entry_safe (entry, tmp, &entries.list, list) {
|
||||
if (defrag->defrag_status != GF_DEFRAG_STATUS_STARTED) {
|
||||
ret = 1;
|
||||
@ -1284,6 +1291,7 @@ gf_defrag_fix_layout (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,
|
||||
dict_t *dict = NULL;
|
||||
off_t offset = 0;
|
||||
struct iatt iatt = {0,};
|
||||
int readdirp_errno = 0;
|
||||
|
||||
ret = syncop_lookup (this, loc, NULL, &iatt, NULL, NULL);
|
||||
if (ret) {
|
||||
@ -1319,12 +1327,22 @@ gf_defrag_fix_layout (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,
|
||||
while ((ret = syncop_readdirp (this, fd, 131072, offset, NULL,
|
||||
&entries)) != 0)
|
||||
{
|
||||
if ((ret < 0) || (ret && (errno == ENOENT)))
|
||||
break;
|
||||
free_entries = _gf_true;
|
||||
|
||||
if (ret < 0) {
|
||||
gf_log (this->name, GF_LOG_ERROR, "Readdir returned %s"
|
||||
". Aborting fix-layout",strerror(errno));
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Need to keep track of ENOENT errno, that means, there is no
|
||||
need to send more readdirp() */
|
||||
readdirp_errno = errno;
|
||||
|
||||
if (list_empty (&entries.list))
|
||||
break;
|
||||
|
||||
free_entries = _gf_true;
|
||||
|
||||
list_for_each_entry_safe (entry, tmp, &entries.list, list) {
|
||||
if (defrag->defrag_status != GF_DEFRAG_STATUS_STARTED) {
|
||||
ret = 1;
|
||||
@ -1400,6 +1418,8 @@ gf_defrag_fix_layout (xlator_t *this, gf_defrag_info_t *defrag, loc_t *loc,
|
||||
gf_dirent_free (&entries);
|
||||
free_entries = _gf_false;
|
||||
INIT_LIST_HEAD (&entries.list);
|
||||
if (readdirp_errno == ENOENT)
|
||||
break;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
@ -236,6 +236,7 @@ glusterd_handle_defrag_start (glusterd_volinfo_t *volinfo, char *op_errstr,
|
||||
"--xlator-option",
|
||||
"*replicate*.metadata-self-heal=off",
|
||||
"--xlator-option", "*replicate*.entry-self-heal=off",
|
||||
"--xlator-option", "*replicate*.readdir-failover=off",
|
||||
NULL);
|
||||
runner_add_arg (&runner, "--xlator-option");
|
||||
runner_argprintf ( &runner, "*dht.rebalance-cmd=%d",cmd);
|
||||
|
Loading…
x
Reference in New Issue
Block a user