|
|
21ab4e |
From 0c39ae4bb678c256ea20387b88507565cc38872d Mon Sep 17 00:00:00 2001
|
|
|
21ab4e |
From: Kotresh HR <khiremat@redhat.com>
|
|
|
21ab4e |
Date: Tue, 10 Jan 2017 00:30:42 -0500
|
|
|
21ab4e |
Subject: [PATCH 311/361] geo-rep: Handle directory sync failure as hard error
|
|
|
21ab4e |
|
|
|
21ab4e |
If directory creation is failed, return immediately before
|
|
|
21ab4e |
further processing. Allowing it to further process will
|
|
|
21ab4e |
fail the entire directory tree syncing to slave. Hence
|
|
|
21ab4e |
master will log and raise exception if it's directory
|
|
|
21ab4e |
failure. Earlier, master used to log the failure and
|
|
|
21ab4e |
proceed.
|
|
|
21ab4e |
|
|
|
21ab4e |
mainline:
|
|
|
21ab4e |
> BUG: 1411607
|
|
|
21ab4e |
> Reviewed-on: http://review.gluster.org/16364
|
|
|
21ab4e |
> Smoke: Gluster Build System <jenkins@build.gluster.org>
|
|
|
21ab4e |
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
21ab4e |
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
|
|
|
21ab4e |
> Reviewed-by: Aravinda VK <avishwan@redhat.com>
|
|
|
21ab4e |
(cherry picked from commit d1f84c77faeaa915cc57e0c13925cfe8bbe90ad6)
|
|
|
21ab4e |
|
|
|
21ab4e |
BUG: 1425695
|
|
|
21ab4e |
Change-Id: Iba2a8b5d3d0092e7a9c8a3c2cdf9e6e29c73ddf0
|
|
|
21ab4e |
Signed-off-by: Kotresh HR <khiremat@redhat.com>
|
|
|
21ab4e |
Reviewed-on: https://code.engineering.redhat.com/gerrit/101291
|
|
|
21ab4e |
Tested-by: Milind Changire <mchangir@redhat.com>
|
|
|
21ab4e |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
21ab4e |
---
|
|
|
21ab4e |
geo-replication/syncdaemon/resource.py | 23 +++++++++++++++++------
|
|
|
21ab4e |
1 file changed, 17 insertions(+), 6 deletions(-)
|
|
|
21ab4e |
|
|
|
21ab4e |
diff --git a/geo-replication/syncdaemon/resource.py b/geo-replication/syncdaemon/resource.py
|
|
|
21ab4e |
index 9c7a70a..be97b16 100644
|
|
|
21ab4e |
--- a/geo-replication/syncdaemon/resource.py
|
|
|
21ab4e |
+++ b/geo-replication/syncdaemon/resource.py
|
|
|
21ab4e |
@@ -628,16 +628,19 @@ class Server(object):
|
|
|
21ab4e |
# We do this for failing fops on Slave
|
|
|
21ab4e |
# Master should be logging this
|
|
|
21ab4e |
if cmd_ret is None:
|
|
|
21ab4e |
- return
|
|
|
21ab4e |
+ return False
|
|
|
21ab4e |
|
|
|
21ab4e |
if cmd_ret == EEXIST:
|
|
|
21ab4e |
disk_gfid = cls.gfid_mnt(e['entry'])
|
|
|
21ab4e |
- if isinstance(disk_gfid, basestring):
|
|
|
21ab4e |
- if e['gfid'] != disk_gfid:
|
|
|
21ab4e |
- failures.append((e, cmd_ret, disk_gfid))
|
|
|
21ab4e |
+ if isinstance(disk_gfid, basestring) and e['gfid'] != disk_gfid:
|
|
|
21ab4e |
+ failures.append((e, cmd_ret, disk_gfid))
|
|
|
21ab4e |
+ else:
|
|
|
21ab4e |
+ return False
|
|
|
21ab4e |
else:
|
|
|
21ab4e |
failures.append((e, cmd_ret))
|
|
|
21ab4e |
|
|
|
21ab4e |
+ return True
|
|
|
21ab4e |
+
|
|
|
21ab4e |
failures = []
|
|
|
21ab4e |
|
|
|
21ab4e |
def matching_disk_gfid(gfid, entry):
|
|
|
21ab4e |
@@ -807,7 +810,15 @@ class Server(object):
|
|
|
21ab4e |
[pg, 'glusterfs.gfid.newfile', blob],
|
|
|
21ab4e |
[EEXIST, ENOENT],
|
|
|
21ab4e |
[ESTALE, EINVAL])
|
|
|
21ab4e |
- collect_failure(e, cmd_ret)
|
|
|
21ab4e |
+ failed = collect_failure(e, cmd_ret)
|
|
|
21ab4e |
+
|
|
|
21ab4e |
+ # If directory creation is failed, return immediately before
|
|
|
21ab4e |
+ # further processing. Allowing it to further process will
|
|
|
21ab4e |
+ # cause the entire directory tree to fail syncing to slave.
|
|
|
21ab4e |
+ # Hence master will log and raise exception if it's
|
|
|
21ab4e |
+ # directory failure.
|
|
|
21ab4e |
+ if failed and op == 'MKDIR':
|
|
|
21ab4e |
+ return failures
|
|
|
21ab4e |
|
|
|
21ab4e |
# If UID/GID is different than zero that means we are trying
|
|
|
21ab4e |
# create Entry with different UID/GID. Create Entry with
|
|
|
21ab4e |
@@ -816,7 +827,7 @@ class Server(object):
|
|
|
21ab4e |
path = os.path.join(pfx, gfid)
|
|
|
21ab4e |
cmd_ret = errno_wrap(os.chown, [path, uid, gid], [ENOENT],
|
|
|
21ab4e |
[ESTALE, EINVAL])
|
|
|
21ab4e |
- collect_failure(e, cmd_ret)
|
|
|
21ab4e |
+ collect_failure(e, cmd_ret)
|
|
|
21ab4e |
|
|
|
21ab4e |
return failures
|
|
|
21ab4e |
|
|
|
21ab4e |
--
|
|
|
21ab4e |
1.8.3.1
|
|
|
21ab4e |
|