summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRavishankar N <ravishankar@redhat.com>2014-05-27 07:30:42 +0000
committerNiels de Vos <ndevos@redhat.com>2014-06-24 02:27:55 -0700
commitb14ec5104f60c0f3baa744835c1214fec6099e7b (patch)
treead8f641d3c7e6a09e288a80253186269e8c718b1
parent8cbe743dd972e934265e9a4186359be63c77d9f1 (diff)
features/index: Don't delete current xattrop index.
Problem: `gluster v heal <volname> statistics heal-count` was not able to read the number of entries to be healed from the source brick because the base xattrop entries in indices/base_indices_holder and indices/xattrop were getting deleted after a successful heal and the code flow prevented them from creating it again. Fix: Don't delete the xattrop index unless it is stale (i.e. brick is restarted) Change-Id: Ief4eee0ddf42c4d8b711d00751be92bbbc7bbbb0 BUG: 1101647 Signed-off-by: Ravishankar N <ravishankar@redhat.com> Reviewed-on: http://review.gluster.org/7897 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
-rw-r--r--tests/bugs/bug-1101647.t29
-rw-r--r--tests/bugs/bug-874498.t2
-rw-r--r--tests/bugs/bug-957877.t2
-rw-r--r--xlators/features/index/src/index.c4
4 files changed, 35 insertions, 2 deletions
diff --git a/tests/bugs/bug-1101647.t b/tests/bugs/bug-1101647.t
new file mode 100644
index 00000000000..ccfa7e2138b
--- /dev/null
+++ b/tests/bugs/bug-1101647.t
@@ -0,0 +1,29 @@
+#!/bin/bash
+
+. $(dirname $0)/../include.rc
+. $(dirname $0)/../volume.rc
+. $(dirname $0)/../afr.rc
+
+cleanup;
+
+TEST glusterd
+TEST pidof glusterd
+TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{1,2};
+TEST $CLI volume start $V0;
+TEST glusterfs --volfile-id=/$V0 --volfile-server=$H0 $M0 --attribute-timeout=0 --entry-timeout=0
+EXPECT_WITHIN 20 "Y" glustershd_up_status
+
+#Create base entry in indices/xattrop and indices/base_indices_holder
+echo "Data">$M0/file
+
+TEST $CLI volume heal $V0
+#Entries from indices/xattrop and indices/base_indices_holder should not be cleared after a heal.
+EXPECT 1 count_sh_entries $B0/$V0"1"
+EXPECT 1 count_sh_entries $B0/$V0"2"
+
+TEST kill_brick $V0 $H0 $B0/${V0}2
+echo "More data">>$M0/file
+
+EXPECT 1 echo `$CLI volume heal $V0 statistics heal-count|grep "Number of entries:"|head -n1|awk '{print $4}'`
+
+cleanup;
diff --git a/tests/bugs/bug-874498.t b/tests/bugs/bug-874498.t
index 0b5991011d4..c48e508578b 100644
--- a/tests/bugs/bug-874498.t
+++ b/tests/bugs/bug-874498.t
@@ -53,7 +53,7 @@ TEST $CLI volume heal $V0
##Expected number of entries are 0 in the .glusterfs/indices/xattrop directory
-EXPECT_WITHIN 60 '0' count_sh_entries $FILEN;
+EXPECT_WITHIN 60 '1' count_sh_entries $FILEN;
TEST $CLI volume stop $V0;
TEST $CLI volume delete $V0;
diff --git a/tests/bugs/bug-957877.t b/tests/bugs/bug-957877.t
index 23aefea2549..898de642fb1 100644
--- a/tests/bugs/bug-957877.t
+++ b/tests/bugs/bug-957877.t
@@ -21,7 +21,7 @@ sleep 5
TEST $CLI volume heal $V0
# Wait for self-heal to complete
-EXPECT_WITHIN 30 '0' count_sh_entries $BRICK;
+EXPECT_WITHIN 30 '1' count_sh_entries $BRICK;
TEST getfattr -n "user.foo" $B0/${V0}0/f1;
diff --git a/xlators/features/index/src/index.c b/xlators/features/index/src/index.c
index 9fa32129eb5..7f3c085da7a 100644
--- a/xlators/features/index/src/index.c
+++ b/xlators/features/index/src/index.c
@@ -253,6 +253,10 @@ check_delete_stale_index_file (xlator_t *this, char *filename)
if (priv->to_be_healed_states != synced_state)
return;
+ /*Don't delete the index if is the current xattrop index*/
+ if (!strcmp (&filename[8], uuid_utoa (priv->index)))
+ return;
+
make_file_path (priv->index_basepath, XATTROP_SUBDIR,
filename, filepath, sizeof (filepath));