|
|
b7d4d7 |
From 0502383024cbf7e4776816e0a992dccc484a3cf2 Mon Sep 17 00:00:00 2001
|
|
|
b7d4d7 |
From: Ravishankar N <ravishankar@redhat.com>
|
|
|
b7d4d7 |
Date: Tue, 8 Dec 2020 17:23:22 +0530
|
|
|
b7d4d7 |
Subject: [PATCH 488/511] glusterd/afr: enable granular-entry-heal by default
|
|
|
b7d4d7 |
|
|
|
b7d4d7 |
XXXXXXXXXXXXXXXXXXX
|
|
|
b7d4d7 |
IMPORTANT:
|
|
|
b7d4d7 |
XXXXXXXXXXXXXXXXXXXX
|
|
|
b7d4d7 |
I see that for rhgs-3.5.3, GD_OP_VERSION_MAX is GD_OP_VERSION_7_0. Since
|
|
|
b7d4d7 |
this patch should only act on new volumes in rhgs-3.5.4, I am bumping
|
|
|
b7d4d7 |
the op-version to GD_OP_VERSION_7_1. In glusterfs upstream, the patch
|
|
|
b7d4d7 |
acts only if op-version >= GD_OP_VERSION_9_0 as seen in the commit
|
|
|
b7d4d7 |
messae below.
|
|
|
b7d4d7 |
|
|
|
b7d4d7 |
Upstream patch details:
|
|
|
b7d4d7 |
/------------------------------------------------------------------------------/
|
|
|
b7d4d7 |
1. The option has been enabled and tested for quite some time now in RHHI-V
|
|
|
b7d4d7 |
downstream and I think it is safe to make it 'on' by default. Since it
|
|
|
b7d4d7 |
is not possible to simply change it from 'off' to 'on' without breaking
|
|
|
b7d4d7 |
rolling upgrades, old clients etc., I have made it default only for new volumes
|
|
|
b7d4d7 |
starting from op-verison GD_OP_VERSION_9_0.
|
|
|
b7d4d7 |
|
|
|
b7d4d7 |
Note: If you do a volume reset, the option will be turned back off.
|
|
|
b7d4d7 |
This is okay as the dir's gfid will be captured in 'xattrop' folder and heals
|
|
|
b7d4d7 |
will proceed. There might be stale entries inside entry-changes' folder,
|
|
|
b7d4d7 |
which will be removed when we enable the option again.
|
|
|
b7d4d7 |
|
|
|
b7d4d7 |
2. I encountered a cust. issue where entry heal was pending on a dir. with
|
|
|
b7d4d7 |
236436 files in it and the glustershd.log output was just stuck at
|
|
|
b7d4d7 |
"performing entry selfheal", so I have added logs to give us
|
|
|
b7d4d7 |
more info in DEBUG level about whether entry heal and data heal are
|
|
|
b7d4d7 |
progressing (metadata heal doesn't take much time). That way, we have a
|
|
|
b7d4d7 |
quick visual indication to say things are not 'stuck' if we briefly
|
|
|
b7d4d7 |
enable debug logs, instead of taking statedumps or checking profile info
|
|
|
b7d4d7 |
etc.
|
|
|
b7d4d7 |
|
|
|
b7d4d7 |
>Fixes: #1483
|
|
|
b7d4d7 |
>Change-Id: I4f116f8c92f8cd33f209b758ff14f3c7e1981422
|
|
|
b7d4d7 |
>Signed-off-by: Ravishankar N <ravishankar@redhat.com>
|
|
|
b7d4d7 |
Upstream Patch: https://github.com/gluster/glusterfs/pull/1621
|
|
|
b7d4d7 |
/------------------------------------------------------------------------------/
|
|
|
b7d4d7 |
|
|
|
b7d4d7 |
BUG: 1890506
|
|
|
b7d4d7 |
Change-Id: If449a1e873633616cfc508d74b5c22eb434b55ae
|
|
|
b7d4d7 |
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
|
|
|
b7d4d7 |
Reviewed-on: https://code.engineering.redhat.com/gerrit/220555
|
|
|
b7d4d7 |
Tested-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
b7d4d7 |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
b7d4d7 |
---
|
|
|
b7d4d7 |
libglusterfs/src/glusterfs/globals.h | 4 +-
|
|
|
b7d4d7 |
libglusterfs/src/syncop-utils.c | 4 +-
|
|
|
b7d4d7 |
tests/basic/afr/add-brick-self-heal-non-granular.t | 75 +++++++++++++
|
|
|
b7d4d7 |
tests/basic/afr/add-brick-self-heal.t | 4 +-
|
|
|
b7d4d7 |
tests/basic/afr/bug-1130892-non-granular.t | 77 ++++++++++++++
|
|
|
b7d4d7 |
.../basic/afr/bug-1493415-gfid-heal-non-granular.t | 79 ++++++++++++++
|
|
|
b7d4d7 |
...507-type-mismatch-error-handling-non-granular.t | 117 +++++++++++++++++++++
|
|
|
b7d4d7 |
...1749322-entry-heal-not-happening-non-granular.t | 90 ++++++++++++++++
|
|
|
b7d4d7 |
.../afr/replace-brick-self-heal-non-granular.t | 65 ++++++++++++
|
|
|
b7d4d7 |
tests/basic/afr/replace-brick-self-heal.t | 2 +-
|
|
|
b7d4d7 |
tests/bugs/replicate/bug-1130892.t | 2 +-
|
|
|
b7d4d7 |
tests/bugs/replicate/bug-1493415-gfid-heal.t | 2 +-
|
|
|
b7d4d7 |
.../bug-1722507-type-mismatch-error-handling.t | 26 +++--
|
|
|
b7d4d7 |
.../bug-1749322-entry-heal-not-happening.t | 7 +-
|
|
|
b7d4d7 |
xlators/cluster/afr/src/afr-self-heal-common.c | 5 +
|
|
|
b7d4d7 |
xlators/cluster/afr/src/afr-self-heal-data.c | 3 +
|
|
|
b7d4d7 |
xlators/cluster/afr/src/afr-self-heal-entry.c | 7 +-
|
|
|
b7d4d7 |
xlators/mgmt/glusterd/src/glusterd-utils.c | 13 +++
|
|
|
b7d4d7 |
18 files changed, 558 insertions(+), 24 deletions(-)
|
|
|
b7d4d7 |
create mode 100644 tests/basic/afr/add-brick-self-heal-non-granular.t
|
|
|
b7d4d7 |
create mode 100644 tests/basic/afr/bug-1130892-non-granular.t
|
|
|
b7d4d7 |
create mode 100644 tests/basic/afr/bug-1493415-gfid-heal-non-granular.t
|
|
|
b7d4d7 |
create mode 100644 tests/basic/afr/bug-1722507-type-mismatch-error-handling-non-granular.t
|
|
|
b7d4d7 |
create mode 100644 tests/basic/afr/bug-1749322-entry-heal-not-happening-non-granular.t
|
|
|
b7d4d7 |
create mode 100644 tests/basic/afr/replace-brick-self-heal-non-granular.t
|
|
|
b7d4d7 |
|
|
|
b7d4d7 |
diff --git a/libglusterfs/src/glusterfs/globals.h b/libglusterfs/src/glusterfs/globals.h
|
|
|
b7d4d7 |
index 31717ed..cc145cd 100644
|
|
|
b7d4d7 |
--- a/libglusterfs/src/glusterfs/globals.h
|
|
|
b7d4d7 |
+++ b/libglusterfs/src/glusterfs/globals.h
|
|
|
b7d4d7 |
@@ -50,7 +50,7 @@
|
|
|
b7d4d7 |
1 /* MIN is the fresh start op-version, mostly \
|
|
|
b7d4d7 |
should not change */
|
|
|
b7d4d7 |
#define GD_OP_VERSION_MAX \
|
|
|
b7d4d7 |
- GD_OP_VERSION_7_0 /* MAX VERSION is the maximum \
|
|
|
b7d4d7 |
+ GD_OP_VERSION_7_1 /* MAX VERSION is the maximum \
|
|
|
b7d4d7 |
count in VME table, should \
|
|
|
b7d4d7 |
keep changing with \
|
|
|
b7d4d7 |
introduction of newer \
|
|
|
b7d4d7 |
@@ -138,6 +138,8 @@
|
|
|
b7d4d7 |
|
|
|
b7d4d7 |
#define GD_OP_VERSION_7_0 70000 /* Op-version for GlusterFS 7.0 */
|
|
|
b7d4d7 |
|
|
|
b7d4d7 |
+#define GD_OP_VERSION_7_1 70100 /* Op-version for GlusterFS 7.1 */
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
#include "glusterfs/xlator.h"
|
|
|
b7d4d7 |
#include "glusterfs/options.h"
|
|
|
b7d4d7 |
|
|
|
b7d4d7 |
diff --git a/libglusterfs/src/syncop-utils.c b/libglusterfs/src/syncop-utils.c
|
|
|
b7d4d7 |
index be03527..2269c76 100644
|
|
|
b7d4d7 |
--- a/libglusterfs/src/syncop-utils.c
|
|
|
b7d4d7 |
+++ b/libglusterfs/src/syncop-utils.c
|
|
|
b7d4d7 |
@@ -495,9 +495,7 @@ syncop_dir_scan(xlator_t *subvol, loc_t *loc, int pid, void *data,
|
|
|
b7d4d7 |
if (!strcmp(entry->d_name, ".") || !strcmp(entry->d_name, ".."))
|
|
|
b7d4d7 |
continue;
|
|
|
b7d4d7 |
|
|
|
b7d4d7 |
- ret = fn(subvol, entry, loc, data);
|
|
|
b7d4d7 |
- if (ret)
|
|
|
b7d4d7 |
- break;
|
|
|
b7d4d7 |
+ ret |= fn(subvol, entry, loc, data);
|
|
|
b7d4d7 |
}
|
|
|
b7d4d7 |
gf_dirent_free(&entries);
|
|
|
b7d4d7 |
if (ret)
|
|
|
b7d4d7 |
diff --git a/tests/basic/afr/add-brick-self-heal-non-granular.t b/tests/basic/afr/add-brick-self-heal-non-granular.t
|
|
|
b7d4d7 |
new file mode 100644
|
|
|
b7d4d7 |
index 0000000..19caf24
|
|
|
b7d4d7 |
--- /dev/null
|
|
|
b7d4d7 |
+++ b/tests/basic/afr/add-brick-self-heal-non-granular.t
|
|
|
b7d4d7 |
@@ -0,0 +1,75 @@
|
|
|
b7d4d7 |
+#!/bin/bash
|
|
|
b7d4d7 |
+. $(dirname $0)/../../include.rc
|
|
|
b7d4d7 |
+. $(dirname $0)/../../volume.rc
|
|
|
b7d4d7 |
+cleanup;
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+TEST glusterd
|
|
|
b7d4d7 |
+TEST pidof glusterd
|
|
|
b7d4d7 |
+TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0,1}
|
|
|
b7d4d7 |
+EXPECT 'Created' volinfo_field $V0 'Status';
|
|
|
b7d4d7 |
+TEST $CLI volume set $V0 cluster.granular-entry-heal off
|
|
|
b7d4d7 |
+TEST $CLI volume start $V0
|
|
|
b7d4d7 |
+EXPECT 'Started' volinfo_field $V0 'Status';
|
|
|
b7d4d7 |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}0
|
|
|
b7d4d7 |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}1
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+TEST $CLI volume set $V0 cluster.data-self-heal off
|
|
|
b7d4d7 |
+TEST $CLI volume set $V0 cluster.metadata-self-heal off
|
|
|
b7d4d7 |
+TEST $CLI volume set $V0 cluster.entry-self-heal off
|
|
|
b7d4d7 |
+TEST $CLI volume set $V0 cluster.heal-timeout 5
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+TEST $CLI volume set $V0 self-heal-daemon off
|
|
|
b7d4d7 |
+TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0;
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Create files
|
|
|
b7d4d7 |
+for i in {1..5}
|
|
|
b7d4d7 |
+do
|
|
|
b7d4d7 |
+ echo $i > $M0/file$i.txt
|
|
|
b7d4d7 |
+done
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Metadata changes
|
|
|
b7d4d7 |
+TEST setfattr -n user.test -v qwerty $M0/file5.txt
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Add brick1
|
|
|
b7d4d7 |
+TEST $CLI volume add-brick $V0 replica 3 $H0:$B0/${V0}2
|
|
|
b7d4d7 |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}2
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# New-brick should accuse the old-bricks (Simulating case for data-loss)
|
|
|
b7d4d7 |
+TEST setfattr -n trusted.afr.$V0-client-0 -v 0x000000000000000000000001 $B0/${V0}2/
|
|
|
b7d4d7 |
+TEST setfattr -n trusted.afr.$V0-client-1 -v 0x000000000000000000000001 $B0/${V0}2/
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Check if pending xattr and dirty-xattr are set for newly-added-brick
|
|
|
b7d4d7 |
+EXPECT "000000000000000100000001" get_hex_xattr trusted.afr.$V0-client-2 $B0/${V0}0
|
|
|
b7d4d7 |
+EXPECT "000000000000000100000001" get_hex_xattr trusted.afr.$V0-client-2 $B0/${V0}1
|
|
|
b7d4d7 |
+EXPECT "000000000000000000000001" get_hex_xattr trusted.afr.dirty $B0/${V0}2
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" afr_child_up_status $V0 0
|
|
|
b7d4d7 |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" afr_child_up_status $V0 1
|
|
|
b7d4d7 |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" afr_child_up_status $V0 2
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+TEST $CLI volume set $V0 self-heal-daemon on
|
|
|
b7d4d7 |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "Y" glustershd_up_status
|
|
|
b7d4d7 |
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 0
|
|
|
b7d4d7 |
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 1
|
|
|
b7d4d7 |
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 2
|
|
|
b7d4d7 |
+TEST $CLI volume heal $V0
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Wait for heal to complete
|
|
|
b7d4d7 |
+EXPECT_WITHIN $HEAL_TIMEOUT "^0$" get_pending_heal_count $V0
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Check if entry-heal has happened
|
|
|
b7d4d7 |
+TEST diff <(ls $B0/${V0}0 | sort) <(ls $B0/${V0}2 | sort)
|
|
|
b7d4d7 |
+TEST diff <(ls $B0/${V0}1 | sort) <(ls $B0/${V0}2 | sort)
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Test if data was healed
|
|
|
b7d4d7 |
+TEST diff $B0/${V0}0/file1.txt $B0/${V0}2/file1.txt
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Test if metadata was healed and exists on both the bricks
|
|
|
b7d4d7 |
+EXPECT "qwerty" get_text_xattr user.test $B0/${V0}2/file5.txt
|
|
|
b7d4d7 |
+EXPECT "qwerty" get_text_xattr user.test $B0/${V0}0/file5.txt
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+EXPECT "000000000000000000000000" get_hex_xattr trusted.afr.$V0-client-2 $B0/${V0}0
|
|
|
b7d4d7 |
+EXPECT "000000000000000000000000" get_hex_xattr trusted.afr.$V0-client-2 $B0/${V0}1
|
|
|
b7d4d7 |
+EXPECT "000000000000000000000000" get_hex_xattr trusted.afr.dirty $B0/${V0}2
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+cleanup;
|
|
|
b7d4d7 |
diff --git a/tests/basic/afr/add-brick-self-heal.t b/tests/basic/afr/add-brick-self-heal.t
|
|
|
b7d4d7 |
index c847e22..7ebf4f6 100644
|
|
|
b7d4d7 |
--- a/tests/basic/afr/add-brick-self-heal.t
|
|
|
b7d4d7 |
+++ b/tests/basic/afr/add-brick-self-heal.t
|
|
|
b7d4d7 |
@@ -38,8 +38,8 @@ TEST setfattr -n trusted.afr.$V0-client-0 -v 0x000000000000000000000001 $B0/${V0
|
|
|
b7d4d7 |
TEST setfattr -n trusted.afr.$V0-client-1 -v 0x000000000000000000000001 $B0/${V0}2/
|
|
|
b7d4d7 |
|
|
|
b7d4d7 |
# Check if pending xattr and dirty-xattr are set for newly-added-brick
|
|
|
b7d4d7 |
-EXPECT "000000000000000100000001" get_hex_xattr trusted.afr.$V0-client-2 $B0/${V0}0
|
|
|
b7d4d7 |
-EXPECT "000000000000000100000001" get_hex_xattr trusted.afr.$V0-client-2 $B0/${V0}1
|
|
|
b7d4d7 |
+EXPECT "000000010000000100000001" get_hex_xattr trusted.afr.$V0-client-2 $B0/${V0}0
|
|
|
b7d4d7 |
+EXPECT "000000010000000100000001" get_hex_xattr trusted.afr.$V0-client-2 $B0/${V0}1
|
|
|
b7d4d7 |
EXPECT "000000000000000000000001" get_hex_xattr trusted.afr.dirty $B0/${V0}2
|
|
|
b7d4d7 |
|
|
|
b7d4d7 |
EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" afr_child_up_status $V0 0
|
|
|
b7d4d7 |
diff --git a/tests/basic/afr/bug-1130892-non-granular.t b/tests/basic/afr/bug-1130892-non-granular.t
|
|
|
b7d4d7 |
new file mode 100644
|
|
|
b7d4d7 |
index 0000000..3cdbc7d
|
|
|
b7d4d7 |
--- /dev/null
|
|
|
b7d4d7 |
+++ b/tests/basic/afr/bug-1130892-non-granular.t
|
|
|
b7d4d7 |
@@ -0,0 +1,77 @@
|
|
|
b7d4d7 |
+#!/bin/bash
|
|
|
b7d4d7 |
+. $(dirname $0)/../../include.rc
|
|
|
b7d4d7 |
+. $(dirname $0)/../../volume.rc
|
|
|
b7d4d7 |
+. $(dirname $0)/../../afr.rc
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+cleanup;
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+TEST glusterd
|
|
|
b7d4d7 |
+TEST pidof glusterd
|
|
|
b7d4d7 |
+TEST $CLI volume info;
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Create a 1X2 replica
|
|
|
b7d4d7 |
+TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}-{0,1}
|
|
|
b7d4d7 |
+EXPECT 'Created' volinfo_field $V0 'Status';
|
|
|
b7d4d7 |
+TEST $CLI volume set $V0 cluster.granular-entry-heal off
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Disable self-heal daemon
|
|
|
b7d4d7 |
+TEST gluster volume set $V0 self-heal-daemon off
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Enable Client side heal
|
|
|
b7d4d7 |
+TEST $CLI volume set $V0 cluster.data-self-heal off
|
|
|
b7d4d7 |
+TEST $CLI volume set $V0 cluster.metadata-self-heal off
|
|
|
b7d4d7 |
+TEST $CLI volume set $V0 cluster.entry-self-heal off
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Disable all perf-xlators
|
|
|
b7d4d7 |
+TEST $CLI volume set $V0 performance.quick-read off
|
|
|
b7d4d7 |
+TEST $CLI volume set $V0 performance.io-cache off
|
|
|
b7d4d7 |
+TEST $CLI volume set $V0 performance.write-behind off
|
|
|
b7d4d7 |
+TEST $CLI volume set $V0 performance.stat-prefetch off
|
|
|
b7d4d7 |
+TEST $CLI volume set $V0 performance.read-ahead off
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Volume start
|
|
|
b7d4d7 |
+TEST $CLI volume start $V0;
|
|
|
b7d4d7 |
+EXPECT 'Started' volinfo_field $V0 'Status';
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# FUSE Mount
|
|
|
b7d4d7 |
+TEST ${GFS} -s $H0 --volfile-id $V0 $M0
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Create files and dirs
|
|
|
b7d4d7 |
+TEST mkdir -p $M0/one/two/
|
|
|
b7d4d7 |
+TEST `echo "Carpe diem" > $M0/one/two/three`
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Simulate disk-replacement
|
|
|
b7d4d7 |
+TEST kill_brick $V0 $H0 $B0/${V0}-1
|
|
|
b7d4d7 |
+EXPECT_WITHIN ${PROCESS_DOWN_TIMEOUT} "^0$" afr_child_up_status $V0 1
|
|
|
b7d4d7 |
+TEST rm -rf $B0/${V0}-1/one
|
|
|
b7d4d7 |
+TEST rm -rf $B0/${V0}-1/.glusterfs
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+#Ideally, disk replacement is done using reset-brick or replace-brick gluster CLI
|
|
|
b7d4d7 |
+#which will create .glusterfs folder.
|
|
|
b7d4d7 |
+mkdir $B0/${V0}-1/.glusterfs && chmod 600 $B0/${V0}-1/.glusterfs
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Start force
|
|
|
b7d4d7 |
+TEST $CLI volume start $V0 force
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status $V0 1
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+TEST stat $M0/one
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+sleep 1
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Check pending xattrs
|
|
|
b7d4d7 |
+EXPECT "00000000" afr_get_specific_changelog_xattr $B0/${V0}-0/one trusted.afr.$V0-client-1 data
|
|
|
b7d4d7 |
+EXPECT_NOT "00000000" afr_get_specific_changelog_xattr $B0/${V0}-0/one trusted.afr.$V0-client-1 entry
|
|
|
b7d4d7 |
+EXPECT_NOT "00000000" afr_get_specific_changelog_xattr $B0/${V0}-0/one trusted.afr.$V0-client-1 metadata
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+TEST gluster volume set $V0 self-heal-daemon on
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "Y" glustershd_up_status
|
|
|
b7d4d7 |
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 0
|
|
|
b7d4d7 |
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 1
|
|
|
b7d4d7 |
+TEST $CLI volume heal $V0
|
|
|
b7d4d7 |
+EXPECT_WITHIN $HEAL_TIMEOUT "Y" is_dir_heal_done $B0/${V0}-0 $B0/${V0}-1 one
|
|
|
b7d4d7 |
+EXPECT_WITHIN $HEAL_TIMEOUT "Y" is_dir_heal_done $B0/${V0}-0 $B0/${V0}-1 one/two
|
|
|
b7d4d7 |
+EXPECT_WITHIN $HEAL_TIMEOUT "Y" is_file_heal_done $B0/${V0}-0 $B0/${V0}-1 one/two/three
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+cleanup;
|
|
|
b7d4d7 |
diff --git a/tests/basic/afr/bug-1493415-gfid-heal-non-granular.t b/tests/basic/afr/bug-1493415-gfid-heal-non-granular.t
|
|
|
b7d4d7 |
new file mode 100644
|
|
|
b7d4d7 |
index 0000000..aff001c
|
|
|
b7d4d7 |
--- /dev/null
|
|
|
b7d4d7 |
+++ b/tests/basic/afr/bug-1493415-gfid-heal-non-granular.t
|
|
|
b7d4d7 |
@@ -0,0 +1,79 @@
|
|
|
b7d4d7 |
+#!/bin/bash
|
|
|
b7d4d7 |
+. $(dirname $0)/../../include.rc
|
|
|
b7d4d7 |
+. $(dirname $0)/../../volume.rc
|
|
|
b7d4d7 |
+. $(dirname $0)/../../afr.rc
|
|
|
b7d4d7 |
+cleanup;
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+TEST glusterd
|
|
|
b7d4d7 |
+TEST pidof glusterd
|
|
|
b7d4d7 |
+TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0,1}
|
|
|
b7d4d7 |
+TEST $CLI volume set $V0 cluster.granular-entry-heal off
|
|
|
b7d4d7 |
+TEST $CLI volume start $V0
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+TEST $GFS --volfile-id=$V0 --volfile-server=$H0 --attribute-timeout=0 --entry-timeout=0 $M0;
|
|
|
b7d4d7 |
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status $V0 0
|
|
|
b7d4d7 |
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status $V0 1
|
|
|
b7d4d7 |
+TEST $CLI volume set $V0 self-heal-daemon off
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Create base entry in indices/xattrop
|
|
|
b7d4d7 |
+echo "Data" > $M0/FILE
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+#------------------------------------------------------------------------------#
|
|
|
b7d4d7 |
+TEST touch $M0/f1
|
|
|
b7d4d7 |
+gfid_f1=$(gf_get_gfid_xattr $B0/${V0}0/f1)
|
|
|
b7d4d7 |
+gfid_str_f1=$(gf_gfid_xattr_to_str $gfid_f1)
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Remove gfid xattr and .glusterfs hard link from 2nd brick. This simulates a
|
|
|
b7d4d7 |
+# brick crash at the point where file got created but no xattrs were set.
|
|
|
b7d4d7 |
+TEST setfattr -x trusted.gfid $B0/${V0}1/f1
|
|
|
b7d4d7 |
+TEST rm $B0/${V0}1/.glusterfs/${gfid_str_f1:0:2}/${gfid_str_f1:2:2}/$gfid_str_f1
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# storage/posix considers that a file without gfid changed less than a second
|
|
|
b7d4d7 |
+# before doesn't exist, so we need to wait for a second to force posix to
|
|
|
b7d4d7 |
+# consider that this is a valid file but without gfid.
|
|
|
b7d4d7 |
+sleep 2
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Assume there were no pending xattrs on parent dir due to 1st brick crashing
|
|
|
b7d4d7 |
+# too. Then name heal from client must heal the gfid.
|
|
|
b7d4d7 |
+EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0
|
|
|
b7d4d7 |
+TEST $GFS --volfile-id=$V0 --volfile-server=$H0 --attribute-timeout=0 --entry-timeout=0 $M0;
|
|
|
b7d4d7 |
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status $V0 0
|
|
|
b7d4d7 |
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status $V0 1
|
|
|
b7d4d7 |
+TEST stat $M0/f1
|
|
|
b7d4d7 |
+EXPECT "$gfid_f1" gf_get_gfid_xattr $B0/${V0}1/f1
|
|
|
b7d4d7 |
+TEST stat $B0/${V0}1/.glusterfs/${gfid_str_f1:0:2}/${gfid_str_f1:2:2}/$gfid_str_f1
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+#------------------------------------------------------------------------------#
|
|
|
b7d4d7 |
+TEST mkdir $M0/dir
|
|
|
b7d4d7 |
+TEST touch $M0/dir/f2
|
|
|
b7d4d7 |
+gfid_f2=$(gf_get_gfid_xattr $B0/${V0}0/dir/f2)
|
|
|
b7d4d7 |
+gfid_str_f2=$(gf_gfid_xattr_to_str $gfid_f2)
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Remove gfid xattr and .glusterfs hard link from 2nd brick. This simulates a
|
|
|
b7d4d7 |
+# brick crash at the point where file got created but no xattrs were set.
|
|
|
b7d4d7 |
+TEST setfattr -x trusted.gfid $B0/${V0}1/dir/f2
|
|
|
b7d4d7 |
+TEST rm $B0/${V0}1/.glusterfs/${gfid_str_f2:0:2}/${gfid_str_f2:2:2}/$gfid_str_f2
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+#Now simulate setting of pending entry xattr on parent dir of 1st brick.
|
|
|
b7d4d7 |
+TEST setfattr -n trusted.afr.$V0-client-1 -v 0x000000000000000000000001 $B0/${V0}0/dir
|
|
|
b7d4d7 |
+create_brick_xattrop_entry $B0/${V0}0 dir
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# storage/posix considers that a file without gfid changed less than a second
|
|
|
b7d4d7 |
+# before doesn't exist, so we need to wait for a second to force posix to
|
|
|
b7d4d7 |
+# consider that this is a valid file but without gfid.
|
|
|
b7d4d7 |
+sleep 2
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+#Trigger entry-heal via shd
|
|
|
b7d4d7 |
+TEST $CLI volume set $V0 self-heal-daemon on
|
|
|
b7d4d7 |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "Y" glustershd_up_status
|
|
|
b7d4d7 |
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 0
|
|
|
b7d4d7 |
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 1
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+TEST $CLI volume heal $V0
|
|
|
b7d4d7 |
+EXPECT_WITHIN $HEAL_TIMEOUT "^0$" get_pending_heal_count $V0
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+EXPECT "$gfid_f2" gf_get_gfid_xattr $B0/${V0}1/dir/f2
|
|
|
b7d4d7 |
+TEST stat $B0/${V0}1/.glusterfs/${gfid_str_f2:0:2}/${gfid_str_f2:2:2}/$gfid_str_f2
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+#------------------------------------------------------------------------------#
|
|
|
b7d4d7 |
+cleanup;
|
|
|
b7d4d7 |
diff --git a/tests/basic/afr/bug-1722507-type-mismatch-error-handling-non-granular.t b/tests/basic/afr/bug-1722507-type-mismatch-error-handling-non-granular.t
|
|
|
b7d4d7 |
new file mode 100644
|
|
|
b7d4d7 |
index 0000000..9079c93
|
|
|
b7d4d7 |
--- /dev/null
|
|
|
b7d4d7 |
+++ b/tests/basic/afr/bug-1722507-type-mismatch-error-handling-non-granular.t
|
|
|
b7d4d7 |
@@ -0,0 +1,117 @@
|
|
|
b7d4d7 |
+#!/bin/bash
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+. $(dirname $0)/../../include.rc
|
|
|
b7d4d7 |
+. $(dirname $0)/../../volume.rc
|
|
|
b7d4d7 |
+. $(dirname $0)/../../afr.rc
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+cleanup;
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+## Start and create a volume
|
|
|
b7d4d7 |
+TEST glusterd;
|
|
|
b7d4d7 |
+TEST pidof glusterd;
|
|
|
b7d4d7 |
+TEST $CLI volume info;
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+TEST $CLI volume create $V0 replica 3 $H0:$B0/${V0}{0,1,2};
|
|
|
b7d4d7 |
+TEST $CLI volume set $V0 cluster.granular-entry-heal off
|
|
|
b7d4d7 |
+TEST $CLI volume start $V0;
|
|
|
b7d4d7 |
+TEST $CLI volume set $V0 cluster.heal-timeout 5
|
|
|
b7d4d7 |
+TEST $CLI volume heal $V0 disable
|
|
|
b7d4d7 |
+EXPECT 'Started' volinfo_field $V0 'Status';
|
|
|
b7d4d7 |
+TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+TEST mkdir $M0/dir
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+##########################################################################################
|
|
|
b7d4d7 |
+# GFID link file and the GFID is missing on one brick and all the bricks are being blamed.
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+TEST touch $M0/dir/file
|
|
|
b7d4d7 |
+TEST `echo append>> $M0/dir/file`
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+#B0 and B2 must blame B1
|
|
|
b7d4d7 |
+setfattr -n trusted.afr.$V0-client-0 -v 0x000000000000000000000001 $B0/$V0"2"/dir
|
|
|
b7d4d7 |
+setfattr -n trusted.afr.$V0-client-1 -v 0x000000000000000000000001 $B0/$V0"0"/dir
|
|
|
b7d4d7 |
+setfattr -n trusted.afr.$V0-client-2 -v 0x000000000000000000000001 $B0/$V0"0"/dir
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Add entry to xattrop dir to trigger index heal.
|
|
|
b7d4d7 |
+xattrop_dir0=$(afr_get_index_path $B0/$V0"0")
|
|
|
b7d4d7 |
+base_entry_b0=`ls $xattrop_dir0`
|
|
|
b7d4d7 |
+gfid_str=$(gf_gfid_xattr_to_str $(gf_get_gfid_xattr $B0/$V0"0"/dir/))
|
|
|
b7d4d7 |
+ln $xattrop_dir0/$base_entry_b0 $xattrop_dir0/$gfid_str
|
|
|
b7d4d7 |
+EXPECT "^1$" get_pending_heal_count $V0
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Remove the gfid xattr and the link file on one brick.
|
|
|
b7d4d7 |
+gfid_file=$(gf_get_gfid_xattr $B0/$V0"0"/dir/file)
|
|
|
b7d4d7 |
+gfid_str_file=$(gf_gfid_xattr_to_str $gfid_file)
|
|
|
b7d4d7 |
+TEST setfattr -x trusted.gfid $B0/${V0}0/dir/file
|
|
|
b7d4d7 |
+TEST rm -f $B0/${V0}0/.glusterfs/${gfid_str_file:0:2}/${gfid_str_file:2:2}/$gfid_str_file
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Launch heal
|
|
|
b7d4d7 |
+TEST $CLI volume heal $V0 enable
|
|
|
b7d4d7 |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^Y$" glustershd_up_status
|
|
|
b7d4d7 |
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "^1$" afr_child_up_status_in_shd $V0 0
|
|
|
b7d4d7 |
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "^1$" afr_child_up_status_in_shd $V0 1
|
|
|
b7d4d7 |
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "^1$" afr_child_up_status_in_shd $V0 2
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Wait for 2 second to force posix to consider that this is a valid file but
|
|
|
b7d4d7 |
+# without gfid.
|
|
|
b7d4d7 |
+sleep 2
|
|
|
b7d4d7 |
+TEST $CLI volume heal $V0
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Heal should not fail as the file is missing gfid xattr and the link file,
|
|
|
b7d4d7 |
+# which is not actually the gfid or type mismatch.
|
|
|
b7d4d7 |
+EXPECT_WITHIN $HEAL_TIMEOUT "^0$" get_pending_heal_count $V0
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+EXPECT "$gfid_file" gf_get_gfid_xattr $B0/${V0}0/dir/file
|
|
|
b7d4d7 |
+TEST stat $B0/${V0}0/.glusterfs/${gfid_str_file:0:2}/${gfid_str_file:2:2}/$gfid_str_file
|
|
|
b7d4d7 |
+rm -f $M0/dir/file
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+###########################################################################################
|
|
|
b7d4d7 |
+# GFID link file and the GFID is missing on two bricks and all the bricks are being blamed.
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+TEST $CLI volume heal $V0 disable
|
|
|
b7d4d7 |
+TEST touch $M0/dir/file
|
|
|
b7d4d7 |
+#TEST kill_brick $V0 $H0 $B0/$V0"1"
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+#B0 and B2 must blame B1
|
|
|
b7d4d7 |
+setfattr -n trusted.afr.$V0-client-0 -v 0x000000000000000000000001 $B0/$V0"2"/dir
|
|
|
b7d4d7 |
+setfattr -n trusted.afr.$V0-client-1 -v 0x000000000000000000000001 $B0/$V0"0"/dir
|
|
|
b7d4d7 |
+setfattr -n trusted.afr.$V0-client-2 -v 0x000000000000000000000001 $B0/$V0"0"/dir
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Add entry to xattrop dir to trigger index heal.
|
|
|
b7d4d7 |
+xattrop_dir0=$(afr_get_index_path $B0/$V0"0")
|
|
|
b7d4d7 |
+base_entry_b0=`ls $xattrop_dir0`
|
|
|
b7d4d7 |
+gfid_str=$(gf_gfid_xattr_to_str $(gf_get_gfid_xattr $B0/$V0"0"/dir/))
|
|
|
b7d4d7 |
+ln $xattrop_dir0/$base_entry_b0 $xattrop_dir0/$gfid_str
|
|
|
b7d4d7 |
+EXPECT "^1$" get_pending_heal_count $V0
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Remove the gfid xattr and the link file on two bricks.
|
|
|
b7d4d7 |
+gfid_file=$(gf_get_gfid_xattr $B0/$V0"0"/dir/file)
|
|
|
b7d4d7 |
+gfid_str_file=$(gf_gfid_xattr_to_str $gfid_file)
|
|
|
b7d4d7 |
+TEST setfattr -x trusted.gfid $B0/${V0}0/dir/file
|
|
|
b7d4d7 |
+TEST rm -f $B0/${V0}0/.glusterfs/${gfid_str_file:0:2}/${gfid_str_file:2:2}/$gfid_str_file
|
|
|
b7d4d7 |
+TEST setfattr -x trusted.gfid $B0/${V0}1/dir/file
|
|
|
b7d4d7 |
+TEST rm -f $B0/${V0}1/.glusterfs/${gfid_str_file:0:2}/${gfid_str_file:2:2}/$gfid_str_file
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Launch heal
|
|
|
b7d4d7 |
+TEST $CLI volume heal $V0 enable
|
|
|
b7d4d7 |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^Y$" glustershd_up_status
|
|
|
b7d4d7 |
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "^1$" afr_child_up_status_in_shd $V0 0
|
|
|
b7d4d7 |
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "^1$" afr_child_up_status_in_shd $V0 1
|
|
|
b7d4d7 |
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "^1$" afr_child_up_status_in_shd $V0 2
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Wait for 2 second to force posix to consider that this is a valid file but
|
|
|
b7d4d7 |
+# without gfid.
|
|
|
b7d4d7 |
+sleep 2
|
|
|
b7d4d7 |
+TEST $CLI volume heal $V0
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Heal should not fail as the file is missing gfid xattr and the link file,
|
|
|
b7d4d7 |
+# which is not actually the gfid or type mismatch.
|
|
|
b7d4d7 |
+EXPECT_WITHIN $HEAL_TIMEOUT "^0$" get_pending_heal_count $V0
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+EXPECT "$gfid_file" gf_get_gfid_xattr $B0/${V0}0/dir/file
|
|
|
b7d4d7 |
+TEST stat $B0/${V0}0/.glusterfs/${gfid_str_file:0:2}/${gfid_str_file:2:2}/$gfid_str_file
|
|
|
b7d4d7 |
+EXPECT "$gfid_file" gf_get_gfid_xattr $B0/${V0}1/dir/file
|
|
|
b7d4d7 |
+TEST stat $B0/${V0}1/.glusterfs/${gfid_str_file:0:2}/${gfid_str_file:2:2}/$gfid_str_file
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+cleanup
|
|
|
b7d4d7 |
diff --git a/tests/basic/afr/bug-1749322-entry-heal-not-happening-non-granular.t b/tests/basic/afr/bug-1749322-entry-heal-not-happening-non-granular.t
|
|
|
b7d4d7 |
new file mode 100644
|
|
|
b7d4d7 |
index 0000000..4f27da4
|
|
|
b7d4d7 |
--- /dev/null
|
|
|
b7d4d7 |
+++ b/tests/basic/afr/bug-1749322-entry-heal-not-happening-non-granular.t
|
|
|
b7d4d7 |
@@ -0,0 +1,90 @@
|
|
|
b7d4d7 |
+#!/bin/bash
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+. $(dirname $0)/../../include.rc
|
|
|
b7d4d7 |
+. $(dirname $0)/../../volume.rc
|
|
|
b7d4d7 |
+. $(dirname $0)/../../afr.rc
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+cleanup
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+function check_gfid_and_link_count
|
|
|
b7d4d7 |
+{
|
|
|
b7d4d7 |
+ local file=$1
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+ file_gfid_b0=$(gf_get_gfid_xattr $B0/${V0}0/$file)
|
|
|
b7d4d7 |
+ TEST [ ! -z $file_gfid_b0 ]
|
|
|
b7d4d7 |
+ file_gfid_b1=$(gf_get_gfid_xattr $B0/${V0}1/$file)
|
|
|
b7d4d7 |
+ file_gfid_b2=$(gf_get_gfid_xattr $B0/${V0}2/$file)
|
|
|
b7d4d7 |
+ EXPECT $file_gfid_b0 echo $file_gfid_b1
|
|
|
b7d4d7 |
+ EXPECT $file_gfid_b0 echo $file_gfid_b2
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+ EXPECT "2" stat -c %h $B0/${V0}0/$file
|
|
|
b7d4d7 |
+ EXPECT "2" stat -c %h $B0/${V0}1/$file
|
|
|
b7d4d7 |
+ EXPECT "2" stat -c %h $B0/${V0}2/$file
|
|
|
b7d4d7 |
+}
|
|
|
b7d4d7 |
+TESTS_EXPECTED_IN_LOOP=18
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+################################################################################
|
|
|
b7d4d7 |
+## Start and create a volume
|
|
|
b7d4d7 |
+TEST glusterd;
|
|
|
b7d4d7 |
+TEST pidof glusterd;
|
|
|
b7d4d7 |
+TEST $CLI volume info;
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+TEST $CLI volume create $V0 replica 3 $H0:$B0/${V0}{0,1,2};
|
|
|
b7d4d7 |
+TEST $CLI volume set $V0 cluster.granular-entry-heal off
|
|
|
b7d4d7 |
+TEST $CLI volume start $V0;
|
|
|
b7d4d7 |
+TEST $CLI volume set $V0 cluster.heal-timeout 5
|
|
|
b7d4d7 |
+TEST $CLI volume heal $V0 disable
|
|
|
b7d4d7 |
+EXPECT 'Started' volinfo_field $V0 'Status';
|
|
|
b7d4d7 |
+TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+TEST mkdir $M0/dir
|
|
|
b7d4d7 |
+TEST `echo "File 1 " > $M0/dir/file1`
|
|
|
b7d4d7 |
+TEST touch $M0/dir/file{2..4}
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Remove file2 from 1st & 3rd bricks
|
|
|
b7d4d7 |
+TEST rm -f $B0/$V0"0"/dir/file2
|
|
|
b7d4d7 |
+TEST rm -f $B0/$V0"2"/dir/file2
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Remove file3 and the .glusterfs hardlink from 1st & 2nd bricks
|
|
|
b7d4d7 |
+gfid_file3=$(gf_get_gfid_xattr $B0/$V0"0"/dir/file3)
|
|
|
b7d4d7 |
+gfid_str_file3=$(gf_gfid_xattr_to_str $gfid_file3)
|
|
|
b7d4d7 |
+TEST rm $B0/$V0"0"/.glusterfs/${gfid_str_file3:0:2}/${gfid_str_file3:2:2}/$gfid_str_file3
|
|
|
b7d4d7 |
+TEST rm $B0/$V0"1"/.glusterfs/${gfid_str_file3:0:2}/${gfid_str_file3:2:2}/$gfid_str_file3
|
|
|
b7d4d7 |
+TEST rm -f $B0/$V0"0"/dir/file3
|
|
|
b7d4d7 |
+TEST rm -f $B0/$V0"1"/dir/file3
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Remove the .glusterfs hardlink and the gfid xattr of file4 on 3rd brick
|
|
|
b7d4d7 |
+gfid_file4=$(gf_get_gfid_xattr $B0/$V0"0"/dir/file4)
|
|
|
b7d4d7 |
+gfid_str_file4=$(gf_gfid_xattr_to_str $gfid_file4)
|
|
|
b7d4d7 |
+TEST rm $B0/$V0"2"/.glusterfs/${gfid_str_file4:0:2}/${gfid_str_file4:2:2}/$gfid_str_file4
|
|
|
b7d4d7 |
+TEST setfattr -x trusted.gfid $B0/$V0"2"/dir/file4
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# B0 and B2 blame each other
|
|
|
b7d4d7 |
+setfattr -n trusted.afr.$V0-client-0 -v 0x000000000000000000000001 $B0/$V0"2"/dir
|
|
|
b7d4d7 |
+setfattr -n trusted.afr.$V0-client-2 -v 0x000000000000000000000001 $B0/$V0"0"/dir
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Add entry to xattrop dir on first brick.
|
|
|
b7d4d7 |
+xattrop_dir0=$(afr_get_index_path $B0/$V0"0")
|
|
|
b7d4d7 |
+base_entry_b0=`ls $xattrop_dir0`
|
|
|
b7d4d7 |
+gfid_str=$(gf_gfid_xattr_to_str $(gf_get_gfid_xattr $B0/$V0"0"/dir/))
|
|
|
b7d4d7 |
+TEST ln $xattrop_dir0/$base_entry_b0 $xattrop_dir0/$gfid_str
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+EXPECT "^1$" get_pending_heal_count $V0
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Launch heal
|
|
|
b7d4d7 |
+TEST $CLI volume heal $V0 enable
|
|
|
b7d4d7 |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "^Y$" glustershd_up_status
|
|
|
b7d4d7 |
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "^1$" afr_child_up_status_in_shd $V0 0
|
|
|
b7d4d7 |
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "^1$" afr_child_up_status_in_shd $V0 1
|
|
|
b7d4d7 |
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "^1$" afr_child_up_status_in_shd $V0 2
|
|
|
b7d4d7 |
+TEST $CLI volume heal $V0
|
|
|
b7d4d7 |
+EXPECT_WITHIN $HEAL_TIMEOUT "^0$" get_pending_heal_count $V0
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# All the files must be present on all the bricks after conservative merge and
|
|
|
b7d4d7 |
+# should have the gfid xattr and the .glusterfs hardlink.
|
|
|
b7d4d7 |
+check_gfid_and_link_count dir/file1
|
|
|
b7d4d7 |
+check_gfid_and_link_count dir/file2
|
|
|
b7d4d7 |
+check_gfid_and_link_count dir/file3
|
|
|
b7d4d7 |
+check_gfid_and_link_count dir/file4
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+cleanup
|
|
|
b7d4d7 |
diff --git a/tests/basic/afr/replace-brick-self-heal-non-granular.t b/tests/basic/afr/replace-brick-self-heal-non-granular.t
|
|
|
b7d4d7 |
new file mode 100644
|
|
|
b7d4d7 |
index 0000000..c86bff1
|
|
|
b7d4d7 |
--- /dev/null
|
|
|
b7d4d7 |
+++ b/tests/basic/afr/replace-brick-self-heal-non-granular.t
|
|
|
b7d4d7 |
@@ -0,0 +1,65 @@
|
|
|
b7d4d7 |
+#!/bin/bash
|
|
|
b7d4d7 |
+. $(dirname $0)/../../include.rc
|
|
|
b7d4d7 |
+. $(dirname $0)/../../volume.rc
|
|
|
b7d4d7 |
+cleanup;
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+TEST glusterd
|
|
|
b7d4d7 |
+TEST pidof glusterd
|
|
|
b7d4d7 |
+TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0,1}
|
|
|
b7d4d7 |
+TEST $CLI volume set $V0 cluster.granular-entry-heal off
|
|
|
b7d4d7 |
+TEST $CLI volume start $V0
|
|
|
b7d4d7 |
+TEST $CLI volume set $V0 cluster.data-self-heal off
|
|
|
b7d4d7 |
+TEST $CLI volume set $V0 cluster.metadata-self-heal off
|
|
|
b7d4d7 |
+TEST $CLI volume set $V0 cluster.entry-self-heal off
|
|
|
b7d4d7 |
+TEST $CLI volume set $V0 cluster.heal-timeout 5
|
|
|
b7d4d7 |
+TEST $CLI volume set $V0 self-heal-daemon off
|
|
|
b7d4d7 |
+TEST $GFS --volfile-id=$V0 --volfile-server=$H0 $M0;
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Create files
|
|
|
b7d4d7 |
+for i in {1..5}
|
|
|
b7d4d7 |
+do
|
|
|
b7d4d7 |
+ echo $i > $M0/file$i.txt
|
|
|
b7d4d7 |
+done
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Metadata changes
|
|
|
b7d4d7 |
+TEST setfattr -n user.test -v qwerty $M0/file5.txt
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Replace brick1
|
|
|
b7d4d7 |
+TEST $CLI volume replace-brick $V0 $H0:$B0/${V0}1 $H0:$B0/${V0}1_new commit force
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Replaced-brick should accuse the non-replaced-brick (Simulating case for data-loss)
|
|
|
b7d4d7 |
+TEST setfattr -n trusted.afr.$V0-client-0 -v 0x000000000000000000000001 $B0/${V0}1_new/
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Check if pending xattr and dirty-xattr are set for replaced-brick
|
|
|
b7d4d7 |
+EXPECT "000000000000000100000001" get_hex_xattr trusted.afr.$V0-client-1 $B0/${V0}0
|
|
|
b7d4d7 |
+EXPECT "000000000000000000000001" get_hex_xattr trusted.afr.dirty $B0/${V0}1_new
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" afr_child_up_status $V0 0
|
|
|
b7d4d7 |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" afr_child_up_status $V0 1
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+TEST $CLI volume set $V0 self-heal-daemon on
|
|
|
b7d4d7 |
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT "Y" glustershd_up_status
|
|
|
b7d4d7 |
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 0
|
|
|
b7d4d7 |
+EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 1
|
|
|
b7d4d7 |
+TEST $CLI volume heal $V0
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Wait for heal to complete
|
|
|
b7d4d7 |
+EXPECT_WITHIN $HEAL_TIMEOUT "0" get_pending_heal_count $V0
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Check if entry-heal has happened
|
|
|
b7d4d7 |
+TEST diff <(ls $B0/${V0}0 | sort) <(ls $B0/${V0}1_new | sort)
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# To make sure that files were not lost from brick0
|
|
|
b7d4d7 |
+TEST diff <(ls $B0/${V0}0 | sort) <(ls $B0/${V0}1 | sort)
|
|
|
b7d4d7 |
+EXPECT "000000000000000000000000" get_hex_xattr trusted.afr.$V0-client-1 $B0/${V0}0
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Test if data was healed
|
|
|
b7d4d7 |
+TEST diff $B0/${V0}0/file1.txt $B0/${V0}1_new/file1.txt
|
|
|
b7d4d7 |
+# To make sure that data was not lost from brick0
|
|
|
b7d4d7 |
+TEST diff $B0/${V0}0/file1.txt $B0/${V0}1/file1.txt
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+# Test if metadata was healed and exists on both the bricks
|
|
|
b7d4d7 |
+EXPECT "qwerty" get_text_xattr user.test $B0/${V0}1_new/file5.txt
|
|
|
b7d4d7 |
+EXPECT "qwerty" get_text_xattr user.test $B0/${V0}0/file5.txt
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+cleanup;
|
|
|
b7d4d7 |
diff --git a/tests/basic/afr/replace-brick-self-heal.t b/tests/basic/afr/replace-brick-self-heal.t
|
|
|
b7d4d7 |
index 0360db7..da31c87 100644
|
|
|
b7d4d7 |
--- a/tests/basic/afr/replace-brick-self-heal.t
|
|
|
b7d4d7 |
+++ b/tests/basic/afr/replace-brick-self-heal.t
|
|
|
b7d4d7 |
@@ -30,7 +30,7 @@ TEST $CLI volume replace-brick $V0 $H0:$B0/${V0}1 $H0:$B0/${V0}1_new commit forc
|
|
|
b7d4d7 |
TEST setfattr -n trusted.afr.$V0-client-0 -v 0x000000000000000000000001 $B0/${V0}1_new/
|
|
|
b7d4d7 |
|
|
|
b7d4d7 |
# Check if pending xattr and dirty-xattr are set for replaced-brick
|
|
|
b7d4d7 |
-EXPECT "000000000000000100000001" get_hex_xattr trusted.afr.$V0-client-1 $B0/${V0}0
|
|
|
b7d4d7 |
+EXPECT "000000010000000100000001" get_hex_xattr trusted.afr.$V0-client-1 $B0/${V0}0
|
|
|
b7d4d7 |
EXPECT "000000000000000000000001" get_hex_xattr trusted.afr.dirty $B0/${V0}1_new
|
|
|
b7d4d7 |
|
|
|
b7d4d7 |
EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" afr_child_up_status $V0 0
|
|
|
b7d4d7 |
diff --git a/tests/bugs/replicate/bug-1130892.t b/tests/bugs/replicate/bug-1130892.t
|
|
|
b7d4d7 |
index 0f57d66..e23eb26 100644
|
|
|
b7d4d7 |
--- a/tests/bugs/replicate/bug-1130892.t
|
|
|
b7d4d7 |
+++ b/tests/bugs/replicate/bug-1130892.t
|
|
|
b7d4d7 |
@@ -56,7 +56,7 @@ EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status $V0 1
|
|
|
b7d4d7 |
TEST stat $M0/one
|
|
|
b7d4d7 |
|
|
|
b7d4d7 |
# Check pending xattrs
|
|
|
b7d4d7 |
-EXPECT "00000000" afr_get_specific_changelog_xattr $B0/${V0}-0/one trusted.afr.$V0-client-1 data
|
|
|
b7d4d7 |
+EXPECT "00000001" afr_get_specific_changelog_xattr $B0/${V0}-0/one trusted.afr.$V0-client-1 data
|
|
|
b7d4d7 |
EXPECT_NOT "00000000" afr_get_specific_changelog_xattr $B0/${V0}-0/one trusted.afr.$V0-client-1 entry
|
|
|
b7d4d7 |
EXPECT "00000000" afr_get_specific_changelog_xattr $B0/${V0}-0/one trusted.afr.$V0-client-1 metadata
|
|
|
b7d4d7 |
|
|
|
b7d4d7 |
diff --git a/tests/bugs/replicate/bug-1493415-gfid-heal.t b/tests/bugs/replicate/bug-1493415-gfid-heal.t
|
|
|
b7d4d7 |
index 125c35a..9714d5e 100644
|
|
|
b7d4d7 |
--- a/tests/bugs/replicate/bug-1493415-gfid-heal.t
|
|
|
b7d4d7 |
+++ b/tests/bugs/replicate/bug-1493415-gfid-heal.t
|
|
|
b7d4d7 |
@@ -49,7 +49,7 @@ TEST setfattr -x trusted.gfid $B0/${V0}1/dir/f2
|
|
|
b7d4d7 |
TEST rm $B0/${V0}1/.glusterfs/${gfid_str_f2:0:2}/${gfid_str_f2:2:2}/$gfid_str_f2
|
|
|
b7d4d7 |
|
|
|
b7d4d7 |
#Now simulate setting of pending entry xattr on parent dir of 1st brick.
|
|
|
b7d4d7 |
-TEST setfattr -n trusted.afr.$V0-client-1 -v 0x000000000000000000000001 $B0/${V0}0/dir
|
|
|
b7d4d7 |
+TEST setfattr -n trusted.afr.$V0-client-1 -v 0x000000010000000000000001 $B0/${V0}0/dir
|
|
|
b7d4d7 |
create_brick_xattrop_entry $B0/${V0}0 dir
|
|
|
b7d4d7 |
|
|
|
b7d4d7 |
#Trigger entry-heal via shd
|
|
|
b7d4d7 |
diff --git a/tests/bugs/replicate/bug-1722507-type-mismatch-error-handling.t b/tests/bugs/replicate/bug-1722507-type-mismatch-error-handling.t
|
|
|
b7d4d7 |
index 0aeaaaf..1fdf7ea 100644
|
|
|
b7d4d7 |
--- a/tests/bugs/replicate/bug-1722507-type-mismatch-error-handling.t
|
|
|
b7d4d7 |
+++ b/tests/bugs/replicate/bug-1722507-type-mismatch-error-handling.t
|
|
|
b7d4d7 |
@@ -23,19 +23,21 @@ TEST mkdir $M0/dir
|
|
|
b7d4d7 |
##########################################################################################
|
|
|
b7d4d7 |
# GFID link file and the GFID is missing on one brick and all the bricks are being blamed.
|
|
|
b7d4d7 |
|
|
|
b7d4d7 |
-TEST touch $M0/dir/file
|
|
|
b7d4d7 |
-#TEST kill_brick $V0 $H0 $B0/$V0"1"
|
|
|
b7d4d7 |
+TEST `echo append>> $M0/dir/file`
|
|
|
b7d4d7 |
|
|
|
b7d4d7 |
#B0 and B2 must blame B1
|
|
|
b7d4d7 |
-setfattr -n trusted.afr.$V0-client-0 -v 0x000000000000000000000001 $B0/$V0"2"/dir
|
|
|
b7d4d7 |
-setfattr -n trusted.afr.$V0-client-1 -v 0x000000000000000000000001 $B0/$V0"0"/dir
|
|
|
b7d4d7 |
-setfattr -n trusted.afr.$V0-client-2 -v 0x000000000000000000000001 $B0/$V0"0"/dir
|
|
|
b7d4d7 |
+# Set data part of the xattr also to 1 so that local->need_full_crawl is true.
|
|
|
b7d4d7 |
+# Another way is to create the needed entries inside indices/entry-changes
|
|
|
b7d4d7 |
+# folder.
|
|
|
b7d4d7 |
+setfattr -n trusted.afr.$V0-client-0 -v 0x000000010000000000000001 $B0/$V0"2"/dir
|
|
|
b7d4d7 |
+setfattr -n trusted.afr.$V0-client-1 -v 0x000000010000000000000001 $B0/$V0"0"/dir
|
|
|
b7d4d7 |
+setfattr -n trusted.afr.$V0-client-2 -v 0x000000010000000000000001 $B0/$V0"0"/dir
|
|
|
b7d4d7 |
|
|
|
b7d4d7 |
# Add entry to xattrop dir to trigger index heal.
|
|
|
b7d4d7 |
xattrop_dir0=$(afr_get_index_path $B0/$V0"0")
|
|
|
b7d4d7 |
base_entry_b0=`ls $xattrop_dir0`
|
|
|
b7d4d7 |
gfid_str=$(gf_gfid_xattr_to_str $(gf_get_gfid_xattr $B0/$V0"0"/dir/))
|
|
|
b7d4d7 |
-ln -s $xattrop_dir0/$base_entry_b0 $xattrop_dir0/$gfid_str
|
|
|
b7d4d7 |
+ln $xattrop_dir0/$base_entry_b0 $xattrop_dir0/$gfid_str
|
|
|
b7d4d7 |
EXPECT "^1$" get_pending_heal_count $V0
|
|
|
b7d4d7 |
|
|
|
b7d4d7 |
# Remove the gfid xattr and the link file on one brick.
|
|
|
b7d4d7 |
@@ -70,18 +72,20 @@ rm -f $M0/dir/file
|
|
|
b7d4d7 |
|
|
|
b7d4d7 |
TEST $CLI volume heal $V0 disable
|
|
|
b7d4d7 |
TEST touch $M0/dir/file
|
|
|
b7d4d7 |
-#TEST kill_brick $V0 $H0 $B0/$V0"1"
|
|
|
b7d4d7 |
|
|
|
b7d4d7 |
#B0 and B2 must blame B1
|
|
|
b7d4d7 |
-setfattr -n trusted.afr.$V0-client-0 -v 0x000000000000000000000001 $B0/$V0"2"/dir
|
|
|
b7d4d7 |
-setfattr -n trusted.afr.$V0-client-1 -v 0x000000000000000000000001 $B0/$V0"0"/dir
|
|
|
b7d4d7 |
-setfattr -n trusted.afr.$V0-client-2 -v 0x000000000000000000000001 $B0/$V0"0"/dir
|
|
|
b7d4d7 |
+# Set data part of the xattr also to 1 so that local->need_full_crawl is true.
|
|
|
b7d4d7 |
+# Another way is to create the needed entries inside indices/entry-changes
|
|
|
b7d4d7 |
+# folder.
|
|
|
b7d4d7 |
+setfattr -n trusted.afr.$V0-client-0 -v 0x000000010000000000000001 $B0/$V0"2"/dir
|
|
|
b7d4d7 |
+setfattr -n trusted.afr.$V0-client-1 -v 0x000000010000000000000001 $B0/$V0"0"/dir
|
|
|
b7d4d7 |
+setfattr -n trusted.afr.$V0-client-2 -v 0x000000010000000000000001 $B0/$V0"0"/dir
|
|
|
b7d4d7 |
|
|
|
b7d4d7 |
# Add entry to xattrop dir to trigger index heal.
|
|
|
b7d4d7 |
xattrop_dir0=$(afr_get_index_path $B0/$V0"0")
|
|
|
b7d4d7 |
base_entry_b0=`ls $xattrop_dir0`
|
|
|
b7d4d7 |
gfid_str=$(gf_gfid_xattr_to_str $(gf_get_gfid_xattr $B0/$V0"0"/dir/))
|
|
|
b7d4d7 |
-ln -s $xattrop_dir0/$base_entry_b0 $xattrop_dir0/$gfid_str
|
|
|
b7d4d7 |
+ln $xattrop_dir0/$base_entry_b0 $xattrop_dir0/$gfid_str
|
|
|
b7d4d7 |
EXPECT "^1$" get_pending_heal_count $V0
|
|
|
b7d4d7 |
|
|
|
b7d4d7 |
# Remove the gfid xattr and the link file on two bricks.
|
|
|
b7d4d7 |
diff --git a/tests/bugs/replicate/bug-1749322-entry-heal-not-happening.t b/tests/bugs/replicate/bug-1749322-entry-heal-not-happening.t
|
|
|
b7d4d7 |
index 9627908..3da873a 100644
|
|
|
b7d4d7 |
--- a/tests/bugs/replicate/bug-1749322-entry-heal-not-happening.t
|
|
|
b7d4d7 |
+++ b/tests/bugs/replicate/bug-1749322-entry-heal-not-happening.t
|
|
|
b7d4d7 |
@@ -59,8 +59,11 @@ TEST rm $B0/$V0"2"/.glusterfs/${gfid_str_file4:0:2}/${gfid_str_file4:2:2}/$gfid_
|
|
|
b7d4d7 |
TEST setfattr -x trusted.gfid $B0/$V0"2"/dir/file4
|
|
|
b7d4d7 |
|
|
|
b7d4d7 |
# B0 and B2 blame each other
|
|
|
b7d4d7 |
-setfattr -n trusted.afr.$V0-client-0 -v 0x000000000000000000000001 $B0/$V0"2"/dir
|
|
|
b7d4d7 |
-setfattr -n trusted.afr.$V0-client-2 -v 0x000000000000000000000001 $B0/$V0"0"/dir
|
|
|
b7d4d7 |
+# Set data part of the xattr also to 1 so that local->need_full_crawl is true.
|
|
|
b7d4d7 |
+# Another way is to create the needed entries inside indices/entry-changes
|
|
|
b7d4d7 |
+# folder.
|
|
|
b7d4d7 |
+setfattr -n trusted.afr.$V0-client-0 -v 0x000000010000000000000001 $B0/$V0"2"/dir
|
|
|
b7d4d7 |
+setfattr -n trusted.afr.$V0-client-2 -v 0x000000010000000000000001 $B0/$V0"0"/dir
|
|
|
b7d4d7 |
|
|
|
b7d4d7 |
# Add entry to xattrop dir on first brick.
|
|
|
b7d4d7 |
xattrop_dir0=$(afr_get_index_path $B0/$V0"0")
|
|
|
b7d4d7 |
diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c
|
|
|
b7d4d7 |
index 1608f75..36fd3a9 100644
|
|
|
b7d4d7 |
--- a/xlators/cluster/afr/src/afr-self-heal-common.c
|
|
|
b7d4d7 |
+++ b/xlators/cluster/afr/src/afr-self-heal-common.c
|
|
|
b7d4d7 |
@@ -2549,6 +2549,11 @@ afr_selfheal_do(call_frame_t *frame, xlator_t *this, uuid_t gfid)
|
|
|
b7d4d7 |
}
|
|
|
b7d4d7 |
}
|
|
|
b7d4d7 |
|
|
|
b7d4d7 |
+ gf_msg_debug(
|
|
|
b7d4d7 |
+ this->name, 0,
|
|
|
b7d4d7 |
+ "heals needed for %s: [entry-heal=%d, metadata-heal=%d, data-heal=%d]",
|
|
|
b7d4d7 |
+ uuid_utoa(gfid), entry_selfheal, metadata_selfheal, data_selfheal);
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
if (data_selfheal && priv->data_self_heal)
|
|
|
b7d4d7 |
data_ret = afr_selfheal_data(frame, this, fd);
|
|
|
b7d4d7 |
|
|
|
b7d4d7 |
diff --git a/xlators/cluster/afr/src/afr-self-heal-data.c b/xlators/cluster/afr/src/afr-self-heal-data.c
|
|
|
b7d4d7 |
index cdff4a5..b97c66b 100644
|
|
|
b7d4d7 |
--- a/xlators/cluster/afr/src/afr-self-heal-data.c
|
|
|
b7d4d7 |
+++ b/xlators/cluster/afr/src/afr-self-heal-data.c
|
|
|
b7d4d7 |
@@ -239,6 +239,9 @@ afr_selfheal_data_block(call_frame_t *frame, xlator_t *this, fd_t *fd,
|
|
|
b7d4d7 |
sink_count = AFR_COUNT(healed_sinks, priv->child_count);
|
|
|
b7d4d7 |
data_lock = alloca0(priv->child_count);
|
|
|
b7d4d7 |
|
|
|
b7d4d7 |
+ gf_msg_debug(this->name, 0, "gfid:%s, offset=%jd, size=%zu",
|
|
|
b7d4d7 |
+ uuid_utoa(fd->inode->gfid), offset, size);
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
ret = afr_selfheal_inodelk(frame, this, fd->inode, this->name, offset, size,
|
|
|
b7d4d7 |
data_lock);
|
|
|
b7d4d7 |
{
|
|
|
b7d4d7 |
diff --git a/xlators/cluster/afr/src/afr-self-heal-entry.c b/xlators/cluster/afr/src/afr-self-heal-entry.c
|
|
|
b7d4d7 |
index 40be898..00b5b2d 100644
|
|
|
b7d4d7 |
--- a/xlators/cluster/afr/src/afr-self-heal-entry.c
|
|
|
b7d4d7 |
+++ b/xlators/cluster/afr/src/afr-self-heal-entry.c
|
|
|
b7d4d7 |
@@ -206,8 +206,11 @@ __afr_selfheal_heal_dirent(call_frame_t *frame, xlator_t *this, fd_t *fd,
|
|
|
b7d4d7 |
replies);
|
|
|
b7d4d7 |
} else {
|
|
|
b7d4d7 |
if (!gf_uuid_compare(replies[i].poststat.ia_gfid,
|
|
|
b7d4d7 |
- replies[source].poststat.ia_gfid))
|
|
|
b7d4d7 |
+ replies[source].poststat.ia_gfid)) {
|
|
|
b7d4d7 |
+ gf_msg_debug(this->name, 0, "skipping %s, no heal needed.",
|
|
|
b7d4d7 |
+ name);
|
|
|
b7d4d7 |
continue;
|
|
|
b7d4d7 |
+ }
|
|
|
b7d4d7 |
|
|
|
b7d4d7 |
ret = afr_selfheal_recreate_entry(frame, i, source, sources,
|
|
|
b7d4d7 |
fd->inode, name, inode, replies);
|
|
|
b7d4d7 |
@@ -839,7 +842,7 @@ afr_selfheal_entry_granular_dirent(xlator_t *subvol, gf_dirent_t *entry,
|
|
|
b7d4d7 |
|
|
|
b7d4d7 |
out:
|
|
|
b7d4d7 |
loc_wipe(&loc;;
|
|
|
b7d4d7 |
- return 0;
|
|
|
b7d4d7 |
+ return ret;
|
|
|
b7d4d7 |
}
|
|
|
b7d4d7 |
|
|
|
b7d4d7 |
static int
|
|
|
b7d4d7 |
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
b7d4d7 |
index a72c494..bd17a82 100644
|
|
|
b7d4d7 |
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
b7d4d7 |
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
b7d4d7 |
@@ -13181,6 +13181,19 @@ glusterd_enable_default_options(glusterd_volinfo_t *volinfo, char *option)
|
|
|
b7d4d7 |
goto out;
|
|
|
b7d4d7 |
}
|
|
|
b7d4d7 |
}
|
|
|
b7d4d7 |
+
|
|
|
b7d4d7 |
+ if ((conf->op_version >= GD_OP_VERSION_7_1) &&
|
|
|
b7d4d7 |
+ (volinfo->status == GLUSTERD_STATUS_NONE)) {
|
|
|
b7d4d7 |
+ ret = dict_set_dynstr_with_alloc(volinfo->dict,
|
|
|
b7d4d7 |
+ "cluster.granular-entry-heal", "on");
|
|
|
b7d4d7 |
+ if (ret) {
|
|
|
b7d4d7 |
+ gf_msg(this->name, GF_LOG_ERROR, errno, GD_MSG_DICT_SET_FAILED,
|
|
|
b7d4d7 |
+ "Failed to set option 'cluster.granular-entry-heal' "
|
|
|
b7d4d7 |
+ "on volume %s",
|
|
|
b7d4d7 |
+ volinfo->volname);
|
|
|
b7d4d7 |
+ goto out;
|
|
|
b7d4d7 |
+ }
|
|
|
b7d4d7 |
+ }
|
|
|
b7d4d7 |
out:
|
|
|
b7d4d7 |
return ret;
|
|
|
b7d4d7 |
}
|
|
|
b7d4d7 |
--
|
|
|
b7d4d7 |
1.8.3.1
|
|
|
b7d4d7 |
|