diff options
Diffstat (limited to 'tests/bugs/distribute')
25 files changed, 548 insertions, 303 deletions
diff --git a/tests/bugs/distribute/bug-1063230.t b/tests/bugs/distribute/bug-1063230.t deleted file mode 100755 index 944c6c296f6..00000000000 --- a/tests/bugs/distribute/bug-1063230.t +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -. $(dirname $0)/../../include.rc -. $(dirname $0)/../../volume.rc - -cleanup; - -TEST glusterd -TEST pidof glusterd -TEST $CLI volume create $V0 $H0:$B0/brick0 $H0:$B0/brick1 -TEST $CLI volume start $V0 - -sleep 5 - -TEST glusterfs -s $H0 --volfile-id $V0 $M0 - -var=`gluster volume rebalance $V0 start force` - -EXPECT "0" echo $? - -var1="volume rebalance: $V0: success: Rebalance on $V0 has \ -been started successfully. Use rebalance status command to \ -check status of the rebalance process." - -echo $var | grep "$var1" - -EXPECT "0" echo $? - -cleanup diff --git a/tests/bugs/distribute/bug-1088231.t b/tests/bugs/distribute/bug-1088231.t index b2347efe21f..8d4d1db73a5 100755 --- a/tests/bugs/distribute/bug-1088231.t +++ b/tests/bugs/distribute/bug-1088231.t @@ -31,6 +31,11 @@ gfid_with_hyphen=`getfattr -n glusterfs.gfid.string $M0/a 2>/dev/null \ TEST setfattr -x trusted.glusterfs.dht $B0/$V0"0"/a +## new healing code don't attempt healing if inode is already +## populated. So, unmount and remount before we do stat. +TEST umount $M0 +TEST glusterfs --volfile-id=/$V0 --aux-gfid-mount --volfile-server=$H0 $M0 + TEST stat $M0/.gfid/$gfid_with_hyphen ## Assuming that we have two bricks, we can have two permutations of layout @@ -57,6 +62,8 @@ TEST stat $M0/.gfid/$gfid_with_hyphen ##Extract Layout +echo `get_layout $B0/$V0"0"/a` +echo `get_layout $B0/$V0"1"/a` layout_b0_s=`get_layout $B0/$V0"0"/a | cut -c19-26` layout_b0_e=`get_layout $B0/$V0"0"/a | cut -c27-34` layout_b1_s=`get_layout $B0/$V0"1"/a | cut -c19-26` @@ -70,7 +77,6 @@ layout_b1_s="0x"$layout_b1_s layout_b1_e="0x"$layout_b1_e - ## Logic of converting starting layout "0" to "Max_value of layout + 1" comp1=$(($layout_b0_s + 0)) if [ "$comp1" == "0" ];then @@ -114,9 +120,15 @@ gfid_with_hyphen=`getfattr -n glusterfs.gfid.string $M0/a 2>/dev/null \ TEST setfattr -x trusted.glusterfs.dht $B0/$V0"0"/a TEST setfattr -x trusted.glusterfs.dht $B0/$V0"1"/a +## new healing code don't attempt healing if inode is already +## populated. So, unmount and remount before we do stat. +TEST umount $M0 +TEST glusterfs --volfile-id=/$V0 --aux-gfid-mount --volfile-server=$H0 $M0 + TEST stat $M0/.gfid/$gfid_with_hyphen ##Extract Layout + layout_b0_s=`get_layout $B0/$V0"0"/a | cut -c19-26` layout_b0_e=`get_layout $B0/$V0"0"/a | cut -c27-34` layout_b1_s=`get_layout $B0/$V0"1"/a | cut -c19-26` diff --git a/tests/bugs/distribute/bug-1099890.t b/tests/bugs/distribute/bug-1099890.t index 40f70d4938b..1a19ba880c0 100644 --- a/tests/bugs/distribute/bug-1099890.t +++ b/tests/bugs/distribute/bug-1099890.t @@ -123,7 +123,6 @@ EXPECT "1" is_dht_linkfile "$B0/${V0}1/zz" force_umount $M0 TEST $CLI volume stop $V0 -EXPECT "1" get_aux UMOUNT_LOOP ${B0}/${V0}{1,2} rm -f ${B0}/brick{1,2} diff --git a/tests/bugs/distribute/bug-1117851.t b/tests/bugs/distribute/bug-1117851.t deleted file mode 100755 index 678103869cf..00000000000 --- a/tests/bugs/distribute/bug-1117851.t +++ /dev/null @@ -1,99 +0,0 @@ -#!/bin/bash - -. $(dirname $0)/../../include.rc -. $(dirname $0)/../../volume.rc - -create_files () { - for i in {1..1000}; do - orig=$(printf %s/abc%04d $1 $i) - real=$(printf %s/src%04d $1 $i) - # Make sure lots of these have linkfiles. - echo "This is file $i" > $orig - mv $orig $real - done - sync -} - -move_files_inner () { - sfile=$M0/status_$(basename $1) - for i in {1..1000}; do - src=$(printf %s/src%04d $1 $i) - dst=$(printf %s/dst%04d $1 $i) - mv $src $dst 2> /dev/null - done - echo "done" > $sfile -} - -move_files () { - #Create the status file here to prevent spurious failures - #caused by the file not being created in time by the - #background process - sfile=$M0/status_$(basename $1) - echo "running" > $sfile - move_files_inner $* & -} - -check_files () { - errors=0 - for i in {1..1000}; do - if [ ! -f $(printf %s/dst%04d $1 $i) ]; then - if [ -f $(printf %s/src%04d $1 $i) ]; then - echo "file $i didnt get moved" > /dev/stderr - else - echo "file $i is MISSING" > /dev/stderr - errors=$((errors+1)) - fi - fi - done - if [ $((errors)) != 0 ]; then - : ls -l $1 > /dev/stderr - fi - return $errors -} - -cleanup; - -TEST glusterd -TEST pidof glusterd -TEST $CLI volume info; - -TEST $CLI volume create $V0 replica 2 $H0:$B0/${V0}{1,2,3,4,5,6}; - -EXPECT "$V0" volinfo_field $V0 'Volume Name'; -EXPECT 'Created' volinfo_field $V0 'Status'; -EXPECT '6' brick_count $V0 - -TEST $CLI volume start $V0; -EXPECT 'Started' volinfo_field $V0 'Status'; - -## Mount FUSE with caching disabled (read-write) -TEST glusterfs --entry-timeout=0 --attribute-timeout=0 -s $H0 --volfile-id $V0 $M0; - -TEST create_files $M0 - -## Mount FUSE with caching disabled (read-write) again -TEST glusterfs --entry-timeout=0 --attribute-timeout=0 -s $H0 --volfile-id $V0 $M1; - -TEST move_files $M0 -TEST move_files $M1 - -# It's regrettable that renaming 1000 files might take more than 30 seconds, -# but on our test systems sometimes it does, so double the time from what we'd -# use otherwise. There still seem to be some spurious failures, 1 in 20 when -# this does not complete, added an additional 60 seconds to take false reports -# out of the system, during test runs, especially on slower test systems. -EXPECT_WITHIN 120 "done" cat $M0/status_0 -EXPECT_WITHIN 120 "done" cat $M1/status_1 - -EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 -EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M1 -TEST glusterfs --entry-timeout=0 --attribute-timeout=0 -s $H0 --volfile-id $V0 $M0; -TEST check_files $M0 - -TEST $CLI volume stop $V0; -EXPECT 'Stopped' volinfo_field $V0 'Status'; - -TEST $CLI volume delete $V0; -TEST ! $CLI volume info $V0; - -cleanup; diff --git a/tests/bugs/distribute/bug-1122443.t b/tests/bugs/distribute/bug-1122443.t deleted file mode 100644 index 906be7072bd..00000000000 --- a/tests/bugs/distribute/bug-1122443.t +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash - -. $(dirname $0)/../../include.rc -. $(dirname $0)/../../volume.rc -. $(dirname $0)/../../dht.rc - -make_files() { - mkdir $1 && \ - ln -s ../ $1/symlink && \ - mknod $1/special_b b 1 2 && \ - mknod $1/special_c c 3 4 && \ - mknod $1/special_u u 5 6 && \ - mknod $1/special_p p && \ - touch -h --date=@1 $1/symlink && \ - touch -h --date=@2 $1/special_b && - touch -h --date=@3 $1/special_c && - touch -h --date=@4 $1/special_u && - touch -h --date=@5 $1/special_p -} - -bug_1113050_workaround() { - # Test if graph change has settled (bug-1113050?) - test=$(stat -c "%n:%Y" $1 2>&1 | tr '\n' ',') - if [ $? -eq 0 ] ; then - echo RECONNECTED - else - echo WAITING - fi - return 0 -} - -cleanup - -TEST glusterd -TEST pidof glusterd - -TEST $CLI volume create $V0 $H0:$B0/${V0}0 -TEST $CLI volume start $V0 - -# Mount FUSE and create symlink -TEST glusterfs -s $H0 --volfile-id $V0 $M0 -TEST make_files $M0/subdir - -# Get mtime before migration -BEFORE="$(stat -c %n:%Y $M0/subdir/* | tr '\n' ',')" - -# Migrate brick -TEST $CLI volume add-brick $V0 $H0:$B0/${V0}1 -TEST $CLI volume remove-brick $V0 $H0:$B0/${V0}0 start -EXPECT_WITHIN $REBALANCE_TIMEOUT "completed" remove_brick_status_completed_field "$V0 $H0:$B0/${V0}0" -TEST $CLI volume remove-brick $V0 $H0:$B0/${V0}0 commit - -# Get mtime after migration -EXPECT_WITHIN 5 RECONNECTED bug_1113050_workaround $M0/subdir/* -AFTER="$(stat -c %n:%Y $M0/subdir/* | tr '\n' ',')" - -# Check if mtime is unchanged -TEST [ "$AFTER" == "$BEFORE" ] - -cleanup diff --git a/tests/bugs/distribute/bug-1125824.t b/tests/bugs/distribute/bug-1125824.t index 3bafbf31fe5..7e401092273 100755 --- a/tests/bugs/distribute/bug-1125824.t +++ b/tests/bugs/distribute/bug-1125824.t @@ -4,6 +4,8 @@ . $(dirname $0)/../../volume.rc . $(dirname $0)/../../nfs.rc +#G_TESTDEF_TEST_STATUS_CENTOS6=NFS_TEST + create_files () { for i in {1..10}; do orig=$(printf %s/file%04d $1 $i) diff --git a/tests/bugs/distribute/bug-1161156.t b/tests/bugs/distribute/bug-1161156.t index 44a234c60dc..2b9e15407ca 100755 --- a/tests/bugs/distribute/bug-1161156.t +++ b/tests/bugs/distribute/bug-1161156.t @@ -4,6 +4,8 @@ . $(dirname $0)/../../volume.rc . $(dirname $0)/../../nfs.rc +#G_TESTDEF_TEST_STATUS_CENTOS6=NFS_TEST + cleanup; QDD=$(dirname $0)/quota @@ -50,7 +52,6 @@ TEST ! mv $N0/dir/newfile_3 $N0/newdir/ umount_nfs $N0 TEST $CLI volume stop $V0 -EXPECT "1" get_aux rm -f $QDD diff --git a/tests/bugs/distribute/bug-1161311.t b/tests/bugs/distribute/bug-1161311.t index c5a7f041ac8..62796068928 100755 --- a/tests/bugs/distribute/bug-1161311.t +++ b/tests/bugs/distribute/bug-1161311.t @@ -1,5 +1,7 @@ #!/bin/bash +SCRIPT_TIMEOUT=350 + # This tests for hard link preservation for files that are linked, when the # file is undergoing migration @@ -15,6 +17,27 @@ . $(dirname $0)/../../include.rc . $(dirname $0)/../../volume.rc +cleanup +TEST truncate -s 10GB $B0/brick1 +TEST truncate -s 10GB $B0/brick2 +TEST truncate -s 10GB $B0/brick3 + +TEST LO1=`SETUP_LOOP $B0/brick1` +TEST MKFS_LOOP $LO1 + +TEST LO2=`SETUP_LOOP $B0/brick2` +TEST MKFS_LOOP $LO2 + +TEST LO3=`SETUP_LOOP $B0/brick3` +TEST MKFS_LOOP $LO3 + +TEST mkdir -p $B0/${V0}1 $B0/${V0}2 $B0/${V0}3 + + +TEST MOUNT_LOOP $LO1 $B0/${V0}1 +TEST MOUNT_LOOP $LO2 $B0/${V0}2 +TEST MOUNT_LOOP $LO3 $B0/${V0}3 + checksticky () { i=0; while [ ! -k $1 ]; do @@ -31,7 +54,6 @@ checksticky () { return 0 } -cleanup; TEST glusterd TEST pidof glusterd @@ -43,6 +65,7 @@ EXPECT "$V0" volinfo_field $V0 'Volume Name'; EXPECT 'Created' volinfo_field $V0 'Status'; EXPECT '3' brick_count $V0 +TEST $CLI volume set $V0 parallel-readdir on TEST $CLI volume start $V0; EXPECT 'Started' volinfo_field $V0 'Status'; @@ -53,8 +76,12 @@ TEST glusterfs -s $H0 --volfile-id $V0 $M0; TEST mkdir $M0/dir1 TEST mkdir -p $M0/dir2/dir3 -# Create a large file (1GB), so that rebalance takes time -dd if=/dev/urandom of=$M0/dir1/FILE2 bs=64k count=10240 +# Create a large file (8 GB), so that rebalance takes time +# Since we really don't care about the contents of the file, we use fallocate +# to generate the file much faster. We could also use truncate, which is even +# faster, but rebalance could take advantage of an sparse file and migrate it +# in an optimized way, but we don't want a fast migration. +TEST fallocate -l 8G $M0/dir1/FILE2 # Rename the file to create a linkto, for rebalance to # act on the file @@ -62,6 +89,8 @@ dd if=/dev/urandom of=$M0/dir1/FILE2 bs=64k count=10240 ## into separate bricks when brick count is 3 TEST mv $M0/dir1/FILE2 $M0/dir1/FILE1 +brick_loc=$(get_backend_paths $M0/dir1/FILE1) + # unmount and remount the volume EXPECT_WITHIN $UMOUNT_TIMEOUT "Y" force_umount $M0 TEST glusterfs -s $H0 --volfile-id $V0 $M0; @@ -71,7 +100,7 @@ TEST $CLI volume rebalance $V0 start force # Wait for FILE to get the sticky bit on, so that file is under # active rebalance, before creating the links -TEST checksticky $B0/${V0}3/dir1/FILE1 +TEST checksticky $brick_loc # Create the links ## FILE3 FILE5 FILE7 have hashes, c8c91469 566d26ce 22ce7eba @@ -92,7 +121,7 @@ cd / # Ideally for this test to have done its job, the file should still be # under migration, so check the sticky bit again -TEST checksticky $B0/${V0}3/dir1/FILE1 +TEST checksticky $brick_loc # Wait for rebalance to complete EXPECT_WITHIN $REBALANCE_TIMEOUT "completed" rebalance_status_field $V0 @@ -126,4 +155,10 @@ cd / linkcountsrc=$(stat -c %h $M0/dir1/FILE1) TEST [[ $linkcountsrc == 14 ]] + +# Stop the volume +TEST $CLI volume stop $V0; + +UMOUNT_LOOP ${B0}/${V0}{1..3} +rm -f ${B0}/brick{1..3} cleanup; diff --git a/tests/bugs/distribute/bug-1190734.t b/tests/bugs/distribute/bug-1190734.t index d48d74d2c35..9256088f7a0 100644 --- a/tests/bugs/distribute/bug-1190734.t +++ b/tests/bugs/distribute/bug-1190734.t @@ -4,6 +4,8 @@ . $(dirname $0)/../../volume.rc . $(dirname $0)/../../nfs.rc +#G_TESTDEF_TEST_STATUS_CENTOS6=NFS_TEST + BRICK_COUNT=3 FILE_COUNT=100 FILE_COUNT_TIME=5 diff --git a/tests/bugs/distribute/bug-1193636.c b/tests/bugs/distribute/bug-1193636.c index eae90783f8e..ea3f79a4e06 100644 --- a/tests/bugs/distribute/bug-1193636.c +++ b/tests/bugs/distribute/bug-1193636.c @@ -1,70 +1,68 @@ #include <stdio.h> #include <stdlib.h> #include <sys/types.h> -#include <attr/xattr.h> +#include <sys/xattr.h> #include <fcntl.h> #include <string.h> +#define MY_XATTR_NAME "user.ftest" +#define MY_XATTR_VAL "ftestval" -#define MY_XATTR_NAME "user.ftest" -#define MY_XATTR_VAL "ftestval" - - -void usage (void) +void +usage(void) { - printf ("Usage : bug-1193636 <filename> <xattr_name> <op>\n"); - printf (" op : 0 - set, 1 - remove\n"); + printf("Usage : bug-1193636 <filename> <xattr_name> <op>\n"); + printf(" op : 0 - set, 1 - remove\n"); } - -int main (int argc, char **argv) +int +main(int argc, char **argv) { - int fd; - int err = 0; - char *xattr_name = NULL; - int op = 0; - - if (argc != 4) { - usage (); - exit (1); - } - - op = atoi (argv[3]); - - if ((op != 0) && (op != 1)) { - printf ("Invalid operation specified.\n"); - usage (); - exit (1); + int fd; + int err = 0; + char *xattr_name = NULL; + int op = 0; + + if (argc != 4) { + usage(); + exit(1); + } + + op = atoi(argv[3]); + + if ((op != 0) && (op != 1)) { + printf("Invalid operation specified.\n"); + usage(); + exit(1); + } + + xattr_name = argv[2]; + + fd = open(argv[1], O_RDWR); + if (fd == -1) { + printf("Failed to open file %s\n", argv[1]); + exit(1); + } + + if (!op) { + err = fsetxattr(fd, xattr_name, MY_XATTR_VAL, strlen(MY_XATTR_VAL) + 1, + XATTR_CREATE); + + if (err) { + printf("Failed to set xattr %s: %m\n", xattr_name); + exit(1); } - xattr_name = argv[2]; + } else { + err = fremovexattr(fd, xattr_name); - fd = open(argv[1], O_RDWR); - if (fd == -1) { - printf ("Failed to open file %s\n", argv[1]); - exit (1); + if (err) { + printf("Failed to remove xattr %s: %m\n", xattr_name); + exit(1); } + } - if (!op) { - err = fsetxattr (fd, xattr_name, MY_XATTR_VAL, - strlen (MY_XATTR_VAL) + 1, XATTR_CREATE); + close(fd); - if (err) { - printf ("Failed to set xattr %s: %m\n", xattr_name); - exit (1); - } - - } else { - err = fremovexattr (fd, xattr_name); - - if (err) { - printf ("Failed to remove xattr %s: %m\n", xattr_name); - exit (1); - } - } - - close (fd); - - return 0; + return 0; } - diff --git a/tests/bugs/distribute/bug-1193636.t b/tests/bugs/distribute/bug-1193636.t index ccde02edc70..b377910336e 100644 --- a/tests/bugs/distribute/bug-1193636.t +++ b/tests/bugs/distribute/bug-1193636.t @@ -41,11 +41,13 @@ dd if=/dev/zero of=$M0/dir1/FILE2 bs=64k count=10240 # act on the file TEST mv $M0/dir1/FILE2 $M0/dir1/FILE1 +brick_loc=$(get_backend_paths $M0/dir1/FILE1) + build_tester $(dirname $0)/bug-1193636.c TEST $CLI volume rebalance $V0 start force -TEST checksticky $B0/${V0}3/dir1/FILE1 +TEST checksticky $brick_loc TEST setfattr -n "user.test1" -v "test1" $M0/dir1/FILE1 TEST setfattr -n "user.test2" -v "test1" $M0/dir1/FILE1 diff --git a/tests/bugs/distribute/bug-1247563.t b/tests/bugs/distribute/bug-1247563.t index f7f92582e04..a2fc722896f 100644 --- a/tests/bugs/distribute/bug-1247563.t +++ b/tests/bugs/distribute/bug-1247563.t @@ -30,6 +30,7 @@ TEST glusterfs --acl -s $H0 --volfile-id $V0 $M0 TEST mkdir $M0/dir1 echo "Testing pacls on rebalance" > $M0/dir1/FILE1 + FPATH1=`find $B0/ -name FILE1` # Rename the file to create a linkto, for rebalance to @@ -55,3 +56,7 @@ COUNT=`getfacl $FPATH2 |grep -c "user:root:rwx"` EXPECT "0" echo $COUNT cleanup; + + +#G_TESTDEF_TEST_STATUS_CENTOS6=BAD_TEST,BUG=000000 +#G_TESTDEF_TEST_STATUS_NETBSD7=BAD_TEST,BUG=000000 diff --git a/tests/bugs/distribute/bug-1368012.t b/tests/bugs/distribute/bug-1368012.t new file mode 100644 index 00000000000..0b626353aab --- /dev/null +++ b/tests/bugs/distribute/bug-1368012.t @@ -0,0 +1,51 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +cleanup; + +function get_permission { + stat -c "%A" $1 +} + +## Start glusterd +TEST glusterd; +TEST pidof glusterd; +TEST $CLI volume info; + +## Lets create volume +TEST $CLI volume create $V0 $H0:$B0/${V0}{1,2}; + +## Verify volume is created +EXPECT "$V0" volinfo_field $V0 'Volume Name'; +EXPECT 'Created' volinfo_field $V0 'Status'; +## Start volume and verify +TEST $CLI volume start $V0; +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "2" online_brick_count +TEST $CLI volume set $V0 performance.stat-prefetch off +EXPECT 'Started' volinfo_field $V0 'Status'; +TEST glusterfs -s $H0 --volfile-id=$V0 $M0 + +##Test case: Add-brick +#------------------------------------------------------------ +#change permission of both root +TEST chmod 444 $M0 + +#store permission for comparision +TEST permission_root=`stat -c "%A" $M0` +TEST echo $permission_root +#Add-brick +TEST $CLI volume add-brick $V0 $H0:$B0/${V0}3 +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "3" online_brick_count + +#Allow one lookup to happen +TEST ls $M0 +#Generate another lookup +echo 3 > /proc/sys/vm/drop_caches +TEST ls $M0 +#check root permission +EXPECT_WITHIN "5" $permission_root get_permission $M0 +#check permission on the new-brick +EXPECT $permission_root get_permission $B0/${V0}3 +cleanup diff --git a/tests/bugs/distribute/bug-1389697.t b/tests/bugs/distribute/bug-1389697.t new file mode 100644 index 00000000000..0d428b8d9d2 --- /dev/null +++ b/tests/bugs/distribute/bug-1389697.t @@ -0,0 +1,42 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../cluster.rc + + +cleanup + +TEST launch_cluster 2; +TEST $CLI_1 peer probe $H2; +EXPECT_WITHIN $PROBE_TIMEOUT 1 peer_count + +TEST $CLI_1 volume create $V0 $H1:$B1/b1 $H1:$B1/b2 $H2:$B2/b3 +TEST $CLI_1 volume start $V0 + +#Start a fix-layout +TEST $CLI_1 volume rebalance $V0 fix-layout start + +#volume rebalance status should work +TEST $CLI_1 volume rebalance $V0 status +$CLI_1 volume rebalance $V0 status + +val=$($CLI_1 volume rebalance $V0 status |grep "fix-layout" 2>&1) +val=$? +TEST [ $val -eq 0 ]; + +#Start a remove brick for the brick on H2 +TEST $CLI_1 volume remove-brick $V0 $H2:$B2/b3 start +TEST $CLI_1 volume remove-brick $V0 $H2:$B2/b3 status + +#Check remove brick status from H1 +$CLI_1 volume remove-brick $V0 $H2:$B2/b3 status |grep "fix-layout" 2>&1 +val=$? +TEST [ $val -eq 1 ]; + +$CLI_1 volume remove-brick $V0 $H2:$B2/b3 status +$CLI_2 volume remove-brick $V0 $H2:$B2/b3 status + + +TEST $CLI_1 volume remove-brick $V0 $H2:$B2/b3 stop + +cleanup diff --git a/tests/bugs/distribute/bug-1543279.t b/tests/bugs/distribute/bug-1543279.t new file mode 100644 index 00000000000..47b8b4a4a95 --- /dev/null +++ b/tests/bugs/distribute/bug-1543279.t @@ -0,0 +1,67 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc +. $(dirname $0)/../../dht.rc + +TESTS_EXPECTED_IN_LOOP=44 +SCRIPT_TIMEOUT=600 + +rename_files() { + MOUNT=$1 + ITERATIONS=$2 + for i in $(seq 1 $ITERATIONS); do uuid="`uuidgen`"; echo "some data" > $MOUNT/test$uuid; mv $MOUNT/test$uuid $MOUNT/test -f || return $?; done +} + +run_test_for_volume() { + VOLUME=$1 + ITERATIONS=$2 + TEST_IN_LOOP $CLI volume start $VOLUME + + TEST_IN_LOOP glusterfs -s $H0 --volfile-id $VOLUME $M0 + TEST_IN_LOOP glusterfs -s $H0 --volfile-id $VOLUME $M1 + TEST_IN_LOOP glusterfs -s $H0 --volfile-id $VOLUME $M2 + TEST_IN_LOOP glusterfs -s $H0 --volfile-id $VOLUME $M3 + + rename_files $M0 $ITERATIONS & + M0_RENAME_PID=$! + + rename_files $M1 $ITERATIONS & + M1_RENAME_PID=$! + + rename_files $M2 $ITERATIONS & + M2_RENAME_PID=$! + + rename_files $M3 $ITERATIONS & + M3_RENAME_PID=$! + + TEST_IN_LOOP wait $M0_RENAME_PID + TEST_IN_LOOP wait $M1_RENAME_PID + TEST_IN_LOOP wait $M2_RENAME_PID + TEST_IN_LOOP wait $M3_RENAME_PID + + TEST_IN_LOOP $CLI volume stop $VOLUME + TEST_IN_LOOP $CLI volume delete $VOLUME + umount $M0 $M1 $M2 $M3 +} + +cleanup + +TEST glusterd +TEST pidof glusterd + +TEST $CLI volume create $V0 $H0:$B0/${V0}{0..8} force +run_test_for_volume $V0 200 + +TEST $CLI volume create $V0 replica 3 arbiter 1 $H0:$B0/${V0}{0..8} force +run_test_for_volume $V0 200 + +TEST $CLI volume create $V0 replica 3 $H0:$B0/${V0}{0..8} force +run_test_for_volume $V0 200 + +TEST $CLI volume create $V0 disperse 6 redundancy 2 $H0:$B0/${V0}{0..5} force +run_test_for_volume $V0 200 + +cleanup +#G_TESTDEF_TEST_STATUS_CENTOS6=BAD_TEST,BUG=000000 +#G_TESTDEF_TEST_STATUS_NETBSD7=BAD_TEST,BUG=000000 diff --git a/tests/bugs/distribute/bug-1600379.t b/tests/bugs/distribute/bug-1600379.t new file mode 100644 index 00000000000..8d2f6154100 --- /dev/null +++ b/tests/bugs/distribute/bug-1600379.t @@ -0,0 +1,54 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc + +# Initialize +#------------------------------------------------------------ +cleanup; + +# Start glusterd +TEST glusterd; +TEST pidof glusterd; +TEST $CLI volume info; + +# Create a volume +TEST $CLI volume create $V0 $H0:$B0/${V0}{1,2} + +# Verify volume creation +EXPECT "$V0" volinfo_field $V0 'Volume Name'; +EXPECT 'Created' volinfo_field $V0 'Status'; + +# Start volume and verify successful start +TEST $CLI volume start $V0; +EXPECT 'Started' volinfo_field $V0 'Status'; +TEST glusterfs --volfile-id=$V0 --volfile-server=$H0 --entry-timeout=0 $M0; +#------------------------------------------------------------ + +# Test case - Remove xattr from killed brick on lookup +#------------------------------------------------------------ +# Create a dir and set custom xattr +TEST mkdir $M0/testdir +TEST setfattr -n user.attr -v val $M0/testdir +xattr_val=`getfattr -d $B0/${V0}2/testdir | awk '{print $1}'`; +TEST ${xattr_val}='user.attr="val"'; + +# Kill 2nd brick process +TEST kill_brick $V0 $H0 $B0/${V0}2 +EXPECT_WITHIN ${PROCESS_UP_TIMEOUT} "1" online_brick_count + +# Remove custom xattr +TEST setfattr -x user.attr $M0/testdir + +# Bring up the killed brick process +TEST $CLI volume start $V0 force + +# Perform lookup +sleep 5 +TEST ls $M0/testdir + +# Check brick xattrs +xattr_val_2=`getfattr -d $B0/${V0}2/testdir`; +TEST [ ${xattr_val_2} = ''] ; + +cleanup; diff --git a/tests/bugs/distribute/bug-1667804.t b/tests/bugs/distribute/bug-1667804.t new file mode 100644 index 00000000000..3f7c43111d7 --- /dev/null +++ b/tests/bugs/distribute/bug-1667804.t @@ -0,0 +1,63 @@ +#!/bin/bash + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc +. $(dirname $0)/../../dht.rc + +function confirm_all_linkto_files () +{ + inpath=$1 + for infile in $inpath/* + do + echo $infile + ret1=$(is_dht_linkfile $infile) + if [ "$ret1" -eq 0 ]; then + echo "$infile is not a linkto file" + echo 0 + return + fi + done + echo 1 +} + +cleanup; + +#Basic checks +TEST glusterd +TEST pidof glusterd +TEST $CLI volume info + +#Create a distributed volume +TEST $CLI volume create $V0 $H0:$B0/${V0}{1..2}; +TEST $CLI volume start $V0 + +# Mount FUSE +TEST glusterfs -s $H0 --volfile-id $V0 $M0 + +#Create files and rename them in order to create linkto files +TEST mkdir -p $M0/dir0/dir1 +TEST touch $M0/dir0/dir1/file-{1..50} + +for i in {1..50}; do + mv $M0/dir0/dir1/file-$i $M0/dir0/dir1/nfile-$i; +done + +#Remove the second brick to force the creation of linkto files +#on the removed brick + +TEST $CLI volume remove-brick $V0 $H0:$B0/${V0}2 start +EXPECT_WITHIN $REBALANCE_TIMEOUT "completed" remove_brick_status_completed_field "$V0 $H0:$B0/${V0}2" +TEST $CLI volume remove-brick $V0 $H0:$B0/${V0}2 stop + +EXPECT "1" confirm_all_linkto_files $B0/${V0}2/dir0/dir1 + +#Modify the xattrs of the linkto files on the removed brick to point to itself. + +target=$(cat $M0/.meta/graphs/active/$V0-dht/subvolumes/1/name) + +setfattr -n trusted.glusterfs.dht.linkto -v "$target\0" $B0/${V0}2/dir0/dir1/nfile* + + +TEST rm -rf $M0/dir0 + +cleanup; diff --git a/tests/bugs/distribute/bug-1786679.t b/tests/bugs/distribute/bug-1786679.t new file mode 100755 index 00000000000..219ce51c8a9 --- /dev/null +++ b/tests/bugs/distribute/bug-1786679.t @@ -0,0 +1,69 @@ +#!/bin/bash + +SCRIPT_TIMEOUT=250 + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc +. $(dirname $0)/../../dht.rc + + +# create 2 subvols +# create a dir +# create a file +# change layout +# remove the file +# execute create from a different mount +# Without the patch, the file will be present on both of the bricks + +cleanup + +function get_layout () { + +layout=`getfattr -n trusted.glusterfs.dht -e hex $1 2>&1 | grep dht | gawk -F"=" '{print $2}'` + +echo $layout + +} + +function set_layout() +{ + setfattr -n "trusted.glusterfs.dht" -v $1 $2 +} + +TEST glusterd +TEST pidof glusterd + +BRICK1=$B0/${V0}-0 +BRICK2=$B0/${V0}-1 + +TEST $CLI volume create $V0 $H0:$BRICK1 $H0:$BRICK2 +TEST $CLI volume start $V0 + +# Mount FUSE and create symlink +TEST glusterfs -s $H0 --volfile-id $V0 $M0 +TEST mkdir $M0/dir +TEST touch $M0/dir/file +TEST ! stat "$BRICK1/dir/file" +TEST stat "$BRICK2/dir/file" + +layout1="$(get_layout "$BRICK1/dir")" +layout2="$(get_layout "$BRICK2/dir")" + +TEST set_layout $layout1 "$BRICK2/dir" +TEST set_layout $layout2 "$BRICK1/dir" + +TEST rm $M0/dir/file -f +TEST gluster v set $V0 client-log-level DEBUG + +#Without the patch in place, this client will create the file in $BRICK2 +#which will lead to two files being on both the bricks when a new client +#create the file with the same name +TEST touch $M0/dir/file + +TEST glusterfs -s $H0 --volfile-id $V0 $M1 +TEST touch $M1/dir/file + +TEST stat "$BRICK1/dir/file" +TEST ! stat "$BRICK2/dir/file" + +cleanup diff --git a/tests/bugs/distribute/bug-853258.t b/tests/bugs/distribute/bug-853258.t index b2d7f2b771a..6817d9e2cd3 100755 --- a/tests/bugs/distribute/bug-853258.t +++ b/tests/bugs/distribute/bug-853258.t @@ -17,10 +17,11 @@ mkdir -p $H0:$B0/${V0}3 TEST $CLI volume create $V0 $H0:$B0/${V0}0 $H0:$B0/${V0}1 $H0:$B0/${V0}2 TEST $CLI volume start $V0 EXPECT_WITHIN $PROCESS_UP_TIMEOUT 'Started' volinfo_field $V0 'Status'; +TEST $CLI volume set $V0 cluster.weighted-rebalance off # Force assignment of initial ranges. TEST $CLI volume rebalance $V0 fix-layout start -EXPECT_WITHIN $REBALANCE_TIMEOUT "fix-layout completed" rebalance_status_field $V0 +EXPECT_WITHIN $REBALANCE_TIMEOUT "fix-layout completed" fix-layout_status_field $V0 # Get the original values. xattrs="" @@ -30,9 +31,10 @@ done # Expand the volume and force assignment of new ranges. TEST $CLI volume add-brick $V0 $H0:$B0/${V0}3 +EXPECT_WITHIN $PROCESS_UP_TIMEOUT "4" online_brick_count # Force assignment of initial ranges. TEST $CLI volume rebalance $V0 fix-layout start -EXPECT_WITHIN $REBALANCE_TIMEOUT "fix-layout completed" rebalance_status_field $V0 +EXPECT_WITHIN $REBALANCE_TIMEOUT "fix-layout completed" fix-layout_status_field $V0 for i in $(seq 0 3); do xattrs="$xattrs $(dht_get_layout $B0/${V0}$i)" diff --git a/tests/bugs/distribute/bug-860663.c b/tests/bugs/distribute/bug-860663.c index bee4e7d40b1..ca0c31ffe8f 100644 --- a/tests/bugs/distribute/bug-860663.c +++ b/tests/bugs/distribute/bug-860663.c @@ -6,38 +6,36 @@ #include <err.h> #include <sys/param.h> -int -main(argc, argv) - int argc; - char **argv; +int main(argc, argv) int argc; +char **argv; { - char *basepath; - char path[MAXPATHLEN + 1]; - unsigned int count; - int i, fd; + char *basepath; + char path[MAXPATHLEN + 1]; + unsigned int count; + int i, fd; - if (argc != 3) - errx(1, "usage: %s path count", argv[0]); + if (argc != 3) + errx(1, "usage: %s path count", argv[0]); - basepath = argv[1]; - count = atoi(argv[2]); + basepath = argv[1]; + count = atoi(argv[2]); - if (count > 999999) - errx(1, "count too big"); + if (count > 999999) + errx(1, "count too big"); - if (strlen(basepath) > MAXPATHLEN - 6) - errx(1, "path too long"); + if (strlen(basepath) > MAXPATHLEN - 6) + errx(1, "path too long"); - for (i = 0; i < count; i++) { - (void)sprintf(path, "%s%06d", basepath, i); + for (i = 0; i < count; i++) { + (void)sprintf(path, "%s%06d", basepath, i); - fd = open(path, O_CREAT|O_RDWR, 0644); - if (fd == -1) - err(1, "create %s failed", path); + fd = open(path, O_CREAT | O_RDWR, 0644); + if (fd == -1) + err(1, "create %s failed", path); - if (close(fd) != 0) - warn("close %s failed", path); - } + if (close(fd) != 0) + warn("close %s failed", path); + } - return 0; + return 0; } diff --git a/tests/bugs/distribute/bug-860663.t b/tests/bugs/distribute/bug-860663.t index a4946718398..59b8223ef3f 100644 --- a/tests/bugs/distribute/bug-860663.t +++ b/tests/bugs/distribute/bug-860663.t @@ -35,17 +35,15 @@ ORIG_FILE_COUNT=`ls -l $M0 | wc -l`; TEST [ $ORIG_FILE_COUNT -ge 1000 ] # Kill a brick process -kill -9 `cat $GLUSTERD_WORKDIR/vols/$V0/run/$H0-d-backends-${V0}1.pid`; +kill_brick $V0 $H0 $B0/${V0}1 -TEST ! $CLI volume rebalance $V0 fix-layout start +TEST $CLI volume rebalance $V0 fix-layout start + +EXPECT_WITHIN $REBALANCE_TIMEOUT "fix-layout failed" fix-layout_status_field $V0; TEST $CLI volume start $V0 force EXPECT_WITHIN $PROCESS_UP_TIMEOUT "1" brick_up_status $V0 $H0 $B0/${V0}1 -TEST $CLI volume rebalance $V0 fix-layout start - -EXPECT_WITHIN $REBALANCE_TIMEOUT "fix-layout completed" rebalance_status_field $V0; - # Unmount and remount to make sure we're doing fresh lookups. TEST umount $M0 TEST glusterfs -s $H0 --volfile-id $V0 $M0; diff --git a/tests/bugs/distribute/bug-862967.t b/tests/bugs/distribute/bug-862967.t index 07b053787ba..2fb0848bd7c 100644 --- a/tests/bugs/distribute/bug-862967.t +++ b/tests/bugs/distribute/bug-862967.t @@ -1,6 +1,7 @@ #!/bin/bash . $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc cleanup; @@ -36,7 +37,7 @@ chown 1:1 $M0/dir; # Kill a brick process -kill -9 `cat $GLUSTERD_WORKDIR/vols/$V0/run/$H0-d-backends-${V0}1.pid`; +kill_brick $V0 $H0 $B0/${V0}2 # change dir ownership NEW_UID=36; NEW_GID=36; @@ -50,9 +51,8 @@ sleep 10; ls -l $M0/dir; # check if uid/gid is healed on backend brick which was taken down -BACKEND_UID=`stat -c %u $B0/${V0}1/dir`; -BACKEND_GID=`stat -c %g $B0/${V0}1/dir`; - +BACKEND_UID=`stat -c %u $B0/${V0}2/dir`; +BACKEND_GID=`stat -c %g $B0/${V0}2/dir`; EXPECT "0" uid_gid_compare $NEW_UID $NEW_GID $BACKEND_UID $BACKEND_GID diff --git a/tests/bugs/distribute/bug-915554.t b/tests/bugs/distribute/bug-915554.t index 5caf4834b8c..1f59008c56f 100755 --- a/tests/bugs/distribute/bug-915554.t +++ b/tests/bugs/distribute/bug-915554.t @@ -59,7 +59,7 @@ done TEST $CLI volume rebalance $V0 start force -# check if rebalance has completed for upto 15 secs +# check if rebalance has completed for up to 15 secs EXPECT_WITHIN $REBALANCE_TIMEOUT "0" rebalance_completed diff --git a/tests/bugs/distribute/issue-1327.t b/tests/bugs/distribute/issue-1327.t new file mode 100755 index 00000000000..acd8c8c6614 --- /dev/null +++ b/tests/bugs/distribute/issue-1327.t @@ -0,0 +1,33 @@ +#!/bin/bash + +SCRIPT_TIMEOUT=250 + +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc +. $(dirname $0)/../../dht.rc + +cleanup + +TEST glusterd +TEST pidof glusterd + +BRICK1=$B0/${V0}-0 +BRICK2=$B0/${V0}-1 + +TEST $CLI volume create $V0 $H0:$BRICK1 $H0:$BRICK2 +TEST $CLI volume start $V0 + +TEST glusterfs -s $H0 --volfile-id $V0 $M0 +TEST mkdir $M0/dir + +#remove dir from one of the brick +TEST rmdir $BRICK2/dir + +#safe cache timeout for lookup to be triggered +sleep 2 + +TEST ls $M0/dir + +TEST stat $BRICK2/dir + +cleanup diff --git a/tests/bugs/distribute/overlap.py b/tests/bugs/distribute/overlap.py index 15f2da473f1..2813979787b 100755 --- a/tests/bugs/distribute/overlap.py +++ b/tests/bugs/distribute/overlap.py @@ -1,27 +1,27 @@ -#!/usr/bin/python +from __future__ import print_function import sys def calculate_one (ov, nv): - old_start = int(ov[18:26],16) - old_end = int(ov[26:34],16) - new_start = int(nv[18:26],16) - new_end = int(nv[26:34],16) + old_start = int(ov[18:26], 16) + old_end = int(ov[26:34], 16) + new_start = int(nv[18:26], 16) + new_end = int(nv[26:34], 16) if (new_end < old_start) or (new_start > old_end): #print '%s, %s -> ZERO' % (ov, nv) return 0 - all_start = max(old_start,new_start) - all_end = min(old_end,new_end) + all_start = max(old_start, new_start) + all_end = min(old_end, new_end) #print '%s, %s -> %08x' % (ov, nv, all_end - all_start + 1) return all_end - all_start + 1 def calculate_all (values): total = 0 - nv_index = len(values) / 2 + nv_index = len(values) // 2 for old_val in values[:nv_index]: new_val = values[nv_index] nv_index += 1 - total += calculate_one(old_val,new_val) + total += calculate_one(old_val, new_val) return total """ @@ -44,16 +44,16 @@ test2_vals = [ '0x000000000000000055555555aaaaaaa9', # second third ] -print '%08x' % calculate_one(test1_vals[0],test1_vals[3]) -print '%08x' % calculate_one(test1_vals[1],test1_vals[4]) -print '%08x' % calculate_one(test1_vals[2],test1_vals[5]) +print '%08x' % calculate_one(test1_vals[0], test1_vals[3]) +print '%08x' % calculate_one(test1_vals[1], test1_vals[4]) +print '%08x' % calculate_one(test1_vals[2], test1_vals[5]) print '= %08x' % calculate_all(test1_vals) -print '%08x' % calculate_one(test2_vals[0],test2_vals[3]) -print '%08x' % calculate_one(test2_vals[1],test2_vals[4]) -print '%08x' % calculate_one(test2_vals[2],test2_vals[5]) +print '%08x' % calculate_one(test2_vals[0], test2_vals[3]) +print '%08x' % calculate_one(test2_vals[1], test2_vals[4]) +print '%08x' % calculate_one(test2_vals[2], test2_vals[5]) print '= %08x' % calculate_all(test2_vals) """ if __name__ == '__main__': # Return decimal so bash can reason about it. - print '%d' % calculate_all(sys.argv[1:]) + print('%d' % calculate_all(sys.argv[1:])) |
