From e4d8dc2e80f0683c69481c47875c01c8c3723814 Mon Sep 17 00:00:00 2001 From: Ravishankar N Date: Wed, 18 Mar 2015 10:30:12 +0530 Subject: afr: remove stale index entries Backport of http://review.gluster.org/9714 Problem: During pre-op phase, the index xlator 1. Creates the entry inside .glusterfs/indices/xattrop 2. Winds the xattrop fop to posix to mark dirty/pending changelogs. If the brick crashes after 1, the xattrop entry becomes stale and never gets removed by shd during subsequent crawls because there is nothing to heal (changelogs are zero). Though the stale entry does not get displayed in the output of 'heal info' command, it nevertheless stays there forever unless a new write tansaction is performed on the file. Fix: During index self-heal if afr xattrs are found to be clean (indicated by ret value of 2 on a call to afr_shd_selfheal(), send a dummy post-op with all 0s for the xattr values, which makes the index xlator to unlink the stale entry. Change-Id: Iffb171e40490abd8d44df09ccc058b5da67baafe BUG: 1203081 Signed-off-by: Ravishankar N Reviewed-on: http://review.gluster.org/9920 Tested-by: Gluster Build System Reviewed-by: Pranith Kumar Karampuri Reviewed-by: Raghavendra Bhat --- tests/afr.rc | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'tests/afr.rc') diff --git a/tests/afr.rc b/tests/afr.rc index 938f9c07ab2..50067274d89 100644 --- a/tests/afr.rc +++ b/tests/afr.rc @@ -73,11 +73,9 @@ function is_file_heal_done { function count_sh_entries() { - val1=0 - for g in `ls $1/.glusterfs/indices/xattrop` - do - val1=$(( val1 + 1 )) - done - - echo $val1; + ls $1/.glusterfs/indices/xattrop | grep -v "xattrop-" | wc -l +} +function count_index_entries() +{ + ls $1/.glusterfs/indices/xattrop | wc -l } -- cgit