Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions go.mod1
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/BurntSushi/toml v0.3.1
github.com/DATA-DOG/go-sqlmock v1.5.0
github.com/aws/aws-sdk-go v1.35.3
github.com/carlmjohnson/flagext v0.20.2
github.com/carlmjohnson/flagext v0.21.0
github.com/cheggaaa/pb/v3 v3.0.5
github.com/cheynewallace/tabby v1.1.0
github.com/cockroachdb/pebble v0.0.0-20201023120638-f1224da22976
Expand All @@ -29,7 +29,7 @@ require (
github.com/pingcap/kvproto v0.0.0-20210308063835-39b884695fb8
github.com/pingcap/log v0.0.0-20201112100606-8f1e84a3abc8
github.com/pingcap/parser v0.0.0-20210310110710-c7333a4927e6
github.com/pingcap/tidb v1.1.0-beta.0.20210316114335-5ef1cc88f2da
github.com/pingcap/tidb v1.1.0-beta.0.20210318114336-c8226913d30e
github.com/pingcap/tidb-tools v4.0.9-0.20201127090955-2707c97b3853+incompatible
github.com/pingcap/tipb v0.0.0-20210309080453-72c4feaa6da7
github.com/prometheus/client_golang v1.5.1
Expand Down
8 changes: 4 additions & 4 deletions go.sum1
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ github.com/blacktear23/go-proxyprotocol v0.0.0-20180807104634-af7a81e8dd0d h1:rQ
github.com/blacktear23/go-proxyprotocol v0.0.0-20180807104634-af7a81e8dd0d/go.mod h1:VKt7CNAQxpFpSDz3sXyj9hY/GbVsQCr0sB3w59nE7lU=
github.com/cakturk/go-netstat v0.0.0-20200220111822-e5b49efee7a5 h1:BjkPE3785EwPhhyuFkbINB+2a1xATwk8SNDWnJiD41g=
github.com/cakturk/go-netstat v0.0.0-20200220111822-e5b49efee7a5/go.mod h1:jtAfVaU/2cu1+wdSRPWE2c1N2qeAA3K4RH9pYgqwets=
github.com/carlmjohnson/flagext v0.20.2 h1:qvpMM+TytSrlh3+EIVn/pzOwwq9y13hXZab6Y4Gvqpo=
github.com/carlmjohnson/flagext v0.20.2/go.mod h1:Eenv0epIUAr4NuedNmkzI8WmBmjIxZC239XcKxYS2ac=
github.com/carlmjohnson/flagext v0.21.0 h1:/c4uK3ie786Z7caXLcIMvePNSSiH3bQVGDvmGLMme60=
github.com/carlmjohnson/flagext v0.21.0/go.mod h1:Eenv0epIUAr4NuedNmkzI8WmBmjIxZC239XcKxYS2ac=
github.com/cenkalti/backoff/v4 v4.0.2/go.mod h1:eEew/i+1Q6OrCDZh3WiXYv3+nJwBASZ8Bog/87DQnVg=
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
github.com/certifi/gocertifi v0.0.0-20200211180108-c7c1fbc02894 h1:JLaf/iINcLyjwbtTsCJjc6rtlASgHeIJPrB6QmwURnA=
Expand Down Expand Up @@ -472,8 +472,8 @@ github.com/pingcap/parser v0.0.0-20210310110710-c7333a4927e6/go.mod h1:GbEr2PgY7
github.com/pingcap/sysutil v0.0.0-20200206130906-2bfa6dc40bcd/go.mod h1:EB/852NMQ+aRKioCpToQ94Wl7fktV+FNnxf3CX/TTXI=
github.com/pingcap/sysutil v0.0.0-20210221112134-a07bda3bde99 h1:/ogXgm4guJzow4UafiyXZ6ciAIPzxImaXYiFvTpKzKY=
github.com/pingcap/sysutil v0.0.0-20210221112134-a07bda3bde99/go.mod h1:EB/852NMQ+aRKioCpToQ94Wl7fktV+FNnxf3CX/TTXI=
github.com/pingcap/tidb v1.1.0-beta.0.20210316114335-5ef1cc88f2da h1:NlsVS2TGJs3Qr0D0kE0JoHAtDtyzo15MJUAXgCvR0fA=
github.com/pingcap/tidb v1.1.0-beta.0.20210316114335-5ef1cc88f2da/go.mod h1:7wnNVeMpjCbzgPw81BcGhDFl7lUGD/nmDh8/mjKBjZA=
github.com/pingcap/tidb v1.1.0-beta.0.20210318114336-c8226913d30e h1:RPPp/E3W8GoIw/AwYds3SvjOq+ms5oIVjXJ2MtnAwwE=
github.com/pingcap/tidb v1.1.0-beta.0.20210318114336-c8226913d30e/go.mod h1:7wnNVeMpjCbzgPw81BcGhDFl7lUGD/nmDh8/mjKBjZA=
github.com/pingcap/tidb-dashboard v0.0.0-20210312062513-eef5d6404638/go.mod h1:OzFN8H0EDMMqeulPhPMw2i2JaiZWOKFQ7zdRPhENNgo=
github.com/pingcap/tidb-tools v4.0.9-0.20201127090955-2707c97b3853+incompatible h1:ceznmu/lLseGHP/jKyOa/3u/5H3wtLLLqkH2V3ssSjg=
github.com/pingcap/tidb-tools v4.0.9-0.20201127090955-2707c97b3853+incompatible/go.mod h1:XGdcy9+yqlDSEMTpOXnwf3hiTeqrV6MN/u1se9N8yIM=
Expand Down
4 changes: 0 additions & 4 deletions pkg/task/restore.go
Original file line number Diff line number Diff line change
Expand Up @@ -472,10 +472,6 @@ func enableTiDBConfig() func() {
// when upstream and downstream both set this value greater than default(3072)
conf.MaxIndexLength = config.DefMaxOfMaxIndexLength
log.Warn("set max-index-length to max(3072*4) to skip check index length in DDL")

// we need set this to true, since all create table DDLs will create with tableInfo
// and we can handle alter drop pk/add pk DDLs with no impact
conf.AlterPrimaryKey = true
})
return restoreConfig
}
Expand Down
5 changes: 0 additions & 5 deletions tests/br_db/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
set -eu
DB="$TEST_NAME"

old_conf=$(run_sql "show config where name = 'alter-primary-key'" | awk '/Value/{print $2}')
run_sql "CREATE DATABASE $DB;"

run_sql "CREATE TABLE $DB.usertable1 ( \
Expand Down Expand Up @@ -56,8 +55,4 @@ echo "testing DDL query..."
run_curl https://$TIDB_STATUS_ADDR/ddl/history | grep -E '/\*from\(br\)\*/CREATE TABLE'
run_curl https://$TIDB_STATUS_ADDR/ddl/history | grep -E '/\*from\(br\)\*/CREATE DATABASE'

# test whether we have changed the cluster config.
new_conf=$(run_sql "show config where name = 'alter-primary-key'" | awk '/Value/{print $2}')
test "$old_conf" = "$new_conf"

run_sql "DROP DATABASE $DB;"
4 changes: 0 additions & 4 deletions tests/br_full/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ set -eu
DB="$TEST_NAME"
TABLE="usertable"
DB_COUNT=3
old_conf=$(run_sql "show config where name = 'alter-primary-key'")

for i in $(seq $DB_COUNT); do
run_sql "CREATE DATABASE $DB${i};"
Expand Down Expand Up @@ -89,9 +88,6 @@ for ct in limit lz4 zstd; do
fi
done

# test whether we have changed the cluster config.
test "$old_conf" = "$(run_sql "show config where name = 'alter-primary-key'")"

for i in $(seq $DB_COUNT); do
run_sql "DROP DATABASE $DB${i};"
done

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

# Schema lease duration
# There are lot of ddl in the tests, setting this
# to 360s to test whther BR is gracefully shutdown.
# to 360s to test whether BR is gracefully shutdown.
lease = "360s"

alter-primary-key = true
max-index-length = 12288

[security]
Expand Down
15 changes: 4 additions & 11 deletions tests/br_incompatible_tidb_config/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ source $cur/../_utils/run_services
DB="$TEST_NAME"

# prepare database
echo "Restart cluster with alter-primary-key = true, max-index-length=12288"
start_services --tidb-cfg $cur/config/tidb-alter-primary-key.toml
echo "Restart cluster with max-index-length=12288"
start_services --tidb-cfg $cur/config/tidb-max-index-length.toml

run_sql "drop schema if exists $DB;"
run_sql "create schema $DB;"
Expand All @@ -31,13 +31,13 @@ run_sql "create schema $DB;"
TABLE="t1"
INCREMENTAL_TABLE="t1inc"

run_sql "create table $DB.$TABLE (a int primary key, b int unique);"
run_sql "create table $DB.$TABLE (a int primary key nonclustered, b int unique);"
run_sql "insert into $DB.$TABLE values (42, 42);"

# backup
run_br --pd $PD_ADDR backup db --db "$DB" -s "local://$TEST_DIR/$DB$TABLE"

run_sql "create table $DB.$INCREMENTAL_TABLE (a int primary key, b int unique);"
run_sql "create table $DB.$INCREMENTAL_TABLE (a int primary key nonclustered, b int unique);"
run_sql "insert into $DB.$INCREMENTAL_TABLE values (42, 42);"

# drop pk
Expand Down Expand Up @@ -73,13 +73,6 @@ run_br --pd $PD_ADDR restore db --db "$DB" -s "local://$TEST_DIR/$DB$TABLE"

run_sql "drop schema $DB;"

# we need set auto_random to true and remove alter-primary-key otherwise we will get error
# invalid config allow-auto-random is unavailable when alter-primary-key is enabled

# enable column attribute `auto_random` to be defined on the primary key column.
echo "Restart cluster with allow-auto-random=true"
start_services --tidb-cfg $cur/config/tidb-allow-auto-random.toml

# test auto random issue https://github.com/pingcap/br/issues/228
TABLE="t3"
INCREMENTAL_TABLE="t3inc"
Expand Down