diff options
author | Csaba Henk <csaba@redhat.com> | 2012-07-18 03:59:00 +0200 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2012-07-19 10:15:57 -0700 |
commit | de22a7760db69b82de8959d238fe444af8b387d0 (patch) | |
tree | fc53a54971f6f5443fdf8d1b70f413ca626f4a1c /xlators/features/marker/utils/syncdaemon/master.py | |
parent | 9f5b8911b484230304fa52c0fcd92f696a4af74a (diff) |
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 <csaba@redhat.com>
Reviewed-on: http://review.gluster.com/3683
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Venky Shankar <vshankar@redhat.com>
Diffstat (limited to 'xlators/features/marker/utils/syncdaemon/master.py')
-rw-r--r-- | xlators/features/marker/utils/syncdaemon/master.py | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/xlators/features/marker/utils/syncdaemon/master.py b/xlators/features/marker/utils/syncdaemon/master.py index 945ebb75dd2..a6aeb53dce0 100644 --- a/xlators/features/marker/utils/syncdaemon/master.py +++ b/xlators/features/marker/utils/syncdaemon/master.py @@ -54,12 +54,13 @@ def gmaster_builder(): """produce the GMaster class variant corresponding to sync mode""" this = sys.modules[__name__] - mixin = gconf.special_sync_mode - if not mixin: - mixin = 'normal' - logging.info('setting up master for %s sync mode' % mixin) - mixin = getattr(this, mixin.capitalize() + 'Mixin') - class _GMaster(GMasterBase, mixin): + modemixin = gconf.special_sync_mode + if not modemixin: + modemixin = 'normal' + logging.info('setting up master for %s sync mode' % modemixin) + modemixin = getattr(this, modemixin.capitalize() + 'Mixin') + sendmarkmixin = boolify(gconf.use_rsync_xattrs) and SendmarkNormalMixin or SendmarkRsyncMixin + class _GMaster(GMasterBase, modemixin, sendmarkmixin): pass return _GMaster @@ -295,6 +296,19 @@ class BlindMixin(object): self.slave.server.set_xtime_vec(path, xtd) +# Further mixins for certain tunable behaviors + +class SendmarkNormalMixin(object): + + def sendmark_regular(self, *a, **kw): + return self.sendmark(self, *a, **kw) + +class SendmarkRsyncMixin(object): + + def sendmark_regular(self, *a, **kw): + pass + + class GMasterBase(object): """abstract class impementling master role""" @@ -753,7 +767,7 @@ class GMasterBase(object): def regjob(e, xte, pb): if pb.wait(): logging.debug("synced " + e) - self.sendmark(e, xte) + self.sendmark_regular(e, xte) return True else: logging.warn("failed to sync " + e) |