Skip to content

Commit

Permalink
tests: update mysql-tester commit (#48462)
Browse files Browse the repository at this point in the history
  • Loading branch information
Defined2014 authored Nov 10, 2023
1 parent 04bf73a commit 5b05c0d
Show file tree
Hide file tree
Showing 80 changed files with 946 additions and 784 deletions.
48 changes: 0 additions & 48 deletions pkg/executor/insert_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"time"

"github.com/pingcap/failpoint"
"github.com/pingcap/tidb/pkg/errno"
"github.com/pingcap/tidb/pkg/executor"
"github.com/pingcap/tidb/pkg/meta/autoid"
"github.com/pingcap/tidb/pkg/sessionctx/variable"
Expand Down Expand Up @@ -516,53 +515,6 @@ func TestGlobalTempTableParallel(t *testing.T) {
wg.Wait()
}

func TestIssue17745(t *testing.T) {
store := testkit.CreateMockStore(t)
tk := testkit.NewTestKit(t, store)
tk.MustExec(`use test`)
tk.MustExec("drop table if exists tt1")
tk.MustExec("create table tt1 (c1 decimal(64))")
tk.MustGetErrCode("insert into tt1 values(89000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)", errno.ErrWarnDataOutOfRange)
tk.MustGetErrCode("insert into tt1 values(89123456789012345678901234567890123456789012345678901234567890123456789012345678900000000)", errno.ErrWarnDataOutOfRange)
tk.MustExec("insert ignore into tt1 values(89123456789012345678901234567890123456789012345678901234567890123456789012345678900000000)")
tk.MustQuery("show warnings;").Check(testkit.Rows(`Warning 1264 Out of range value for column 'c1' at row 1`, `Warning 1292 Truncated incorrect DECIMAL value: '789012345678901234567890123456789012345678901234567890123456789012345678900000000'`))
tk.MustQuery("select c1 from tt1").Check(testkit.Rows("9999999999999999999999999999999999999999999999999999999999999999"))
tk.MustGetErrCode("update tt1 set c1 = 89123456789012345678901234567890123456789012345678901234567890123456789012345678900000000", errno.ErrWarnDataOutOfRange)
tk.MustExec("drop table if exists tt1")
tk.MustGetErrCode("insert into tt1 values(4556414e723532)", errno.ErrIllegalValueForType)
tk.MustQuery("select 888888888888888888888888888888888888888888888888888888888888888888888888888888888888").Check(testkit.Rows("99999999999999999999999999999999999999999999999999999999999999999"))
tk.MustQuery("show warnings;").Check(testkit.RowsWithSep("|", "Warning|1292|Truncated incorrect DECIMAL value: '888888888888888888888888888888888888888888888888888888888888888888888888888888888'"))
}

// TestInsertIssue29892 test the double type with auto_increment problem, just leverage the serial test suite.
func TestInsertIssue29892(t *testing.T) {
store := testkit.CreateMockStore(t)
tk := testkit.NewTestKit(t, store)
tk.MustExec(`use test`)

tk.MustExec("set global tidb_txn_mode='optimistic';")
tk.MustExec("set global tidb_disable_txn_auto_retry=false;")
tk.MustExec("drop table if exists t")
tk.MustExec("create table t(a double auto_increment key, b int)")
tk.MustExec("insert into t values (146576794, 1)")

tk1 := testkit.NewTestKit(t, store)
tk1.MustExec(`use test`)
tk1.MustExec("begin")
tk1.MustExec("insert into t(b) select 1")

tk2 := testkit.NewTestKit(t, store)
tk2.MustExec(`use test`)
tk2.MustExec("begin")
tk2.MustExec("insert into t values (146576795, 1)")
tk2.MustExec("insert into t values (146576796, 1)")
tk2.MustExec("commit")

// since the origin auto-id (146576795) is cached in retryInfo, it will be fetched again to do the retry again,
// which will duplicate with what has been inserted in tk1.
tk1.MustContainErrMsg("commit", "Duplicate entry")
}

func TestInsertLockUnchangedKeys(t *testing.T) {
store := testkit.CreateMockStore(t)
tk1 := testkit.NewTestKit(t, store)
Expand Down
3 changes: 1 addition & 2 deletions pkg/expression/integration_test/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ go_test(
"main_test.go",
],
flaky = True,
shard_count = 28,
shard_count = 24,
deps = [
"//pkg/config",
"//pkg/domain",
Expand All @@ -22,7 +22,6 @@ go_test(
"//pkg/planner/core",
"//pkg/session",
"//pkg/sessionctx/variable",
"//pkg/table",
"//pkg/tablecodec",
"//pkg/testkit",
"//pkg/testkit/testmain",
Expand Down
301 changes: 0 additions & 301 deletions pkg/expression/integration_test/integration_test.go

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions tests/integrationtest/r/bindinfo/bind.result
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,7 @@ drop global binding for select * from t using select * from t use index(a);
drop table if exists t;
create table t(id int, value decimal(5,2));
table t;
id value
explain table t;
id estRows task access object operator info
TableReader_5 10000.00 root data:TableFullScan_4
Expand Down
13 changes: 0 additions & 13 deletions tests/integrationtest/r/black_list.result
Original file line number Diff line number Diff line change
Expand Up @@ -8,61 +8,53 @@ TableReader 3323.33 root data:Selection
└─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo
insert into mysql.opt_rule_blacklist values('predicate_push_down');
admin reload opt_rule_blacklist;

explain format = 'brief' select * from t where a < 1;
id estRows task access object operator info
Selection 8000.00 root lt(black_list.t.a, 1)
└─TableReader 10000.00 root data:TableFullScan
└─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo
delete from mysql.opt_rule_blacklist where name='predicate_push_down';
admin reload opt_rule_blacklist;

explain format = 'brief' select * from t where a < 1;
id estRows task access object operator info
TableReader 3323.33 root data:Selection
└─Selection 3323.33 cop[tikv] lt(black_list.t.a, 1)
└─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo
insert into mysql.expr_pushdown_blacklist values('<', 'tikv,tiflash,tidb', 'for test');
admin reload expr_pushdown_blacklist;

explain format = 'brief' select * from t where a < 1;
id estRows task access object operator info
Selection 8000.00 root lt(black_list.t.a, 1)
└─TableReader 10000.00 root data:TableFullScan
└─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo
delete from mysql.expr_pushdown_blacklist where name='<' and store_type = 'tikv,tiflash,tidb' and reason = 'for test';
admin reload expr_pushdown_blacklist;

explain format = 'brief' select * from t where a < 1;
id estRows task access object operator info
TableReader 3323.33 root data:Selection
└─Selection 3323.33 cop[tikv] lt(black_list.t.a, 1)
└─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo
insert into mysql.expr_pushdown_blacklist values('lt', 'tikv,tiflash,tidb', 'for test');
admin reload expr_pushdown_blacklist;

explain format = 'brief' select * from t where a < 1;
id estRows task access object operator info
Selection 8000.00 root lt(black_list.t.a, 1)
└─TableReader 10000.00 root data:TableFullScan
└─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo
delete from mysql.expr_pushdown_blacklist where name='lt' and store_type = 'tikv,tiflash,tidb' and reason = 'for test';
admin reload expr_pushdown_blacklist;

explain format = 'brief' select * from t where a < 1;
id estRows task access object operator info
TableReader 3323.33 root data:Selection
└─Selection 3323.33 cop[tikv] lt(black_list.t.a, 1)
└─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo
delete from mysql.expr_pushdown_blacklist;
admin reload expr_pushdown_blacklist;

drop table if exists t;
create table t(a enum('a','b','c'), b enum('a','b','c'), c int, index idx(b,a));
insert into t values(1,1,1),(2,2,2),(3,3,3);
insert into mysql.expr_pushdown_blacklist(name) values('enum');
admin reload expr_pushdown_blacklist;

desc format='brief' select /*+ HASH_AGG() */ max(a) from t;
id estRows task access object operator info
HashAgg 1.00 root funcs:max(black_list.t.a)->Column#5
Expand All @@ -75,7 +67,6 @@ StreamAgg 1.00 root funcs:max(black_list.t.a)->Column#5
└─IndexFullScan 10000.00 cop[tikv] table:t, index:idx(b, a) keep order:false, stats:pseudo
delete from mysql.expr_pushdown_blacklist;
admin reload expr_pushdown_blacklist;

desc format='brief' select /*+ HASH_AGG() */ max(a) from t;
id estRows task access object operator info
HashAgg 1.00 root funcs:max(Column#7)->Column#5
Expand All @@ -90,7 +81,6 @@ StreamAgg 1.00 root funcs:max(Column#7)->Column#5
└─IndexFullScan 10000.00 cop[tikv] table:t, index:idx(b, a) keep order:false, stats:pseudo
insert into mysql.expr_pushdown_blacklist(name) values('enum');
admin reload expr_pushdown_blacklist;

desc format='brief' select * from t where a + b;
id estRows task access object operator info
Selection 8000.00 root plus(cast(black_list.t.a, double BINARY), cast(black_list.t.b, double BINARY))
Expand All @@ -103,7 +93,6 @@ Selection 8000.00 root plus(cast(black_list.t.a, double BINARY), cast(black_lis
└─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo
delete from mysql.expr_pushdown_blacklist;
admin reload expr_pushdown_blacklist;

desc format='brief' select * from t where a + b;
id estRows task access object operator info
TableReader 8000.00 root data:Selection
Expand All @@ -116,7 +105,6 @@ TableReader 8000.00 root data:Selection
└─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo
insert into mysql.expr_pushdown_blacklist(name) values('enum');
admin reload expr_pushdown_blacklist;

desc format='brief' select * from t where b = 1;
id estRows task access object operator info
Selection 8000.00 root eq(black_list.t.b, 1)
Expand All @@ -139,7 +127,6 @@ Selection 8000.00 root gt(black_list.t.b, "a")
└─TableFullScan 10000.00 cop[tikv] table:t keep order:false, stats:pseudo
delete from mysql.expr_pushdown_blacklist;
admin reload expr_pushdown_blacklist;

desc format='brief' select * from t where b = 1 and a = 1;
id estRows task access object operator info
IndexLookUp 0.10 root
Expand Down
2 changes: 2 additions & 0 deletions tests/integrationtest/r/collation_agg_func_disabled.result
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,8 @@ insert into tt values ("c", "c", "c", JSON_OBJECT("c", "c"));
insert into tt values ("C", "C", "C", JSON_OBJECT("C", "C"));
Error 1265 (01000): Data truncated for column 'b' at row 1
split table tt by (0), (1), (2), (3), (4), (5);
TOTAL_SPLIT_REGION SCATTER_FINISH_RATIO
6 1
desc format='brief' select min(a) from tt;
id estRows task access object operator info
StreamAgg 1.00 root funcs:min(collation_agg_func.tt.a)->Column#6
Expand Down
2 changes: 2 additions & 0 deletions tests/integrationtest/r/collation_agg_func_enabled.result
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ insert into tt values ("B", "B", "B", JSON_OBJECT("B", "B"));
insert into tt values ("c", "c", "c", JSON_OBJECT("c", "c"));
insert into tt values ("C", "C", "C", JSON_OBJECT("C", "C"));
split table tt by (0), (1), (2), (3), (4), (5);
TOTAL_SPLIT_REGION SCATTER_FINISH_RATIO
6 1
desc format='brief' select min(a) from tt;
id estRows task access object operator info
StreamAgg 1.00 root funcs:min(collation_agg_func.tt.a)->Column#6
Expand Down
5 changes: 1 addition & 4 deletions tests/integrationtest/r/collation_misc_disabled.result
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ create table t(a varchar(20) charset latin1);
insert into t values ("t_value");
alter table t modify column a varchar(20) charset utf8mb4;
admin check table t;

select * from t;
a
t_value
Expand All @@ -28,7 +27,6 @@ create table t(a varchar(20) charset latin1);
insert into t values ("t_value");
alter table t modify column a varchar(20) charset utf8mb4 collate utf8mb4_general_ci;
admin check table t;

select * from t;
a
t_value
Expand All @@ -38,7 +36,7 @@ insert into t values ("t_value");
alter table t modify column a varchar(20) charset utf8 collate utf8_bin;
Error 8200 (HY000): Unsupported modify charset from latin1 to utf8
alter table t modify column a varchar(20) charset utf8mb4 collate utf8bin;
[ddl:1273]Unknown collation: 'utf8bin'
Error 1273 (HY000): Unknown collation: 'utf8bin'
alter table t collate LATIN1_GENERAL_CI charset utf8 collate utf8_bin;
Error 1302 (HY000): Conflicting declarations: 'CHARACTER SET latin1' and 'CHARACTER SET utf8'
alter table t collate LATIN1_GENERAL_CI collate UTF8MB4_UNICODE_ci collate utf8_bin;
Expand All @@ -48,7 +46,6 @@ create table t(a varchar(20) charset latin1);
insert into t values ("t_value");
alter table t modify column a varchar(19) charset utf8mb4;
admin check table t;

select * from t;
a
t_value
Expand Down
5 changes: 1 addition & 4 deletions tests/integrationtest/r/collation_misc_enabled.result
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ create table t(a varchar(20) charset latin1);
insert into t values ("t_value");
alter table t modify column a varchar(20) charset utf8mb4;
admin check table t;

select * from t;
a
t_value
Expand All @@ -28,7 +27,6 @@ create table t(a varchar(20) charset latin1);
insert into t values ("t_value");
alter table t modify column a varchar(20) charset utf8mb4 collate utf8mb4_general_ci;
admin check table t;

select * from t;
a
t_value
Expand All @@ -38,7 +36,7 @@ insert into t values ("t_value");
alter table t modify column a varchar(20) charset utf8 collate utf8_bin;
Error 8200 (HY000): Unsupported modify charset from latin1 to utf8
alter table t modify column a varchar(20) charset utf8mb4 collate utf8bin;
[ddl:1273]Unknown collation: 'utf8bin'
Error 1273 (HY000): Unknown collation: 'utf8bin'
alter table t collate LATIN1_GENERAL_CI charset utf8 collate utf8_bin;
Error 1273 (HY000): Unsupported collation when new collation is enabled: 'latin1_general_ci'
alter table t collate LATIN1_GENERAL_CI collate UTF8MB4_UNICODE_ci collate utf8_bin;
Expand All @@ -48,7 +46,6 @@ create table t(a varchar(20) charset latin1);
insert into t values ("t_value");
alter table t modify column a varchar(19) charset utf8mb4;
admin check table t;

select * from t;
a
t_value
Expand Down
6 changes: 2 additions & 4 deletions tests/integrationtest/r/cte.result
Original file line number Diff line number Diff line change
Expand Up @@ -321,14 +321,12 @@ from dual;
scal_subq
with
drop table if exists t1;
create table t1 (a int);
insert into t1 values(1), (2), (3);
create table t1 (a int); insert into t1 values(1), (2), (3);
with q as (select * from t1)
select /*+ merge(q) no_merge(q1) */ * from q, q q1 where q.a=1 and q1.a=2;
a a
1 2
drop table if exists t1;
create table t1 (a int, b int);
drop table if exists t1; create table t1 (a int, b int);
with qn as (select a, b from t1) select b from qn group by a;
b
drop table if exists t1;
Expand Down
1 change: 0 additions & 1 deletion tests/integrationtest/r/ddl/column_modify.result
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ insert into ddl__column_modify2.test (a) values (5);
insert ddl__column_modify2.test values (6, 6);
alter table ddl__column_modify2.test add index idx1 (a, b);
admin check table test;

use ddl__column_modify;
drop table if exists test_rename_column;
create table test_rename_column (id int not null primary key auto_increment, col1 int);
Expand Down
7 changes: 0 additions & 7 deletions tests/integrationtest/r/ddl/column_type_change.result
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ Error 1690 (22003): constant 9223372036854775807 overflows smallint
alter table t modify column a tinyint;
Error 1690 (22003): constant 9223372036854775807 overflows tinyint
admin check table t;

drop table if exists t;
create table t(a tinyint, b smallint, c mediumint, d int, e bigint, f bigint);
insert into t values(1, 11, 111, 1111, 11111, 111111);
Expand Down Expand Up @@ -328,7 +327,6 @@ select b from t ignore index(idx);
b
aaa
admin check table t;

drop table if exists t;
create table t (a varchar(10));
insert into t values ('aaa ');
Expand Down Expand Up @@ -2516,7 +2514,6 @@ select * from t;
id c1
1 20200710010508
admin check table t;

set @@session.time_zone='+5:00';
alter table t modify c1 timestamp;
select * from t;
Expand All @@ -2527,7 +2524,6 @@ select * from t;
id c1
1 2020-07-09 12:05:08
admin check table t;

drop table if exists t;
create table t(id int primary key auto_increment, c1 timestamp default '2020-07-10 01:05:08', index idx(c1));
insert into t values();
Expand All @@ -2540,7 +2536,6 @@ select * from t;
id c1
1 20200710010508
admin check table t;

set @@session.time_zone= default;
alter table t modify c1 timestamp;
select * from t;
Expand All @@ -2551,7 +2546,6 @@ select * from t;
id c1
1 2020-07-10 01:05:08
admin check table t;

drop table if exists t;
set @@session.time_zone=UTC;
create table t(id int primary key auto_increment, c1 timestamp default '1990-04-15 18:00:00');
Expand Down Expand Up @@ -2585,7 +2579,6 @@ id c1
1 20160313033000
alter table t add index idx1(id, c1);
admin check table t;

set @@session.time_zone=default;
drop table if exists t;
create table t (a int);
Expand Down
4 changes: 3 additions & 1 deletion tests/integrationtest/r/ddl/constraint.result
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,6 @@ create table t(a int CHECK (a != 0));
prepare stmt from 'insert into t values(?)';
set @a = 1;
execute stmt using @a;

set @a = 0;
execute stmt using @a;
Error 3819 (HY000): Check constraint 't_chk_1' is violated.
Expand Down Expand Up @@ -788,6 +787,9 @@ t CREATE TABLE `t` (
CONSTRAINT `haha` CHECK ((`a` < `b`)) /*!80016 NOT ENFORCED */,
CONSTRAINT `t_chk_1` CHECK ((`a` > 0))
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin
insert into t values(1, 0);
alter table t alter constraint haha enforced;
Error 3819 (HY000): Check constraint 'haha' is violated.
drop table if exists t;
set @@global.tidb_enable_check_constraint = 1;
CREATE TABLE `t` (`a` int(11) DEFAULT NULL);
Expand Down
Loading

0 comments on commit 5b05c0d

Please sign in to comment.