"Fossies" - the Fresh Open Source Software Archive

Member "glusterfs-7.6/tests/basic/afr/gfid-mismatch-resolution-with-fav-child-policy.t" (18 May 2020, 8773 Bytes) of package /linux/misc/glusterfs-7.6.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Bash source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "gfid-mismatch-resolution-with-fav-child-policy.t": 7.5_vs_7.6.

    1 #!/bin/bash
    2 
    3 . $(dirname $0)/../../include.rc
    4 . $(dirname $0)/../../volume.rc
    5 
    6 cleanup;
    7 
    8 TEST glusterd
    9 TEST pidof glusterd
   10 TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{0,1}
   11 TEST $CLI volume start $V0
   12 TEST $GFS --volfile-id=/$V0 --volfile-server=$H0 $M0
   13 TEST $CLI volume set $V0 cluster.heal-timeout 5
   14 TEST $CLI volume set $V0 self-heal-daemon off
   15 TEST $CLI volume set $V0 cluster.data-self-heal off
   16 TEST $CLI volume set $V0 cluster.metadata-self-heal off
   17 TEST $CLI volume set $V0 cluster.entry-self-heal off
   18 
   19 ##### Healing with favorite-child-policy = mtime ######
   20 #####           and self-heal-daemon             ######
   21 
   22 TEST $CLI volume set $V0 favorite-child-policy mtime
   23 TEST kill_brick $V0 $H0 $B0/${V0}0
   24 echo "Sink based on mtime" > $M0/f1
   25 TEST $CLI volume start $V0 force
   26 EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}0
   27 EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status $V0 0
   28 TEST kill_brick $V0 $H0 $B0/${V0}1
   29 echo "Source based on mtime" > $M0/f1
   30 
   31 #Gfids of file f1 on bricks 0 & 1 should differ
   32 gfid_0=$(gf_get_gfid_xattr $B0/${V0}0/f1)
   33 gfid_1=$(gf_get_gfid_xattr $B0/${V0}1/f1)
   34 TEST [ "$gfid_0" != "$gfid_1" ]
   35 
   36 TEST $CLI volume set $V0 self-heal-daemon on
   37 TEST $CLI volume start $V0 force
   38 EXPECT_WITHIN $PROCESS_UP_TIMEOUT "Y" glustershd_up_status
   39 EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}1
   40 EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status $V0 1
   41 
   42 #We know that first brick has the latest mtime
   43 LATEST_MTIME_MD5=$(md5sum $B0/${V0}0/f1 | cut -d\  -f1)
   44 
   45 EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 0
   46 EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 1
   47 TEST $CLI volume heal $V0
   48 EXPECT_WITHIN $HEAL_TIMEOUT "^0$" get_pending_heal_count $V0
   49 
   50 #gfid split-brain should be resolved
   51 gfid_1=$(gf_get_gfid_xattr $B0/${V0}1/f1)
   52 TEST [ "$gfid_0" == "$gfid_1" ]
   53 
   54 HEALED_MD5=$(md5sum $B0/${V0}1/f1 | cut -d\  -f1)
   55 TEST [ "$LATEST_MTIME_MD5" == "$HEALED_MD5" ]
   56 
   57 TEST $CLI volume set $V0 self-heal-daemon off
   58 
   59 
   60 ##### Healing with favorite-child-policy = ctime ######
   61 #####            and self-heal-daemon            ######
   62 
   63 #gfid split-brain resolution should work even when the granular-enrty-heal is
   64 #enabled
   65 TEST $CLI volume heal $V0 granular-entry-heal enable
   66 
   67 TEST $CLI volume set $V0 favorite-child-policy ctime
   68 TEST kill_brick $V0 $H0 $B0/${V0}1
   69 echo "Sink based on ctime" > $M0/f2
   70 TEST $CLI volume start $V0 force
   71 EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}1
   72 EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status $V0 1
   73 TEST kill_brick $V0 $H0 $B0/${V0}0
   74 echo "Source based on ctime" > $M0/f2
   75 
   76 #Gfids of file f2 on bricks 0 & 1 should differ
   77 gfid_0=$(gf_get_gfid_xattr $B0/${V0}0/f2)
   78 gfid_1=$(gf_get_gfid_xattr $B0/${V0}1/f2)
   79 TEST [ "$gfid_0" != "$gfid_1" ]
   80 
   81 TEST $CLI volume set $V0 self-heal-daemon on
   82 TEST $CLI volume start $V0 force
   83 EXPECT_WITHIN $PROCESS_UP_TIMEOUT "Y" glustershd_up_status
   84 EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}0
   85 EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status $V0 0
   86 
   87 #We know that second brick has the latest ctime
   88 LATEST_CTIME_MD5=$(md5sum $B0/${V0}1/f2 | cut -d\  -f1)
   89 
   90 EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 0
   91 EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 1
   92 TEST $CLI volume heal $V0
   93 EXPECT_WITHIN $HEAL_TIMEOUT "^0$" get_pending_heal_count $V0
   94 
   95 #gfid split-brain should be resolved
   96 gfid_0=$(gf_get_gfid_xattr $B0/${V0}0/f2)
   97 TEST [ "$gfid_0" == "$gfid_1" ]
   98 
   99 HEALED_MD5=$(md5sum $B0/${V0}0/f2 | cut -d\  -f1)
  100 TEST [ "$LATEST_CTIME_MD5" == "$HEALED_MD5" ]
  101 
  102 
  103 #Add one more brick, and heal.
  104 TEST $CLI volume add-brick $V0 replica 3 $H0:$B0/${V0}2
  105 EXPECT_WITHIN $PROCESS_UP_TIMEOUT "Y" glustershd_up_status
  106 EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}0
  107 EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}1
  108 EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}2
  109 EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status $V0 0
  110 EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status $V0 1
  111 EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status $V0 2
  112 EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 0
  113 EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 1
  114 EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status_in_shd $V0 2
  115 
  116 TEST $CLI volume heal $V0
  117 EXPECT_WITHIN $HEAL_TIMEOUT "^0$" get_pending_heal_count $V0
  118 
  119 TEST $CLI volume set $V0 self-heal-daemon off
  120 
  121 
  122 ##### Healing using favorite-child-policy = size #####
  123 #####             and client side heal           #####
  124 
  125 TEST $CLI volume set $V0 cluster.data-self-heal on
  126 TEST $CLI volume set $V0 cluster.metadata-self-heal on
  127 TEST $CLI volume set $V0 cluster.entry-self-heal on
  128 
  129 #Set the quorum-type to none, and create a gfid split brain
  130 TEST $CLI volume set $V0 cluster.quorum-type none
  131 TEST kill_brick $V0 $H0 $B0/${V0}0
  132 TEST kill_brick $V0 $H0 $B0/${V0}1
  133 echo "Smallest file" > $M0/f3
  134 
  135 TEST $CLI volume start $V0 force
  136 EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}0
  137 EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status $V0 0
  138 EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}1
  139 EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status $V0 1
  140 TEST kill_brick $V0 $H0 $B0/${V0}1
  141 TEST kill_brick $V0 $H0 $B0/${V0}2
  142 echo "Second smallest file" > $M0/f3
  143 
  144 TEST $CLI volume start $V0 force
  145 EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}1
  146 EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status $V0 1
  147 EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}2
  148 EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status $V0 2
  149 TEST kill_brick $V0 $H0 $B0/${V0}0
  150 TEST kill_brick $V0 $H0 $B0/${V0}2
  151 echo "Biggest among the three files" > $M0/f3
  152 
  153 #Bring back the down bricks.
  154 TEST $CLI volume start $V0 force
  155 EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}0
  156 EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status $V0 0
  157 EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}2
  158 EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status $V0 2
  159 
  160 #Gfids of file f3 on all the bricks should differ
  161 gfid_0=$(gf_get_gfid_xattr $B0/${V0}0/f3)
  162 gfid_1=$(gf_get_gfid_xattr $B0/${V0}1/f3)
  163 gfid_2=$(gf_get_gfid_xattr $B0/${V0}2/f3)
  164 TEST [ "$gfid_0" != "$gfid_1" ]
  165 TEST [ "$gfid_0" != "$gfid_2" ]
  166 TEST [ "$gfid_1" != "$gfid_2" ]
  167 
  168 #We know that second brick has the bigger size file
  169 BIGGER_FILE_MD5=$(md5sum $B0/${V0}1/f3 | cut -d\  -f1)
  170 
  171 TEST ls $M0 #Trigger entry heal via readdir inode refresh
  172 TEST cat $M0/f3 #Trigger data heal via readv inode refresh
  173 EXPECT_WITHIN $HEAL_TIMEOUT "^0$" get_pending_heal_count $V0
  174 
  175 #gfid split-brain should be resolved
  176 gfid_0=$(gf_get_gfid_xattr $B0/${V0}0/f3)
  177 gfid_2=$(gf_get_gfid_xattr $B0/${V0}2/f3)
  178 TEST [ "$gfid_0" == "$gfid_1" ]
  179 TEST [ "$gfid_2" == "$gfid_1" ]
  180 
  181 HEALED_MD5_1=$(md5sum $B0/${V0}0/f3 | cut -d\  -f1)
  182 HEALED_MD5_2=$(md5sum $B0/${V0}2/f3 | cut -d\  -f1)
  183 TEST [ "$BIGGER_FILE_MD5" == "$HEALED_MD5_1" ]
  184 TEST [ "$BIGGER_FILE_MD5" == "$HEALED_MD5_2" ]
  185 
  186 
  187 ##### Healing using favorite-child-policy = majority #####
  188 #####             and client side heal               #####
  189 
  190 TEST kill_brick $V0 $H0 $B0/${V0}0
  191 TEST kill_brick $V0 $H0 $B0/${V0}1
  192 echo "Does not agree with bricks 0 & 1" > $M0/f4
  193 
  194 TEST $CLI v start $V0 force
  195 EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}0
  196 EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status $V0 0
  197 EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}1
  198 EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status $V0 1
  199 TEST kill_brick  $V0 $H0 $B0/${V0}2
  200 echo "Agree on bricks 0 & 1" > $M0/f4
  201 
  202 #Gfids of file f4 on bricks 0 & 1 should be same and bricks 0 & 2 should differ
  203 gfid_0=$(gf_get_gfid_xattr $B0/${V0}0/f4)
  204 gfid_1=$(gf_get_gfid_xattr $B0/${V0}1/f4)
  205 gfid_2=$(gf_get_gfid_xattr $B0/${V0}2/f4)
  206 TEST [ "$gfid_0" == "$gfid_1" ]
  207 TEST [ "$gfid_0" != "$gfid_2" ]
  208 
  209 #We know that first and second bricks agree with each other. Pick any one of
  210 #them as source
  211 MAJORITY_MD5=$(md5sum $B0/${V0}0/f4 | cut -d\  -f1)
  212 
  213 #Bring back the down brick and heal.
  214 TEST $CLI volume start $V0 force
  215 EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}2
  216 EXPECT_WITHIN $CHILD_UP_TIMEOUT "1" afr_child_up_status $V0 2
  217 
  218 TEST ls $M0 #Trigger entry heal via readdir inode refresh
  219 TEST cat $M0/f4  #Trigger data heal via readv inode refresh
  220 EXPECT_WITHIN $HEAL_TIMEOUT "^0$" get_pending_heal_count $V0
  221 
  222 #gfid split-brain should be resolved
  223 gfid_2=$(gf_get_gfid_xattr $B0/${V0}2/f4)
  224 TEST [ "$gfid_0" == "$gfid_2" ]
  225 
  226 HEALED_MD5=$(md5sum $B0/${V0}2/f4 | cut -d\  -f1)
  227 TEST [ "$MAJORITY_MD5" == "$HEALED_MD5" ]
  228 
  229 cleanup;
  230 #G_TESTDEF_TEST_STATUS_NETBSD7=1501390