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