Skip to content

Commit

Permalink
dependency: remove alter-primary config (pingcap#1522)
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-srebot authored Mar 19, 2021
1 parent da1565c commit 659a125
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 58 deletions.
11 changes: 5 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@ require (
github.com/pingcap/errors v0.11.5-0.20201126102027-b0a155152ca3
github.com/pingcap/failpoint v0.0.0-20200702092429-9f69995143ce
github.com/pingcap/log v0.0.0-20201112100606-8f1e84a3abc8
github.com/pingcap/parser v0.0.0-20210224050355-ce3c7711a45f
github.com/pingcap/tidb v1.1.0-beta.0.20210224053248-b226130926a2
github.com/pingcap/parser v0.0.0-20210311132237-9841cb715606
github.com/pingcap/tidb v1.1.0-beta.0.20210319021734-e79ac3d978cf
github.com/pingcap/tidb-tools v5.0.0-rc.0.20210310030049-c82efd92f571+incompatible
github.com/prometheus/client_golang v1.5.1
github.com/rakyll/statik v0.1.6
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 // indirect
github.com/siddontang/go v0.0.0-20180604090527-bdc77568d726
github.com/siddontang/go-mysql v1.1.1-0.20200824131207-0c5789dd0bd3
github.com/soheilhy/cmux v0.1.4
Expand All @@ -35,17 +34,17 @@ require (
github.com/syndtr/goleveldb v1.0.1-0.20190625010220-02440ea7a285
github.com/tidwall/gjson v1.6.1
github.com/tidwall/sjson v1.1.2
github.com/tikv/pd v1.1.0-beta.0.20210204070145-eb7fc53a8d98
github.com/tikv/pd v1.1.0-beta.0.20210312145855-81f0b7adb7d6
github.com/unrolled/render v1.0.1
go.etcd.io/etcd v0.5.0-alpha.5.0.20200824191128-ae9734ed278b
go.uber.org/zap v1.16.0
golang.org/x/exp v0.0.0-20200513190911-00229845015e // indirect
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4
golang.org/x/sys v0.0.0-20210309074719-68d13333faf2
golang.org/x/time v0.0.0-20191024005414-555d28b269f0
google.golang.org/genproto v0.0.0-20200224152610-e50cd9704f63
google.golang.org/grpc v1.27.1
gopkg.in/yaml.v2 v2.3.0
gopkg.in/yaml.v2 v2.4.0
)

go 1.13
Expand Down
96 changes: 67 additions & 29 deletions go.sum

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion pkg/schema/tracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ func NewTracker(ctx context.Context, task string, sessionCfg map[string]string,
// NOTE: tidb uses a **global** config so can't isolate tracker's config from each other. If that isolation is needed,
// we might SetGlobalConfig before every call to tracker, or use some patch like https://github.com/bouk/monkey
toSet := tidbConfig.NewConfig()
toSet.AlterPrimaryKey = true
// bypass wait time of https://github.com/pingcap/tidb/pull/20550
toSet.TiKVClient.AsyncCommit.SafeWindow = 0
toSet.TiKVClient.AsyncCommit.AllowedClockDrift = 0
Expand Down
2 changes: 1 addition & 1 deletion tests/sequence_sharding_optimistic/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ run() {

# try to get schema for the table, the latest schema got.
curl -X PUT ${API_URL} -d '{"op":1, "task":"sequence_sharding_optimistic", "sources": ["mysql-replica-01"], "database":"sharding_seq_opt", "table":"t1"}' > ${WORK_DIR}/get_schema.log
# downstream does not enable alter-primary-key, so this is CLUSTERED index
# this is NON-CLUSTERED index
check_log_contains ${WORK_DIR}/get_schema.log 'CREATE TABLE `t1` ( `id` bigint(20) NOT NULL, `c2` varchar(20) DEFAULT NULL, `c3` int(11) DEFAULT NULL, PRIMARY KEY (`id`) /\*T!\[clustered_index\] NONCLUSTERED \*/) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_bin' 1

# drop the schema.
Expand Down
3 changes: 2 additions & 1 deletion tests/shardddl1/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,8 @@ function DM_028_CASE() {
}

function DM_028() {
run_case 028 "single-source-pessimistic" "run_sql_source1 \"create table ${shardddl1}.${tb1} (id int primary key);\"" "clean_table" ""
run_sql_tidb "create table ${shardddl}.${tb} (a varchar(10), primary key(a) clustered);"
run_case 028 "single-source-pessimistic" "run_sql_source1 \"create table ${shardddl1}.${tb1} (a varchar(10), PRIMARY KEY (a));\"" "clean_table" ""
}

function DM_030_CASE() {
Expand Down
6 changes: 0 additions & 6 deletions tests/shardddl3/conf/tidb-alter-pk-config.toml

This file was deleted.

19 changes: 5 additions & 14 deletions tests/shardddl3/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,9 @@ function DM_073() {

function DM_076_CASE() {
run_sql_source1 "alter table ${shardddl1}.${tb1} add primary key(id);"
run_dm_ctl_with_retry $WORK_DIR "127.0.0.1:$MASTER_PORT" \
"query-status test" \
"Unsupported add primary key" 1
run_sql_source1 "insert into ${shardddl1}.${tb1} values(1,1);"

check_sync_diff $WORK_DIR $cur/conf/diff_config.toml
}

function DM_076() {
Expand All @@ -99,7 +99,9 @@ function DM_077_CASE() {
}

function DM_077() {
run_sql_tidb "create table ${shardddl}.${tb} (id int, primary key(id) clustered);"
run_case 077 "single-source-pessimistic" "run_sql_source1 \"create table ${shardddl1}.${tb1} (id int primary key);\"" "clean_table" ""
run_sql_tidb "create table ${shardddl}.${tb} (id int, primary key(id) clustered);"
run_case 077 "single-source-optimistic" "run_sql_source1 \"create table ${shardddl1}.${tb1} (id int primary key);\"" "clean_table" ""
}

Expand All @@ -112,15 +114,9 @@ function DM_078_CASE() {
}

function DM_078() {
# start a TiDB alter-pk
pkill -hup tidb-server 2>/dev/null || true
wait_process_exit tidb-server
run_tidb_server 4000 $TIDB_PASSWORD $cur/conf/tidb-alter-pk-config.toml

run_case 078 "single-source-pessimistic" "run_sql_source1 \"create table ${shardddl1}.${tb1} (id int unique, a int, b varchar(10));\"" "clean_table" ""
run_case 078 "single-source-optimistic" "run_sql_source1 \"create table ${shardddl1}.${tb1} (id int unique, a int, b varchar(10));\"" "clean_table" ""

# don't revert tidb until DM_079
}

function DM_079_CASE() {
Expand All @@ -134,11 +130,6 @@ function DM_079_CASE() {
function DM_079() {
run_case 079 "single-source-pessimistic" "run_sql_source1 \"create table ${shardddl1}.${tb1} (a int primary key, b varchar(10));\"" "clean_table" ""
run_case 079 "single-source-optimistic" "run_sql_source1 \"create table ${shardddl1}.${tb1} (a int primary key, b varchar(10));\"" "clean_table" ""

# revert tidb
pkill -hup tidb-server 2>/dev/null || true
wait_process_exit tidb-server
run_tidb_server 4000 $TIDB_PASSWORD
}

function DM_080_CASE() {
Expand Down

0 comments on commit 659a125

Please sign in to comment.