diff --git a/src/bin/pg_basebackup/pg_basebackup.cpp b/src/bin/pg_basebackup/pg_basebackup.cpp index 4dea6c8d5..8dd3f3f3b 100644 --- a/src/bin/pg_basebackup/pg_basebackup.cpp +++ b/src/bin/pg_basebackup/pg_basebackup.cpp @@ -57,8 +57,8 @@ char* label = "gs_basebackup base backup"; bool showprogress = false; int verbose = 0; int compresslevel = 0; -bool includewal = false; -bool streamwal = false; +bool includewal = true; +bool streamwal = true; bool fastcheckpoint = false; extern char** tblspaceDirectory; @@ -1927,21 +1927,9 @@ static int GsBaseBackup(int argc, char** argv) tablespace_list_append(optarg); break; case 'x': - if (includewal) { - fprintf(stderr, _("%s: cannot specify both --xlog and --xlog-method\n"), progname); - exit(1); - } - - includewal = true; streamwal = false; break; case 'X': - if (includewal) { - fprintf(stderr, _("%s: cannot specify both --xlog and --xlog-method\n"), progname); - exit(1); - } - - includewal = true; check_env_value_c(optarg); if (strcmp(optarg, "f") == 0 || strcmp(optarg, "fetch") == 0) streamwal = false; diff --git a/src/test/regress/input/gs_basebackup.source b/src/test/regress/input/gs_basebackup.source index 450a59e68..256f9dfc5 100644 --- a/src/test/regress/input/gs_basebackup.source +++ b/src/test/regress/input/gs_basebackup.source @@ -8,6 +8,8 @@ \! @abs_bindir@/gsql -dgs_basebackup -p @portstring@ -f "@abs_srcdir@/sql/gs_basebackup/init/mot.sql"; --pre +\! mkdir @abs_bindir@/../gs_basebackup_node_nstream_np +\! chmod 700 @abs_bindir@/../gs_basebackup_node_nstream_np \! mkdir @abs_bindir@/../gs_basebackup_node_stream_p \! chmod 700 @abs_bindir@/../gs_basebackup_node_stream_p \! mkdir @abs_bindir@/../gs_basebackup_node_fetch_t @@ -15,6 +17,7 @@ --run \! chmod +x @abs_srcdir@/script/gs_basebackup/gs_basebackup.sh +\! @abs_srcdir@/script/gs_basebackup/gs_basebackup.sh @abs_bindir@ @abs_srcdir@ @portstring@ gs_basebackup_node_nstream_np \! @abs_srcdir@/script/gs_basebackup/gs_basebackup.sh @abs_bindir@ @abs_srcdir@ @portstring@ gs_basebackup_node_stream_p stream p \! @abs_srcdir@/script/gs_basebackup/gs_basebackup.sh @abs_bindir@ @abs_srcdir@ @portstring@ gs_basebackup_node_fetch_t fetch t diff --git a/src/test/regress/output/gs_basebackup.source b/src/test/regress/output/gs_basebackup.source index b7ef8a60f..49d11784c 100644 --- a/src/test/regress/output/gs_basebackup.source +++ b/src/test/regress/output/gs_basebackup.source @@ -20,12 +20,44 @@ CREATE FOREIGN TABLE INSERT 0 1 --?total time: .* ms --pre +\! mkdir @abs_bindir@/../gs_basebackup_node_nstream_np +\! chmod 700 @abs_bindir@/../gs_basebackup_node_nstream_np \! mkdir @abs_bindir@/../gs_basebackup_node_stream_p \! chmod 700 @abs_bindir@/../gs_basebackup_node_stream_p \! mkdir @abs_bindir@/../gs_basebackup_node_fetch_t \! chmod 700 @abs_bindir@/../gs_basebackup_node_fetch_t --run \! chmod +x @abs_srcdir@/script/gs_basebackup/gs_basebackup.sh +\! @abs_srcdir@/script/gs_basebackup/gs_basebackup.sh @abs_bindir@ @abs_srcdir@ @portstring@ gs_basebackup_node_nstream_np +--?! [.*][.*][][gs_ctl]: gs_ctl status,datadir is -D ".*/gs_basebackup_node_nstream_np" +--?! gs_ctl: server is running (PID: .*) +--?!.* +--?.*List of tablespaces.* +--?.*Name.*|.*Owner.*|.*Location.* +--?--------------------------+.*+------------------------------------------------------------------------------------------------- +--? gs_basebackup_tablespace |.*| .*/gs_basebackup_tablespace +(1 row) + + tablespace +-------------------------- + gs_basebackup_tablespace +(1 row) + + a +--- + 1 +(1 row) + +--?total time: .* ms + a +--- + 1 +(1 row) + +--?total time: * ms +--?.*[gs_ctl]: gs_ctl stopped ,datadir is -D ".*/gs_basebackup_node_nstream_np" +--?waiting for server to shut down.* done +server stopped \! @abs_srcdir@/script/gs_basebackup/gs_basebackup.sh @abs_bindir@ @abs_srcdir@ @portstring@ gs_basebackup_node_stream_p stream p --?! [.*][.*][][gs_ctl]: gs_ctl status,datadir is -D ".*/gs_basebackup_node_stream_p" --?! gs_ctl: server is running (PID: .*) diff --git a/src/test/regress/script/gs_basebackup/gs_basebackup.sh b/src/test/regress/script/gs_basebackup/gs_basebackup.sh index 1bfccd4bf..2de211783 100644 --- a/src/test/regress/script/gs_basebackup/gs_basebackup.sh +++ b/src/test/regress/script/gs_basebackup/gs_basebackup.sh @@ -2,11 +2,18 @@ abs_bindir=$1 abs_srcdir=$2 abs_port=$3 dataNode=$4 -x_option=$5 -format=$6 -# backup -$abs_bindir/gs_basebackup -D $abs_bindir/../$dataNode -p $abs_port -X$x_option -F$format > $abs_bindir/../$dataNode.log 2>&1 -for gs_basebackup_port in {40015..60000}; +x_option=${5-} +format=${6-} +# backup +if [ 'x'${x_option} == 'x' ] +then + # Compatible with old functions + $abs_bindir/gs_basebackup -D $abs_bindir/../$dataNode -p $abs_port > $abs_bindir/../$dataNode.log 2>&1 +else + $abs_bindir/gs_basebackup -D $abs_bindir/../$dataNode -p $abs_port -X$x_option -F$format > $abs_bindir/../$dataNode.log 2>&1 +fi + +for gs_basebackup_port in {4000..60000}; do if [ 'x'`netstat -an | grep -v STREAM | grep -v DGRAM | grep $gs_basebackup_port | head -n1 | awk '{print $1}'` == 'x' ]; then @@ -14,7 +21,7 @@ do fi; done; -if [ $format == 't' ] +if [ 'x'$format == 'xt' ] then tmp_dir="$abs_bindir/../$dataNode/../tmp" mv $abs_bindir/../$dataNode/* $abs_bindir/../$dataNode/../