From aa9f47d1729f6a7f08aef4c23d44febe498bb280 Mon Sep 17 00:00:00 2001 From: Csaba Henk Date: Wed, 18 Jul 2012 04:07:20 +0200 Subject: geo-rep / gsyncd: convert ignore-deletes to a mixin too Change-Id: I164a1d1dd5f15569afd6806834119a6844949df0 BUG: 841062 Signed-off-by: Csaba Henk Reviewed-on: http://review.gluster.com/3684 Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- xlators/features/marker/utils/syncdaemon/master.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'xlators/features/marker') diff --git a/xlators/features/marker/utils/syncdaemon/master.py b/xlators/features/marker/utils/syncdaemon/master.py index a6aeb53dce0..ef3816e6519 100644 --- a/xlators/features/marker/utils/syncdaemon/master.py +++ b/xlators/features/marker/utils/syncdaemon/master.py @@ -60,7 +60,8 @@ def gmaster_builder(): 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): + purgemixin = boolify(gconf.ignore_deletes) and PurgeNoopMixin or PurgeNormalMixin + class _GMaster(GMasterBase, modemixin, sendmarkmixin, purgemixin): pass return _GMaster @@ -309,6 +310,18 @@ class SendmarkRsyncMixin(object): pass +class PurgeNormalMixin(object): + + def purge_missing(self, path, names): + self.slave.server.purge(path, dd) + +class PurgeNoopMixin(object): + + def purge_missing(self, path, names): + pass + + + class GMasterBase(object): """abstract class impementling master role""" @@ -728,8 +741,8 @@ class GMasterBase(object): self.add_failjob(path, 'remote-entries-fail') return dd = set(des) - set(dem) - if dd and not boolify(gconf.ignore_deletes): - self.slave.server.purge(path, dd) + if dd: + self.purge_missing(path, dd) chld = [] for e in dem: e = os.path.join(path, e) -- cgit