Skip to content

Commit

Permalink
tests: turn on the tidb_enable_change_multi_schema switch in some tes…
Browse files Browse the repository at this point in the history
…ts (#1194) (#1195)

Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
  • Loading branch information
ti-srebot authored Dec 22, 2020
1 parent c0654e3 commit 83eb99e
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
16 changes: 14 additions & 2 deletions tests/common_1/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,19 @@ function run() {

cd $WORK_DIR

tidb_build_branch=$(mysql -uroot -h${UP_TIDB_HOST} -P${UP_TIDB_PORT} -e \
"select tidb_version()\G"|grep "Git Branch"|awk -F: '{print $(NF)}'|tr -d " ")
# TODO: refine the release detection after 5.0 tag of TiDB is ready
if [[ $tidb_build_branch =~ ^(master)$ ]]; then
# https://github.com/pingcap/tidb/pull/21533 disables multi_schema change
# feature by default, turn it on first
run_sql "set global tidb_enable_change_multi_schema = on" ${UP_TIDB_HOST} ${UP_TIDB_PORT}
# This must be set before cdc server starts
run_sql "set global tidb_enable_change_multi_schema = on" ${DOWN_TIDB_HOST} ${DOWN_TIDB_PORT}
# TiDB global variables cache 2 seconds at most
sleep 2
fi

# record tso before we create tables to skip the system table DDLs
start_ts=$(run_cdc_cli tso query --pd=http://$UP_PD_HOST_1:$UP_PD_PORT_1)

Expand All @@ -31,8 +44,7 @@ function run() {
fi

run_sql_file $CUR/data/test.sql ${UP_TIDB_HOST} ${UP_TIDB_PORT}
tidb_build_branch=$(mysql -uroot -h${UP_TIDB_HOST} -P${UP_TIDB_PORT} -e \
"select tidb_version()\G"|grep "Git Branch"|awk -F: '{print $(NF)}'|tr -d " ")
# TODO: refine the release detection after 5.0 tag of TiDB is ready
if [[ ! $tidb_build_branch =~ ^(master)$ ]]; then
echo "skip some SQLs in tidb v4.0.x"
else
Expand Down
16 changes: 14 additions & 2 deletions tests/ddl_reentrant/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ ddls=("create database ddl_reentrant" false
)

function complete_ddls() {
tidb_build_branch=$(mysql -uroot -h${UP_TIDB_HOST} -P${UP_TIDB_PORT} -e \
"select tidb_version()\G"|grep "Git Branch"|awk -F: '{print $(NF)}'|tr -d " ")
# TODO: refine the release detection after 5.0 tag of TiDB is ready
if [[ ! $tidb_build_branch =~ master ]]; then
echo "skip some DDLs in tidb v4.0.x"
else
Expand Down Expand Up @@ -87,6 +86,9 @@ function check_ddl_executed() {
export -f check_ts_forward
export -f check_ddl_executed

tidb_build_branch=$(mysql -uroot -h${UP_TIDB_HOST} -P${UP_TIDB_PORT} -e \
"select tidb_version()\G"|grep "Git Branch"|awk -F: '{print $(NF)}'|tr -d " ")

function ddl_test() {
ddl=$1
is_reentrant=$2
Expand Down Expand Up @@ -118,6 +120,16 @@ function run() {
start_tidb_cluster --workdir $WORK_DIR --tidb-config $CUR/conf/tidb_config.toml

complete_ddls
# TODO: refine the release detection after 5.0 tag of TiDB is ready
if [[ $tidb_build_branch =~ master ]]; then
# https://github.com/pingcap/tidb/pull/21533 disables multi_schema change
# feature by default, turn it on first
run_sql "set global tidb_enable_change_multi_schema = on" ${UP_TIDB_HOST} ${UP_TIDB_PORT}
# This must be set before cdc server starts
run_sql "set global tidb_enable_change_multi_schema = on" ${DOWN_TIDB_HOST} ${DOWN_TIDB_PORT}
# TiDB global variables cache 2 seconds at most
sleep 2
fi

cd $WORK_DIR

Expand Down

0 comments on commit 83eb99e

Please sign in to comment.