d1681e
From ee764746030bb04a702504e3e4c0f8115928aef5 Mon Sep 17 00:00:00 2001
d1681e
From: Kotresh HR <khiremat@redhat.com>
d1681e
Date: Thu, 7 Dec 2017 04:46:08 -0500
d1681e
Subject: [PATCH 322/325] geo-rep: Cleanup stale unprocessed xsync changelogs
d1681e
d1681e
When geo-replication is in hybrid crawl, it crawls
d1681e
the file system and generates xsync changelogs.
d1681e
These changelogs are later processed to sync the
d1681e
data. If the worker goes to Faulty before processing
d1681e
all the generated xsync changelogs, those changelogs
d1681e
remain and is not cleaned up. When the worker
d1681e
comes back, it will re-crawl and re-generate xsync
d1681e
changelogs. So this patch cleans up the stale
d1681e
unprocessed xsync changelogs.
d1681e
d1681e
Backport of:
d1681e
 > Patch: https://review.gluster.org/18983
d1681e
 > Issue: #376
d1681e
d1681e
BUG: 1599037
d1681e
Change-Id: Ib92920c716c7d27e1eeb4bc4ebaf3efb48e0694d
d1681e
Signed-off-by: Kotresh HR <khiremat@redhat.com>
d1681e
Reviewed-on: https://code.engineering.redhat.com/gerrit/144102
d1681e
Tested-by: RHGS Build Bot <nigelb@redhat.com>
d1681e
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
d1681e
---
d1681e
 geo-replication/syncdaemon/master.py | 4 ++++
d1681e
 1 file changed, 4 insertions(+)
d1681e
d1681e
diff --git a/geo-replication/syncdaemon/master.py b/geo-replication/syncdaemon/master.py
d1681e
index e484692..64e9836 100644
d1681e
--- a/geo-replication/syncdaemon/master.py
d1681e
+++ b/geo-replication/syncdaemon/master.py
d1681e
@@ -1527,6 +1527,10 @@ class GMasterXsyncMixin(GMasterChangelogMixin):
d1681e
                 pass
d1681e
             else:
d1681e
                 raise
d1681e
+        # Purge stale unprocessed xsync changelogs
d1681e
+        for f in os.listdir(self.tempdir):
d1681e
+            if f.startswith("XSYNC-CHANGELOG"):
d1681e
+                os.remove(os.path.join(self.tempdir, f))
d1681e
 
d1681e
     def crawl(self):
d1681e
         """
d1681e
-- 
d1681e
1.8.3.1
d1681e