From de22a7760db69b82de8959d238fe444af8b387d0 Mon Sep 17 00:00:00 2001 From: Csaba Henk Date: Wed, 18 Jul 2012 03:59:00 +0200 Subject: geo-rep / gsyncd: add support for sending xtimes through rsync Note that in said mode metadata synchronization is best effort: rsync syncs metadata at last so if rsync is interrupted in between xattr sync and metadata sync stages, then file will be considered in sync Change-Id: I1c75eab33b0a1000abf3ad36b2d484a89eeda1bd BUG: 841062 Signed-off-by: Csaba Henk Reviewed-on: http://review.gluster.com/3683 Tested-by: Gluster Build System Reviewed-by: Venky Shankar --- xlators/features/marker/utils/syncdaemon/resource.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'xlators/features/marker/utils/syncdaemon/resource.py') diff --git a/xlators/features/marker/utils/syncdaemon/resource.py b/xlators/features/marker/utils/syncdaemon/resource.py index 9ca226f9628..47e4748df30 100644 --- a/xlators/features/marker/utils/syncdaemon/resource.py +++ b/xlators/features/marker/utils/syncdaemon/resource.py @@ -19,7 +19,7 @@ import repce from repce import RepceServer, RepceClient from master import gmaster_builder import syncdutils -from syncdutils import GsyncdError, select, privileged +from syncdutils import GsyncdError, select, privileged, boolify UrlRX = re.compile('\A(\w+)://([^ *?[]*)\Z') HostRX = re.compile('[a-z\d](?:[a-z\d.-]*[a-z\d])?', re.I) @@ -472,6 +472,10 @@ class SlaveLocal(object): stop servicing if a timeout is configured and got no keep-alime in that inteval """ + + if boolify(gconf.use_rsync_xattrs) and not privileged(): + raise GsyncdError("using rsync for extended attributes is not supported") + repce = RepceServer(self.server, sys.stdin, sys.stdout, int(gconf.sync_jobs)) t = syncdutils.Thread(target=lambda: (repce.service_loop(), syncdutils.finalize())) @@ -498,12 +502,13 @@ class SlaveRemote(object): communicate throuh its stdio. """ slave = opts.get('slave', self.url) + extra_opts = [] so = getattr(gconf, 'session_owner', None) if so: - so_args = ['--session-owner', so] - else: - so_args = [] - po = Popen(rargs + gconf.remote_gsyncd.split() + so_args + \ + extra_opts += ['--session-owner', so] + if boolify(gconf.use_rsync_xattrs): + extra_opts.append('--use-rsync-xattrs') + po = Popen(rargs + gconf.remote_gsyncd.split() + extra_opts + \ ['-N', '--listen', '--timeout', str(gconf.timeout), slave], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) gconf.transport = po @@ -532,7 +537,8 @@ class SlaveRemote(object): raise GsyncdError("no files to sync") logging.debug("files: " + ", ".join(files)) argv = gconf.rsync_command.split() + ['-aR', '--super', '--numeric-ids', '--no-implied-dirs'] + \ - gconf.rsync_options.split() + files + list(args) + gconf.rsync_options.split() + (boolify(gconf.use_rsync_xattrs) and ['--xattrs'] or []) + \ + files + list(args) po = Popen(argv, stderr=subprocess.PIPE) po.wait() po.terminate_geterr(fail_on_err = False) -- cgit