From 9ecbd69127d373ac000e9e1be00c1829e49e64a4 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Mon, 13 Apr 2020 19:31:51 +0530 Subject: cluster/afr: Heal directory rename without rmdir/mkdir Problem1: When a directory is renamed while a brick is down entry-heal always did an rm -rf on that directory on the sink on old location and did mkdir and created the directory hierarchy again in the new location. This is inefficient. Problem2: Renamedir heal order may lead to a scenario where directory in the new location could be created before deleting it from old location leading to 2 directories with same gfid in posix. Fix: As part of heal, if oldlocation is healed first and is not present in source-brick always rename it into a hidden directory inside the sink-brick so that when heal is triggered in new-location shd can rename it from this hidden directory to the new-location. If new-location heal is triggered first and it detects that the directory already exists in the brick, then it should skip healing the directory until it appears in the hidden directory. Credits: Ravi for rename-data-loss.t script Fixes: #1211 Change-Id: I0cba2006f35cd03d314d18211ce0bd530e254843 Signed-off-by: Pranith Kumar K --- tests/afr.rc | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'tests/afr.rc') diff --git a/tests/afr.rc b/tests/afr.rc index 5fc7fa1898d..241789903ba 100644 --- a/tests/afr.rc +++ b/tests/afr.rc @@ -115,3 +115,9 @@ function afr_private_key_value() #xargs at the end will strip leading spaces grep -E "^${key} = " $m/.meta/graphs/active/${v}-replicate-${replica_id}/private | cut -f2 -d'=' | xargs } + +function afr_anon_entry_count() +{ + local b=$1 + ls $b/.glusterfs-anonymous-inode* | wc -l +} -- cgit