diff options
author | Aravinda VK <avishwan@redhat.com> | 2014-08-12 18:19:30 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2014-09-08 12:03:20 -0700 |
commit | f875a7f82e53349a4a7a88d0eaa41c1485f2a2ba (patch) | |
tree | 3034ad8861c7731fee6d53eea7e5fb4edf1b1920 /geo-replication | |
parent | 81a127513da40424c572d566c1f26a7dfb345037 (diff) |
geo-rep: Handle RMDIR recursively
If RMDIR is recorded in brick changelog which is due to
self heal traffic then it will not have UNLINK entries for
child files. Geo-rep hangs with ENOTEMPTY error on slave.
Now geo-rep recursively deletes the dir if it gets ENOTEMPTY.
BUG: 1138952
Change-Id: Ie79db90c52103b39fa795bb8a096b363d450b427
Signed-off-by: Aravinda VK <avishwan@redhat.com>
Reviewed-on: http://review.gluster.org/8477
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Venky Shankar <vshankar@redhat.com>
Tested-by: Venky Shankar <vshankar@redhat.com>
Reviewed-on: http://review.gluster.org/8643
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'geo-replication')
-rw-r--r-- | geo-replication/syncdaemon/resource.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/geo-replication/syncdaemon/resource.py b/geo-replication/syncdaemon/resource.py index c84265739c5..09310c1f1aa 100644 --- a/geo-replication/syncdaemon/resource.py +++ b/geo-replication/syncdaemon/resource.py @@ -26,6 +26,7 @@ import subprocess from errno import EEXIST, ENOENT, ENODATA, ENOTDIR, ELOOP from errno import EISDIR, ENOTEMPTY, ESTALE, EINVAL from select import error as SelectError +import shutil from gconf import gconf import repce @@ -616,6 +617,17 @@ class Server(object): while True: er = entry_purge(entry, gfid) if isinstance(er, int): + if er == ENOTEMPTY and op == 'RMDIR': + er1 = errno_wrap(shutil.rmtree, + [os.path.join(pg, bname)], + [ENOENT]) + if not isinstance(er1, int): + logging.info("Removed %s/%s recursively" % + (pg, bname)) + break + + logging.warn("Failed to remove %s => %s/%s. %s" % + (gfid, pg, bname, os.strerror(er))) time.sleep(1) else: break |