21ab4e
From a13ef4a5ef08913004223feb8dfdc7e1e8ed0b5c Mon Sep 17 00:00:00 2001
21ab4e
From: Kotresh HR <khiremat@redhat.com>
21ab4e
Date: Tue, 4 Jul 2017 08:46:06 -0400
21ab4e
Subject: [PATCH 544/557] geo-rep: Fix entry failure because parent dir doesn't
21ab4e
 exist
21ab4e
21ab4e
In a distributed volume on master, it can so happen that
21ab4e
the RMDIR followed by MKDIR is recorded in changelog on
21ab4e
a particular subvolume with same gfid and pargfid/bname
21ab4e
but not on all subvolumes as below.
21ab4e
21ab4e
E 61c67a2e-07f2-45a9-95cf-d8f16a5e9c36 RMDIR \
21ab4e
9cc51be8-91c3-4ef4-8ae3-17596fcfed40%2Ffedora2
21ab4e
E 61c67a2e-07f2-45a9-95cf-d8f16a5e9c36 MKDIR 16877 0 0 \
21ab4e
9cc51be8-91c3-4ef4-8ae3-17596fcfed40%2Ffedora2
21ab4e
21ab4e
While processing this changelog, geo-rep thinks RMDIR is
21ab4e
successful and does recursive rmdir on slave. But in the
21ab4e
master the directory still exists. This could lead to
21ab4e
data discrepancy between master and slave.
21ab4e
21ab4e
Cause:
21ab4e
RMDIR-MKDIR pair gets recorded so in changelog when the
21ab4e
directory removal is successful on cached subvolume and
21ab4e
failed in one of hashed subvol for some reason
21ab4e
(may be down). In this case, the directory is re-created
21ab4e
on cached subvol which gets recorded as MKDIR again in
21ab4e
changelog.
21ab4e
21ab4e
Solution:
21ab4e
So while processing RMDIR geo-replication should stat on
21ab4e
master with gfid and should not delete it if it's present.
21ab4e
21ab4e
> Change-Id: If5da1d6462eb4d9ebe2e88b3a70cc454411a133e
21ab4e
> BUG: 1467718
21ab4e
> Signed-off-by: Kotresh HR <khiremat@redhat.com>
21ab4e
> Reviewed-on: https://review.gluster.org/17695
21ab4e
> Smoke: Gluster Build System <jenkins@build.gluster.org>
21ab4e
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
21ab4e
> Reviewed-by: Aravinda VK <avishwan@redhat.com>
21ab4e
21ab4e
Change-Id: If5da1d6462eb4d9ebe2e88b3a70cc454411a133e
21ab4e
BUG: 1468186
21ab4e
Signed-off-by: Kotresh HR <khiremat@redhat.com>
21ab4e
Reviewed-on: https://code.engineering.redhat.com/gerrit/111301
21ab4e
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
21ab4e
---
21ab4e
 geo-replication/syncdaemon/master.py | 5 +++++
21ab4e
 1 file changed, 5 insertions(+)
21ab4e
21ab4e
diff --git a/geo-replication/syncdaemon/master.py b/geo-replication/syncdaemon/master.py
21ab4e
index 39dd6ea..3bd9b54 100644
21ab4e
--- a/geo-replication/syncdaemon/master.py
21ab4e
+++ b/geo-replication/syncdaemon/master.py
21ab4e
@@ -823,6 +823,11 @@ class GMasterChangelogMixin(GMasterCommon):
21ab4e
                     if pt in datas:
21ab4e
                         datas.remove(pt)
21ab4e
 
21ab4e
+                    if ty in ['RMDIR'] and not isinstance(st, int):
21ab4e
+                        logging.info(lf('Ignoring rmdir. Directory present in '
21ab4e
+                                        'master', gfid=gfid, pgfid_bname=en))
21ab4e
+                        continue
21ab4e
+
21ab4e
                     if not boolify(gconf.ignore_deletes):
21ab4e
                         purge_update()
21ab4e
                         entries.append(edct(ty, gfid=gfid, entry=en))
21ab4e
-- 
21ab4e
1.8.3.1
21ab4e