From d702e702e7248da63449b714507010bb3ef1072d Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Mon, 16 Sep 2013 14:04:05 +0530 Subject: geo-rep: create hardlink as hardlinks in xsync crawl BUG: 847839 Change-Id: Ieaa754f15611392c09afcc7190b9ff9da39d7fce Signed-off-by: Amar Tumballi Reviewed-on: http://review.gluster.org/5934 Reviewed-by: Venky Shankar Tested-by: Gluster Build System --- geo-replication/syncdaemon/master.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'geo-replication') diff --git a/geo-replication/syncdaemon/master.py b/geo-replication/syncdaemon/master.py index f18a60e6f49..753d0a614fe 100644 --- a/geo-replication/syncdaemon/master.py +++ b/geo-replication/syncdaemon/master.py @@ -884,13 +884,18 @@ class GMasterXsyncMixin(GMasterChangelogMixin): if stat.S_ISDIR(mo): self.write_entry_change("E", [gfid, 'MKDIR', escape(os.path.join(pargfid, bname))]) self.crawl(e, xtr) - elif stat.S_ISREG(mo): - self.write_entry_change("E", [gfid, 'CREATE', escape(os.path.join(pargfid, bname))]) - self.write_entry_change("D", [gfid]) elif stat.S_ISLNK(mo): self.write_entry_change("E", [gfid, 'SYMLINK', escape(os.path.join(pargfid, bname))]) else: - logging.info('ignoring %s' % e) + # if a file has a hardlink, create a Changelog entry as 'LINK' so the slave + # side will decide if to create the new entry, or to create link. + if st.st_nlink == 1: + self.write_entry_change("E", [gfid, 'MKNOD', escape(os.path.join(pargfid, bname))]) + else: + self.write_entry_change("E", [gfid, 'LINK', escape(os.path.join(pargfid, bname))]) + if stat.S_ISREG(mo): + self.write_entry_change("D", [gfid]) + if path == '.': logging.info('processing xsync changelog %s' % self.fname()) self.close() -- cgit