diff options
-rw-r--r-- | geo-replication/gsyncd.conf.in | 6 | ||||
-rw-r--r-- | geo-replication/syncdaemon/argsupgrade.py | 8 | ||||
-rw-r--r-- | geo-replication/syncdaemon/gsyncd.py | 4 | ||||
-rw-r--r-- | tests/00-geo-rep/georep-basic-dr-rsync.t | 50 | ||||
-rw-r--r-- | tests/00-geo-rep/georep-basic-dr-tarssh.t | 46 | ||||
-rw-r--r-- | tests/geo-rep.rc | 188 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-geo-rep.c | 5 | ||||
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 4 |
8 files changed, 251 insertions, 60 deletions
diff --git a/geo-replication/gsyncd.conf.in b/geo-replication/gsyncd.conf.in index 0a842cf2be..58ca6275b7 100644 --- a/geo-replication/gsyncd.conf.in +++ b/geo-replication/gsyncd.conf.in @@ -301,10 +301,12 @@ value= value= [rsync-opt-ignore-missing-args] -value= +value=true +type=bool [rsync-opt-existing] -value= +value=true +type=bool [log-rsync-performance] value=false diff --git a/geo-replication/syncdaemon/argsupgrade.py b/geo-replication/syncdaemon/argsupgrade.py index a97c748c40..d20f18ea84 100644 --- a/geo-replication/syncdaemon/argsupgrade.py +++ b/geo-replication/syncdaemon/argsupgrade.py @@ -258,7 +258,9 @@ def upgrade(): p = ArgumentParser() p.add_argument("master") p.add_argument("slave") - p.add_argument("--config-set", nargs=2) + p.add_argument("--config-set", action='store_true') + p.add_argument("name") + p.add_argument("--value") p.add_argument("-c") pargs = p.parse_known_args(sys.argv[1:])[0] @@ -270,8 +272,8 @@ def upgrade(): "config-set", pargs.master.strip(":"), slave_url(pargs.slave), - pargs.config_set[0], - pargs.config_set[1] + "--name=%s" % pargs.name, + "--value=%s" % pargs.value ] elif "--config-check" in sys.argv: # --config-check georep_session_working_dir diff --git a/geo-replication/syncdaemon/gsyncd.py b/geo-replication/syncdaemon/gsyncd.py index 1ab6587746..bda7e545a2 100644 --- a/geo-replication/syncdaemon/gsyncd.py +++ b/geo-replication/syncdaemon/gsyncd.py @@ -154,8 +154,8 @@ def main(): p = sp.add_parser("config-set") p.add_argument("master", help="Master Volume Name") p.add_argument("slave", help="Slave") - p.add_argument("name", help="Config Name") - p.add_argument("value", help="Config Value") + p.add_argument("-n", "--name", help="Config Name") + p.add_argument("-v", "--value", help="Config Value") p.add_argument("-c", "--config-file", help="Config File") p.add_argument("--debug", action="store_true") diff --git a/tests/00-geo-rep/georep-basic-dr-rsync.t b/tests/00-geo-rep/georep-basic-dr-rsync.t index 7c8499fa5d..4c330de1c1 100644 --- a/tests/00-geo-rep/georep-basic-dr-rsync.t +++ b/tests/00-geo-rep/georep-basic-dr-rsync.t @@ -9,8 +9,6 @@ SCRIPT_TIMEOUT=500 AREQUAL_PATH=$(dirname $0)/../utils test "`uname -s`" != "Linux" && { - CFLAGS="$CFLAGS -I$(dirname $0)/../../../contrib/argp-standalone "; - CFLAGS="$CFLAGS -L$(dirname $0)/../../../contrib/argp-standalone -largp "; CFLAGS="$CFLAGS -lintl"; } build_tester $AREQUAL_PATH/arequal-checksum.c $CFLAGS @@ -116,8 +114,8 @@ EXPECT_WITHIN $GEO_REP_TIMEOUT 2 check_status_num_rows "Passive" #data_tests "history" EXPECT_WITHIN $GEO_REP_TIMEOUT 0 regular_file_ok ${slave_mnt}/history_f1 EXPECT_WITHIN $GEO_REP_TIMEOUT 0 directory_ok ${slave_mnt}/history_d1 -EXPECT_WITHIN $GEO_REP_TIMEOUT 0 rename_ok ${slave_mnt}/history_f3 ${slave_mnt}/history_f4 -EXPECT_WITHIN $GEO_REP_TIMEOUT 0 rename_ok ${slave_mnt}/history_d3 ${slave_mnt}/history_d4 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 rename_file_ok ${slave_mnt}/history_f3 ${slave_mnt}/history_f4 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 rename_dir_ok ${slave_mnt}/history_d3 ${slave_mnt}/history_d4 EXPECT_WITHIN $GEO_REP_TIMEOUT 0 symlink_ok history_f1 ${slave_mnt}/history_sl1 EXPECT_WITHIN $GEO_REP_TIMEOUT 0 hardlink_file_ok ${slave_mnt}/history_f1 ${slave_mnt}/history_hl1 EXPECT_WITHIN $GEO_REP_TIMEOUT 1 unlink_ok ${slave_mnt}/history_f2 @@ -147,8 +145,8 @@ hardlink_rename ${master_mnt}/hardlink_rename_test_file #data_tests "changelog" EXPECT_WITHIN $GEO_REP_TIMEOUT 0 regular_file_ok ${slave_mnt}/changelog_f1 EXPECT_WITHIN $GEO_REP_TIMEOUT 0 directory_ok ${slave_mnt}/changelog_d1 -EXPECT_WITHIN $GEO_REP_TIMEOUT 0 rename_ok ${slave_mnt}/changelog_f3 ${slave_mnt}/changelog_f4 -EXPECT_WITHIN $GEO_REP_TIMEOUT 0 rename_ok ${slave_mnt}/changelog_d3 ${slave_mnt}/changelog_d4 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 rename_file_ok ${slave_mnt}/changelog_f3 ${slave_mnt}/changelog_f4 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 rename_dir_ok ${slave_mnt}/changelog_d3 ${slave_mnt}/changelog_d4 EXPECT_WITHIN $GEO_REP_TIMEOUT 0 symlink_ok changelog_f1 ${slave_mnt}/changelog_sl1 EXPECT_WITHIN $GEO_REP_TIMEOUT 0 hardlink_file_ok ${slave_mnt}/changelog_f1 ${slave_mnt}/changelog_hl1 EXPECT_WITHIN $GEO_REP_TIMEOUT 1 unlink_ok ${slave_mnt}/changelog_f2 @@ -169,6 +167,45 @@ EXPECT_WITHIN $GEO_REP_TIMEOUT 0 hardlink_rename_ok ${slave_mnt}/hardlink_rename #Stop Geo-rep TEST $GEOREP_CLI $master $slave stop +#Symlink testcase: Rename symlink and create dir with same name +TEST create_symlink_rename_mkdir_data + +#hardlink-rename-unlink usecase. Sonatype Nexus3 Usecase. BUG:1512483 +TEST create_hardlink_rename_data + +#rsnapshot usecase +TEST create_rsnapshot_data + +#Start Geo-rep +TEST $GEOREP_CLI $master $slave start + +#Wait for geo-rep to come up +EXPECT_WITHIN $GEO_REP_TIMEOUT 2 check_status_num_rows "Active" +EXPECT_WITHIN $GEO_REP_TIMEOUT 2 check_status_num_rows "Passive" + +#Check for hardlink rename case. BUG: 1296174 +#It should not create src file again on changelog reprocessing +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 hardlink_rename_ok ${slave_mnt}/hardlink_rename_test_file + +#Symlink testcase: Rename symlink and create dir with same name +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 verify_symlink_rename_mkdir_data ${slave_mnt}/symlink_test1 + +#hardlink-rename-unlink usecase. Sonatype Nexus3 Usecase. BUG:1512483 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 verify_hardlink_rename_data ${slave_mnt} + +#rsnapshot usecase +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 verify_rsnapshot_data ${slave_mnt} + +#Test rsync-options set BUG:1629561 +TEST gluster volume geo-rep $master $slave config rsync-options "--whole-file" +TEST "echo sampledata > $master_mnt/rsync_option_test_file" + +#Verify arequal for whole volume +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 arequal_checksum ${master_mnt} ${slave_mnt} + +#Stop Geo-rep +TEST $GEOREP_CLI $master $slave stop + #Delete Geo-rep TEST $GEOREP_CLI $master $slave delete @@ -181,4 +218,3 @@ sed -i '/^command=.*gsyncd.*/d' ~/.ssh/authorized_keys cleanup; #G_TESTDEF_TEST_STATUS_NETBSD7=BAD_TEST,BUG=000000 -#G_TESTDEF_TEST_STATUS_CENTOS6=KNOWN_ISSUE,BUG=1537602 diff --git a/tests/00-geo-rep/georep-basic-dr-tarssh.t b/tests/00-geo-rep/georep-basic-dr-tarssh.t index cbcad80ba7..20a0a87331 100644 --- a/tests/00-geo-rep/georep-basic-dr-tarssh.t +++ b/tests/00-geo-rep/georep-basic-dr-tarssh.t @@ -9,8 +9,6 @@ SCRIPT_TIMEOUT=500 AREQUAL_PATH=$(dirname $0)/../utils test "`uname -s`" != "Linux" && { - CFLAGS="$CFLAGS -I$(dirname $0)/../../../contrib/argp-standalone "; - CFLAGS="$CFLAGS -L$(dirname $0)/../../../contrib/argp-standalone -largp "; CFLAGS="$CFLAGS -lintl"; } build_tester $AREQUAL_PATH/arequal-checksum.c $CFLAGS @@ -119,8 +117,8 @@ EXPECT_WITHIN $GEO_REP_TIMEOUT 2 check_status_num_rows "Passive" #data_tests "history" EXPECT_WITHIN $GEO_REP_TIMEOUT 0 regular_file_ok ${slave_mnt}/history_f1 EXPECT_WITHIN $GEO_REP_TIMEOUT 0 directory_ok ${slave_mnt}/history_d1 -EXPECT_WITHIN $GEO_REP_TIMEOUT 0 rename_ok ${slave_mnt}/history_f3 ${slave_mnt}/history_f4 -EXPECT_WITHIN $GEO_REP_TIMEOUT 0 rename_ok ${slave_mnt}/history_d3 ${slave_mnt}/history_d4 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 rename_file_ok ${slave_mnt}/history_f3 ${slave_mnt}/history_f4 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 rename_dir_ok ${slave_mnt}/history_d3 ${slave_mnt}/history_d4 EXPECT_WITHIN $GEO_REP_TIMEOUT 0 symlink_ok history_f1 ${slave_mnt}/history_sl1 EXPECT_WITHIN $GEO_REP_TIMEOUT 0 hardlink_file_ok ${slave_mnt}/history_f1 ${slave_mnt}/history_hl1 EXPECT_WITHIN $GEO_REP_TIMEOUT 1 unlink_ok ${slave_mnt}/history_f2 @@ -150,8 +148,8 @@ hardlink_rename ${master_mnt}/hardlink_rename_test_file #data_tests "changelog" EXPECT_WITHIN $GEO_REP_TIMEOUT 0 regular_file_ok ${slave_mnt}/changelog_f1 EXPECT_WITHIN $GEO_REP_TIMEOUT 0 directory_ok ${slave_mnt}/changelog_d1 -EXPECT_WITHIN $GEO_REP_TIMEOUT 0 rename_ok ${slave_mnt}/changelog_f3 ${slave_mnt}/changelog_f4 -EXPECT_WITHIN $GEO_REP_TIMEOUT 0 rename_ok ${slave_mnt}/changelog_d3 ${slave_mnt}/changelog_d4 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 rename_file_ok ${slave_mnt}/changelog_f3 ${slave_mnt}/changelog_f4 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 rename_dir_ok ${slave_mnt}/changelog_d3 ${slave_mnt}/changelog_d4 EXPECT_WITHIN $GEO_REP_TIMEOUT 0 symlink_ok changelog_f1 ${slave_mnt}/changelog_sl1 EXPECT_WITHIN $GEO_REP_TIMEOUT 0 hardlink_file_ok ${slave_mnt}/changelog_f1 ${slave_mnt}/changelog_hl1 EXPECT_WITHIN $GEO_REP_TIMEOUT 1 unlink_ok ${slave_mnt}/changelog_f2 @@ -172,6 +170,41 @@ EXPECT_WITHIN $GEO_REP_TIMEOUT 0 hardlink_rename_ok ${slave_mnt}/hardlink_rename #Stop Geo-rep TEST $GEOREP_CLI $master $slave stop +#Symlink testcase: Rename symlink and create dir with same name +TEST create_symlink_rename_mkdir_data + +#hardlink-rename-unlink usecase. Sonatype Nexus3 Usecase. BUG:1512483 +TEST create_hardlink_rename_data + +#rsnapshot usecase +TEST create_rsnapshot_data + +#Start Geo-rep +TEST $GEOREP_CLI $master $slave start + +#Wait for geo-rep to come up +EXPECT_WITHIN $GEO_REP_TIMEOUT 2 check_status_num_rows "Active" +EXPECT_WITHIN $GEO_REP_TIMEOUT 2 check_status_num_rows "Passive" + +#Check for hardlink rename case. BUG: 1296174 +#It should not create src file again on changelog reprocessing +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 hardlink_rename_ok ${slave_mnt}/hardlink_rename_test_file + +#Symlink testcase: Rename symlink and create dir with same name +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 verify_symlink_rename_mkdir_data ${slave_mnt}/symlink_test1 + +#hardlink-rename-unlink usecase. Sonatype Nexus3 Usecase. BUG:1512483 +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 verify_hardlink_rename_data ${slave_mnt} + +#rsnapshot usecase +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 verify_rsnapshot_data ${slave_mnt} + +#Verify arequal for whole volume +EXPECT_WITHIN $GEO_REP_TIMEOUT 0 arequal_checksum ${master_mnt} ${slave_mnt} + +#Stop Geo-rep +TEST $GEOREP_CLI $master $slave stop + #Delete Geo-rep TEST $GEOREP_CLI $master $slave delete @@ -184,4 +217,3 @@ sed -i '/^command=.*gsyncd.*/d' ~/.ssh/authorized_keys cleanup; #G_TESTDEF_TEST_STATUS_NETBSD7=BAD_TEST,BUG=000000 -#G_TESTDEF_TEST_STATUS_CENTOS6=BAD_TEST,BUG=1537602 diff --git a/tests/geo-rep.rc b/tests/geo-rep.rc index 8c5391dbfa..c33ceaaa64 100644 --- a/tests/geo-rep.rc +++ b/tests/geo-rep.rc @@ -1,4 +1,4 @@ -GEO_REP_TIMEOUT=60 +GEO_REP_TIMEOUT=120 function check_status_num_rows() { @@ -43,7 +43,7 @@ function create_data() # dir mkdir ${master_mnt}/${prefix}_d1 mkdir ${master_mnt}/${prefix}_d2 - touch ${master_mnt}/${prefix}_d3 + mkdir ${master_mnt}/${prefix}_d3 # Hardlink ln ${master_mnt}/${prefix}_f1 ${master_mnt}/${prefix}_hl1 @@ -102,17 +102,20 @@ function hardlink_file_ok() orig_inode=$(stat --format "%i" "$orig_file") rc=$? - if test $rc != 0; then echo $rc; fi - - link_inode=$(stat --format "%i" "$link_file") - rc=$? - if test $rc != 0; then echo $rc; fi - - if test $orig_inode != $link_inode - then - echo 1 + if test $rc != 0; then + echo $rc else - echo 0 + link_inode=$(stat --format "%i" "$link_file") + rc=$? + if test $rc != 0; then + echo $rc + else + if test $orig_inode != $link_inode; then + echo 1 + else + echo 0 + fi + fi fi } @@ -123,8 +126,7 @@ function data_ok() data2=$(cat $path) echo "data1:$data1" echo "data2:$data2" - if test "X$data1" != "X$data2" - then + if test "X$data1" != "X$data2"; then echo 1 else echo 0 @@ -144,38 +146,62 @@ function symlink_ok() local symlink_file=$2 local file_type=$(stat --format "%F" "$symlink_file") - if test "X$file_type" != "Xsymbolic link"; then echo 1;else echo 0; fi + if test "X$file_type" != "Xsymbolic link"; then + echo 1 + else + local fname=$(readlink $symlink_file) + if test "X$fname" != "X$orig_file_name"; then + echo 1 + else + echo 0 + fi + fi - local fname=$(readlink $symlink_file) - if test "X$fname" != "X$orig_file_name"; then echo 1;else echo 0; fi } -function rename_ok() +function rename_file_ok() { old_name=$1 new_name=$2 - if [ -f $old_name ] - then + if [ -f $old_name ]; then + echo 1 + elif [ ! -f $new_name ]; then echo 1 + else + echo 0 fi +} - if [ ! -f $new_name ] - then +function rename_dir_ok() +{ + old_name=$1 + new_name=$2 + + if [ -d $old_name ]; then + echo 1 + elif [ ! -d $new_name ]; then echo 1 + else + echo 0 fi - echo 0 } function create_georep_session() { $CLI system:: execute gsec_create rc=$? - if test $rc != 0; then echo $rc; fi - $CLI volume geo-rep $master $slave create push-pem - rc=$? - if test $rc != 0; then echo $rc; fi - echo 0 + if test $rc != 0; then + echo $rc + else + $CLI volume geo-rep $master $slave create push-pem + rc=$? + if test $rc != 0; then + echo $rc + else + echo 0 + fi + fi } # logrotate_simulate should be called (rotate_count + 1) times to cause @@ -224,9 +250,10 @@ function create_rename_ok() # to be recreated i.e. a dangling entry without a corresponding # back-end gfid link should not exist on the slave if [ -f "$file_name" ]; then - echo 1 + echo 1 + else + echo 0 fi - echo 0 } function hardlink_rename() @@ -234,16 +261,107 @@ function hardlink_rename() file_name=$1 echo $file_name > $file_name ln $file_name $file_name.hl - mv $file_name.hl $file_name + mv $file_name.hl $file_name.hl1 } function hardlink_rename_ok() { file_name=$1 # the hardlink file should not exist on the slave after renaming - # to one of its links - if [ -f "$file_name.hl" ]; then - echo 1 + # to one of its links on changelog reprocessing + if [ ! -f "$file_name" ]; then + echo 1 + elif [ ! -f "$file_name.hl1" ]; then + echo 1 + elif [ -f "$file_name.hl" ]; then + echo 1 + else + echo 0 + fi +} + +function create_symlink_rename_mkdir_data() +{ + mkdir ${master_mnt}/symlink_test1 + touch ${master_mnt}/symlink_test1/file1 + ln -s "./file1" ${master_mnt}/symlink_test1/sym_link + mv ${master_mnt}/symlink_test1/sym_link ${master_mnt}/symlink_test1/rn_sym_link + mkdir ${master_mnt}/symlink_test1/sym_link +} +function verify_symlink_rename_mkdir_data() +{ + sym_dir=$1 + if [ ! -f $sym_dir/file1 ]; then + echo 1 + elif [ ! -h $sym_dir/rn_sym_link ]; then + echo 1 + elif [ ! -d $sym_dir/sym_link ]; then + echo 1 + else + echo 0 + fi +} + +function create_rsnapshot_data() +{ + rm -rf /tmp/rsnapshot_symlinkbug + mkdir /tmp/rsnapshot_symlinkbug + ln -f -s /does/not/exist /tmp/rsnapshot_symlinkbug/a_symlink + rsync -a /tmp/rsnapshot_symlinkbug ${master_mnt}/ + cp -al ${master_mnt}/rsnapshot_symlinkbug ${master_mnt}/rsnapshot_symlinkbug.0 + ln -f -s /does/not/exist2 /tmp/rsnapshot_symlinkbug/a_symlink + rsync -a /tmp/rsnapshot_symlinkbug ${master_mnt}/ + cp -al ${master_mnt}/rsnapshot_symlinkbug ${master_mnt}/rsnapshot_symlinkbug.1 +} + +function verify_rsnapshot_data() +{ + dir="$1/rsnapshot_symlinkbug" + dir0="$1/rsnapshot_symlinkbug.0" + dir1="$1/rsnapshot_symlinkbug.1" + if [ ! -d "$dir" ]; then + echo 1 + elif [ ! -h $dir/a_symlink ]; then + echo 1 + elif test "X$(readlink $dir/a_symlink)" != "X/does/not/exist2"; then + echo 1 + elif [ ! -h $dir0/a_symlink ]; then + echo 1 + elif test "X$(readlink $dir0/a_symlink)" != "X/does/not/exist"; then + echo 1 + elif [ ! -h $dir1/a_symlink ]; then + echo 1 + elif test "X$(readlink $dir1/a_symlink)" != "X/does/not/exist2"; then + echo 1 + else + echo 0 + fi +} + +function create_hardlink_rename_data() +{ + dir=${master_mnt}/hardlink_rename_issue + mkdir $dir + echo "test_data" > $dir/f1 + ln $dir/f1 $dir/f2 + mv $dir/f2 $dir/f3 + unlink $dir/f1 +} + +function verify_hardlink_rename_data() +{ + dir=$1/hardlink_rename_issue + if [ ! -d $dir ]; then + echo 1 + elif [ -f $dir/f1 ]; then + echo 1 + elif [ -f $dir/f2 ]; then + echo 1 + elif [ ! -f $dir/f3 ]; then + echo 1 + elif test "Xtest_data" != "X$(cat $dir/f3)"; then + echo 1 + else + echo 0 fi - echo 0 } diff --git a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c index 688b995f0e..51d4da5d73 100644 --- a/xlators/mgmt/glusterd/src/glusterd-geo-rep.c +++ b/xlators/mgmt/glusterd/src/glusterd-geo-rep.c @@ -4185,8 +4185,9 @@ glusterd_gsync_configure (glusterd_volinfo_t *volinfo, char *slave, runner_add_arg (&runner, slave); runner_argprintf (&runner, "--config-%s", subop); runner_add_arg (&runner, op_name); - if (op_value) - runner_add_arg (&runner, op_value); + if (op_value) { + runner_argprintf (&runner, "--value=%s", op_value); + } if ( strcmp(op_name,"checkpoint") != 0 && strtail (subop, "set")) { ret = glusterd_gsync_op_already_set(master,slave,conf_path, diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index ad337251b2..a1fd62da07 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -7943,8 +7943,8 @@ glusterd_start_gsync (glusterd_volinfo_t *master_vol, char *slave, path_list, "-c", NULL); runner_argprintf (&runner, "%s", conf_path); runner_argprintf (&runner, ":%s", master_vol->volname); - runner_add_args (&runner, slave, "--config-set", "session-owner", - uuid_str, NULL); + runner_add_args (&runner, slave, "--config-set", "session-owner", NULL); + runner_argprintf (&runner, "--value=%s", uuid_str); synclock_unlock (&priv->big_lock); ret = runner_run (&runner); synclock_lock (&priv->big_lock); |