summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCsaba Henk <csaba@gluster.com>2011-03-10 00:42:33 +0000
committerVijay Bellur <vijay@dev.gluster.com>2011-03-10 07:39:46 -0800
commit19e65beb16d2dc337d144e25337561ff6e82826a (patch)
treea0c4323fd9f3159a0054f2739119d78bf5222367
parent6cfb0fe84547db1ce8c21f0710cd0c74e88607c0 (diff)
syncademon: fortify handling of failed entries queries
Signed-off-by: Kaushik BV <kaushikbv@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1570 (geosync related changes) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1570
-rw-r--r--xlators/features/marker/utils/syncdaemon/master.py16
-rw-r--r--xlators/features/marker/utils/syncdaemon/resource.py9
2 files changed, 16 insertions, 9 deletions
diff --git a/xlators/features/marker/utils/syncdaemon/master.py b/xlators/features/marker/utils/syncdaemon/master.py
index 1abd0325268..0f12f96cf4f 100644
--- a/xlators/features/marker/utils/syncdaemon/master.py
+++ b/xlators/features/marker/utils/syncdaemon/master.py
@@ -117,7 +117,21 @@ class GMaster(object):
return
if path == '.':
self.change_seen = True
- dem, des = ( x.server.entries(path) for x in (self.master, self.slave) )
+ try:
+ dem = self.master.server.entries(path)
+ except OSError:
+ self.add_failjob(path, 'local-entries-fail')
+ return
+ try:
+ des = self.slave.server.entries(path)
+ except OSError:
+ self.slave.server.purge(path)
+ try:
+ self.slave.server.mkdir(path)
+ des = self.slave.server.entries(path)
+ except OSError:
+ self.add_failjob(path, 'remote-entries-fail')
+ return
dd = set(des) - set(dem)
if dd:
self.slave.server.purge(path, dd)
diff --git a/xlators/features/marker/utils/syncdaemon/resource.py b/xlators/features/marker/utils/syncdaemon/resource.py
index 55c6e4dd78b..dc3279d5290 100644
--- a/xlators/features/marker/utils/syncdaemon/resource.py
+++ b/xlators/features/marker/utils/syncdaemon/resource.py
@@ -93,14 +93,7 @@ class Server(object):
@staticmethod
def entries(path):
- try:
- return os.listdir(path)
- except OSError:
- ex = sys.exc_info()[1]
- if ex.errno == ENOTDIR:
- return []
- else:
- raise
+ return os.listdir(path)
@classmethod
def purge(cls, path, entries=None):