geo-rep: Handle directory sync failure as hard error

If directory creation is failed, return immediately before
further processing. Allowing it to further process will
fail the entire directory tree syncing to slave. Hence
master will log and raise exception if it's directory
failure. Earlier, master used to log the failure and
proceed.

Change-Id: Iba2a8b5d3d0092e7a9c8a3c2cdf9e6e29c73ddf0
BUG: 1411607
Signed-off-by: Kotresh HR <khiremat@redhat.com>
Reviewed-on: http://review.gluster.org/16364
Smoke: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Aravinda VK <avishwan@redhat.com>
This commit is contained in:
Kotresh HR 2017-01-10 00:30:42 -05:00 committed by Aravinda VK
parent 27c85d014b
commit 91ad7fe0ed
2 changed files with 20 additions and 6 deletions
geo-replication/syncdaemon

@ -758,6 +758,9 @@ class GMasterChangelogMixin(GMasterCommon):
num_failures += 1
logging.error('%s FAILED: %s' % (log_prefix,
repr(failure)))
if failure[0]['op'] == 'MKDIR':
raise GsyncdError("The above directory failed to sync."
" Please fix it to proceed further.")
self.status.inc_value("failures", num_failures)

@ -664,16 +664,19 @@ class Server(object):
# We do this for failing fops on Slave
# Master should be logging this
if cmd_ret is None:
return
return False
if cmd_ret == EEXIST:
disk_gfid = cls.gfid_mnt(e['entry'])
if isinstance(disk_gfid, basestring):
if e['gfid'] != disk_gfid:
failures.append((e, cmd_ret, disk_gfid))
if isinstance(disk_gfid, basestring) and e['gfid'] != disk_gfid:
failures.append((e, cmd_ret, disk_gfid))
else:
return False
else:
failures.append((e, cmd_ret))
return True
failures = []
def matching_disk_gfid(gfid, entry):
@ -843,7 +846,15 @@ class Server(object):
[pg, 'glusterfs.gfid.newfile', blob],
[EEXIST, ENOENT],
[ESTALE, EINVAL])
collect_failure(e, cmd_ret)
failed = collect_failure(e, cmd_ret)
# If directory creation is failed, return immediately before
# further processing. Allowing it to further process will
# cause the entire directory tree to fail syncing to slave.
# Hence master will log and raise exception if it's
# directory failure.
if failed and op == 'MKDIR':
return failures
# If UID/GID is different than zero that means we are trying
# create Entry with different UID/GID. Create Entry with
@ -852,7 +863,7 @@ class Server(object):
path = os.path.join(pfx, gfid)
cmd_ret = errno_wrap(os.chown, [path, uid, gid], [ENOENT],
[ESTALE, EINVAL])
collect_failure(e, cmd_ret)
collect_failure(e, cmd_ret)
return failures