diff --git a/go.mod1 b/go.mod1 index 3b572757d..87f7e4c3a 100644 --- a/go.mod1 +++ b/go.mod1 @@ -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 @@ -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 diff --git a/go.sum1 b/go.sum1 index 820fae6d7..fd74331dc 100644 --- a/go.sum1 +++ b/go.sum1 @@ -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= @@ -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= diff --git a/pkg/task/restore.go b/pkg/task/restore.go index 1b1fb4dee..f3a42abb7 100644 --- a/pkg/task/restore.go +++ b/pkg/task/restore.go @@ -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 } diff --git a/tests/br_db/run.sh b/tests/br_db/run.sh index 8cec53b10..689deb6b6 100755 --- a/tests/br_db/run.sh +++ b/tests/br_db/run.sh @@ -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 ( \ @@ -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;" diff --git a/tests/br_full/run.sh b/tests/br_full/run.sh index 5079b159a..4ef0abb82 100755 --- a/tests/br_full/run.sh +++ b/tests/br_full/run.sh @@ -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};" @@ -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 diff --git a/tests/br_incompatible_tidb_config/config/tidb-allow-auto-random.toml b/tests/br_incompatible_tidb_config/config/tidb-allow-auto-random.toml deleted file mode 100644 index 85bc6e01a..000000000 --- a/tests/br_incompatible_tidb_config/config/tidb-allow-auto-random.toml +++ /dev/null @@ -1,19 +0,0 @@ -# config of tidb - -# Schema lease duration -# There are lot of ddl in the tests, setting this -# to 360s to test whther BR is gracefully shutdown. -lease = "360s" - -max-index-length = 12288 - -[security] -ssl-ca = "/tmp/backup_restore_test/certs/ca.pem" -ssl-cert = "/tmp/backup_restore_test/certs/tidb.pem" -ssl-key = "/tmp/backup_restore_test/certs/tidb.key" -cluster-ssl-ca = "/tmp/backup_restore_test/certs/ca.pem" -cluster-ssl-cert = "/tmp/backup_restore_test/certs/tidb.pem" -cluster-ssl-key = "/tmp/backup_restore_test/certs/tidb.key" - -[experimental] -allow-auto-random = true diff --git a/tests/br_incompatible_tidb_config/config/tidb-alter-primary-key.toml b/tests/br_incompatible_tidb_config/config/tidb-max-index-length.toml similarity index 86% rename from tests/br_incompatible_tidb_config/config/tidb-alter-primary-key.toml rename to tests/br_incompatible_tidb_config/config/tidb-max-index-length.toml index 4a430b089..59b891357 100644 --- a/tests/br_incompatible_tidb_config/config/tidb-alter-primary-key.toml +++ b/tests/br_incompatible_tidb_config/config/tidb-max-index-length.toml @@ -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] diff --git a/tests/br_incompatible_tidb_config/run.sh b/tests/br_incompatible_tidb_config/run.sh index a35e64726..0b9040e6b 100755 --- a/tests/br_incompatible_tidb_config/run.sh +++ b/tests/br_incompatible_tidb_config/run.sh @@ -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;" @@ -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 @@ -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"