summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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.c13
4 files changed, 44 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 fa74115960f..9337e6dc680 100644
--- a/tests/bugs/bug-874498.t
+++ b/tests/bugs/bug-874498.t
@@ -56,7 +56,7 @@ TEST $CLI volume heal $V0
##Expected number of entries are 0 in the .glusterfs/indices/xattrop directory
-EXPECT_WITHIN $HEAL_TIMEOUT '0' count_sh_entries $FILEN;
+EXPECT_WITHIN $HEAL_TIMEOUT '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 90836679de9..52bbd62ec2a 100644
--- a/tests/bugs/bug-957877.t
+++ b/tests/bugs/bug-957877.t
@@ -23,7 +23,7 @@ EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 1
TEST $CLI volume heal $V0
# Wait for self-heal to complete
-EXPECT_WITHIN $HEAL_TIMEOUT '0' count_sh_entries $BRICK;
+EXPECT_WITHIN $HEAL_TIMEOUT '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 4b2eb2e29ba..2b80e718607 100644
--- a/xlators/features/index/src/index.c
+++ b/xlators/features/index/src/index.c
@@ -238,6 +238,15 @@ make_file_path (char *base, const char *subdir, const char *filename,
"/%s", filename);
}
+static int
+is_index_file_current (char *filename, uuid_t priv_index)
+{
+ char *current_index = alloca (strlen ("xattrop-") + GF_UUID_BUF_SIZE);
+
+ sprintf (current_index, "xattrop-%s", uuid_utoa(priv_index));
+ return (!strcmp(filename, current_index));
+}
+
static void
check_delete_stale_index_file (xlator_t *this, char *filename)
{
@@ -247,6 +256,10 @@ check_delete_stale_index_file (xlator_t *this, char *filename)
index_priv_t *priv = NULL;
priv = this->private;
+
+ if (is_index_file_current (filename, priv->index))
+ return;
+
make_file_path (priv->index_basepath, XATTROP_SUBDIR,
filename, filepath, sizeof (filepath));
ret = stat (filepath, &st);