3
function create_brick_xattrop_entry {
4
local xattrop_dir=$(afr_get_index_path $1)
5
local base_entry=`ls $xattrop_dir|grep xattrop`
7
local params=`echo "$@" | cut -d' ' -f2-`
13
gfid_str=$(gf_gfid_xattr_to_str $(gf_get_gfid_xattr $1/$file))
14
if [ -z "$base_entry"];
16
touch $xattrop_dir/$gfid_str
18
ln $xattrop_dir/$base_entry $xattrop_dir/$gfid_str
27
if [ $exit_val -eq 1 ];
34
diff <(ls $1 | sort) <(ls $2 | sort)
38
local f1_path="${1}/${3}"
39
local f2_path="${2}/${3}"
40
local zero_xattr="000000000000000000000000"
42
diff_dirs $f1_path $f2_path
49
local xattr11=$(get_hex_xattr trusted.afr.$V0-client-0 $f1_path)
50
local xattr12=$(get_hex_xattr trusted.afr.$V0-client-1 $f1_path)
51
local xattr21=$(get_hex_xattr trusted.afr.$V0-client-0 $f2_path)
52
local xattr22=$(get_hex_xattr trusted.afr.$V0-client-1 $f2_path)
53
local dirty1=$(get_hex_xattr trusted.afr.dirty $f1_path)
54
local dirty2=$(get_hex_xattr trusted.afr.dirty $f2_path)
55
if [ -z $xattr11 ]; then xattr11="000000000000000000000000"; fi
56
if [ -z $xattr12 ]; then xattr12="000000000000000000000000"; fi
57
if [ -z $xattr21 ]; then xattr21="000000000000000000000000"; fi
58
if [ -z $xattr22 ]; then xattr22="000000000000000000000000"; fi
59
if [ -z $dirty1 ]; then dirty1="000000000000000000000000"; fi
60
if [ -z $dirty2 ]; then dirty2="000000000000000000000000"; fi
61
echo ${insync}${xattr11}${xattr12}${xattr21}${xattr22}${dirty1}${dirty2}
63
# Check if given dir's self-heal is done
64
function is_dir_heal_done {
65
local zero_xattr="000000000000000000000000"
66
if [ "$(heal_status $@)" == "Y${zero_xattr}${zero_xattr}${zero_xattr}${zero_xattr}${zero_xattr}${zero_xattr}" ];
73
# Check if the given file's self-heal is done
74
function is_file_heal_done {
75
local f1_path="${1}/${3}"
76
local f2_path="${2}/${3}"
77
local zxattr="000000000000000000000000"
78
local size1=$(stat -c "%s" $f1_path)
79
local size2=$(stat -c "%s" $f2_path)
80
local diff=$((size1-size2))
81
local x11=$(get_hex_xattr trusted.afr.$V0-client-0 $f1_path)
82
local x12=$(get_hex_xattr trusted.afr.$V0-client-1 $f1_path)
83
local x21=$(get_hex_xattr trusted.afr.$V0-client-0 $f2_path)
84
local x22=$(get_hex_xattr trusted.afr.$V0-client-1 $f2_path)
85
local dirty1=$(get_hex_xattr trusted.afr.dirty $f1_path)
86
local dirty2=$(get_hex_xattr trusted.afr.dirty $f2_path)
87
if [ -z $x11 ]; then x11="000000000000000000000000"; fi
88
if [ -z $x12 ]; then x12="000000000000000000000000"; fi
89
if [ -z $x21 ]; then x21="000000000000000000000000"; fi
90
if [ -z $x22 ]; then x22="000000000000000000000000"; fi
91
if [ -z $dirty1 ]; then dirty1="000000000000000000000000"; fi
92
if [ -z $dirty2 ]; then dirty2="000000000000000000000000"; fi
93
if [ "${diff}${x11}${x12}${x21}${x22}${dirty1}${dirty2}" == "0${zxattr}${zxattr}${zxattr}${zxattr}${zxattr}${zxattr}" ];
101
#count the number of entries marked for self-heal
104
function count_index_entries()
106
ls $1/.glusterfs/indices/xattrop | wc -l
109
function afr_up_status()
114
grep -E "^up = " $m/.meta/graphs/active/${v}-replicate-${replica_id}/private | cut -f2 -d'='
117
function get_quorum_type()
122
cat $m/.meta/graphs/active/$v-replicate-$repl_id/private|grep quorum-type|awk '{print $3}'
125
function afr_private_key_value()
131
#xargs at the end will strip leading spaces
132
grep -E "^${key} = " $m/.meta/graphs/active/${v}-replicate-${replica_id}/private | cut -f2 -d'=' | xargs
135
function afr_anon_entry_count()
138
ls $b/.glusterfs-anonymous-inode* | wc -l