From 7289fa908b4355a148adb610534aceee8761a547 Mon Sep 17 00:00:00 2001 From: Venky Shankar Date: Wed, 29 Jan 2014 20:27:12 +0530 Subject: gsyncd / geo-rep: ignore DHTs sticky bit file during crawl Change-Id: I0a6eeee8ae192d086b34d316ee1b82c7d76634da BUG: 1036539 Signed-off-by: Venky Shankar Reviewed-on: http://review.gluster.org/6792 Reviewed-on: http://review.gluster.org/6859 Reviewed-by: Kotresh HR Tested-by: Gluster Build System Reviewed-by: Aravinda VK --- geo-replication/syncdaemon/master.py | 10 ++++++++++ geo-replication/syncdaemon/resource.py | 15 +++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/geo-replication/syncdaemon/master.py b/geo-replication/syncdaemon/master.py index a7a46e377..c17e6a2ff 100644 --- a/geo-replication/syncdaemon/master.py +++ b/geo-replication/syncdaemon/master.py @@ -1184,6 +1184,13 @@ class GMasterXsyncMixin(GMasterChangelogMixin): if stime and stime[-1]: self.sync_stime(stime[-1], last) + def is_sticky(self, path, mo): + """check for DHTs linkto sticky bit file""" + sticky = False + if mo & 01000: + sticky = self.master.server.linkto_check(path) + return sticky + def Xcrawl(self, path='.', xtr_root=None): """ generate a CHANGELOG file consumable by process_change. @@ -1235,6 +1242,9 @@ class GMasterXsyncMixin(GMasterChangelogMixin): if isinstance(st, int): logging.warn('%s got purged in the interim ...' % e) continue + if self.is_sticky(e, st.st_mode): + logging.debug('ignoring sticky bit file %s' % e) + continue gfid = self.master.server.gfid(e) if isinstance(gfid, int): logging.warn('skipping entry %s..' % e) diff --git a/geo-replication/syncdaemon/resource.py b/geo-replication/syncdaemon/resource.py index 955491d38..32aa7d1c7 100644 --- a/geo-replication/syncdaemon/resource.py +++ b/geo-replication/syncdaemon/resource.py @@ -321,6 +321,18 @@ class Server(object): else: raise + @classmethod + @_pathguard + def linkto_check(cls, path): + try: + return not (Xattr.lgetxattr_buf(path, 'trusted.glusterfs.dht.linkto') == '') + except (IOError, OSError): + ex = sys.exc_info()[1] + if ex.errno in (ENOENT, ENODATA): + return False + else: + raise + @classmethod @_pathguard @@ -1135,6 +1147,9 @@ class GLUSTER(AbstractUrl, SlaveLocal, SlaveRemote): def gfid(cls, e): """ path based backend gfid fetch """ return super(brickserver, cls).gfid(e) + @classmethod + def linkto_check(cls, e): + return super(brickserver, cls).linkto_check(e) if gconf.slave_id: # define {,set_}xtime in slave, thus preempting # the call to remote, so that it takes data from -- cgit