Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/pingcap/tidb into fixGcsBug
Browse files Browse the repository at this point in the history
  • Loading branch information
lichunzhu committed Nov 4, 2021
2 parents 8f78489 + dcbfda9 commit 13d9696
Show file tree
Hide file tree
Showing 47 changed files with 882 additions and 260 deletions.
4 changes: 2 additions & 2 deletions br/pkg/lightning/mydump/parquet_parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func (s testParquetParserSuite) TestParquetParser(c *C) {
verifyRow := func(i int) {
c.Assert(reader.lastRow.RowID, Equals, int64(i+1))
c.Assert(len(reader.lastRow.Row), Equals, 2)
c.Assert(reader.lastRow.Row[0], DeepEquals, types.NewCollationStringDatum(strconv.Itoa(i), "", 0))
c.Assert(reader.lastRow.Row[0], DeepEquals, types.NewCollationStringDatum(strconv.Itoa(i), ""))
c.Assert(reader.lastRow.Row[1], DeepEquals, types.NewIntDatum(int64(i)))
}

Expand Down Expand Up @@ -184,7 +184,7 @@ func (s testParquetParserSuite) TestParquetVariousTypes(c *C) {

for i, testCase := range cases {
c.Assert(reader.ReadRow(), IsNil)
vals := []types.Datum{types.NewCollationStringDatum(testCase[1].(string), "", 0)}
vals := []types.Datum{types.NewCollationStringDatum(testCase[1].(string), "")}
if i%2 == 0 {
vals = append(vals, vals[0])
} else {
Expand Down
11 changes: 11 additions & 0 deletions cmd/explaintest/r/new_character_set_builtin.result
Original file line number Diff line number Diff line change
Expand Up @@ -141,3 +141,14 @@ select md5(a), md5(b), md5(c) from t;
md5(a) md5(b) md5(c)
8093a32450075324682d01456d6e3919 a45d4af7b243e7f393fa09bed72ac73e aae0117857fe54811a5239275dd81133
set @@tidb_enable_vectorized_expression = false;
drop table if exists t;
create table t (a char(20) charset utf8mb4, b char(20) charset gbk, c binary(20));
insert into t values ('一二三', '一二三', '一二三');
select decode(encode(a,"monty"),"monty") = a, md5(decode(encode(b,"monty"),"monty")) = md5(b), decode(encode(c,"monty"),"monty") = c from t;
decode(encode(a,"monty"),"monty") = a md5(decode(encode(b,"monty"),"monty")) = md5(b) decode(encode(c,"monty"),"monty") = c
1 1 1
set @@tidb_enable_vectorized_expression = true;
select decode(encode(a,"monty"),"monty") = a, md5(decode(encode(b,"monty"),"monty")) = md5(b), decode(encode(c,"monty"),"monty") = c from t;
decode(encode(a,"monty"),"monty") = a md5(decode(encode(b,"monty"),"monty")) = md5(b) decode(encode(c,"monty"),"monty") = c
1 1 1
set @@tidb_enable_vectorized_expression = false;
9 changes: 9 additions & 0 deletions cmd/explaintest/t/new_character_set_builtin.test
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,12 @@ select md5(a), md5(b), md5(c) from t;
set @@tidb_enable_vectorized_expression = true;
select md5(a), md5(b), md5(c) from t;
set @@tidb_enable_vectorized_expression = false;

-- test for builtin function decode()/encode()
drop table if exists t;
create table t (a char(20) charset utf8mb4, b char(20) charset gbk, c binary(20));
insert into t values ('一二三', '一二三', '一二三');
select decode(encode(a,"monty"),"monty") = a, md5(decode(encode(b,"monty"),"monty")) = md5(b), decode(encode(c,"monty"),"monty") = c from t;
set @@tidb_enable_vectorized_expression = true;
select decode(encode(a,"monty"),"monty") = a, md5(decode(encode(b,"monty"),"monty")) = md5(b), decode(encode(c,"monty"),"monty") = c from t;
set @@tidb_enable_vectorized_expression = false;
3 changes: 3 additions & 0 deletions ddl/serial_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1124,7 +1124,10 @@ func (s *testSerialSuite) TestTableLocksEnable(c *C) {
})

tk.MustExec("lock tables t1 write")
tk.MustQuery("SHOW WARNINGS").Check(testkit.Rows("Warning 1235 LOCK TABLES is not supported. To enable this experimental feature, set 'enable-table-lock' in the configuration file."))
checkTableLock(c, tk.Se, "test", "t1", model.TableLockNone)
tk.MustExec("unlock tables")
tk.MustQuery("SHOW WARNINGS").Check(testkit.Rows("Warning 1235 UNLOCK TABLES is not supported. To enable this experimental feature, set 'enable-table-lock' in the configuration file."))
}

func (s *testSerialDBSuite) TestAutoRandomOnTemporaryTable(c *C) {
Expand Down
5 changes: 5 additions & 0 deletions dumpling/tests/_utils/check_sync_diff
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ check_time=${2-10}

LOG=$DUMPLING_OUTPUT_DIR/sync_diff_inspector.log

# change output dir "./output" to "$DUMPLING_OUTPUT_DIR/output"
DUMPLING_OUTPUT_DIR_REGEX=$(echo "$DUMPLING_OUTPUT_DIR/output" | sed -e 's/\//\\\//g')
sed "s/.\/output/${DUMPLING_OUTPUT_DIR_REGEX}/g" $conf > $DUMPLING_OUTPUT_DIR/diff_config.toml
conf=$DUMPLING_OUTPUT_DIR/diff_config.toml

i=0
while [ $i -lt $check_time ]
do
Expand Down
31 changes: 10 additions & 21 deletions dumpling/tests/all_generate_column/conf/diff_config.toml
Original file line number Diff line number Diff line change
@@ -1,39 +1,28 @@
# diff Configuration.

log-level = "info"

chunk-size = 1000

check-thread-count = 4

sample-percent = 100
export-fix-sql = true

use-checksum = true
check-struct-only = false

fix-sql-file = "fix.sql"
[task]
output-dir = "./output"

# tables need to check.
[[check-tables]]
schema = "all_generate_column"
tables = ["~t.*"]
source-instances = ["mysql1"]

[[table-config]]
schema = "all_generate_column"
table = "t"
target-instance = "tidb0"

[[table-config.source-tables]]
instance-id = "source-1"
schema = "all_generate_column"
table = "t"
target-check-tables = ["all_generate_column.t"]

[[source-db]]
[data-sources]
[data-sources.mysql1]
host = "127.0.0.1"
port = 3306
user = "root"
password = ""
instance-id = "source-1"

[target-db]
[data-sources.tidb0]
host = "127.0.0.1"
port = 4000
user = "root"
Expand Down
31 changes: 10 additions & 21 deletions dumpling/tests/e2e/conf/diff_config.toml
Original file line number Diff line number Diff line change
@@ -1,39 +1,28 @@
# diff Configuration.

log-level = "info"

chunk-size = 1000

check-thread-count = 4

sample-percent = 100
export-fix-sql = true

use-checksum = true
check-struct-only = false

fix-sql-file = "fix.sql"
[task]
output-dir = "./output"

# tables need to check.
[[check-tables]]
schema = "e2e"
tables = ["~t.*"]
source-instances = ["mysql1"]

[[table-config]]
schema = "e2e"
table = "t"
target-instance = "tidb0"

[[table-config.source-tables]]
instance-id = "source-1"
schema = "e2e"
table = "t"
target-check-tables = ["e2e.t"]

[[source-db]]
[data-sources]
[data-sources.mysql1]
host = "127.0.0.1"
port = 3306
user = "root"
password = ""
instance-id = "source-1"

[target-db]
[data-sources.tidb0]
host = "127.0.0.1"
port = 4000
user = "root"
Expand Down
40 changes: 10 additions & 30 deletions dumpling/tests/e2e_csv/conf/diff_config.toml
Original file line number Diff line number Diff line change
@@ -1,48 +1,28 @@
# diff Configuration.

log-level = "info"

chunk-size = 1000

check-thread-count = 4

sample-percent = 100

use-checksum = true

fix-sql-file = "fix.sql"
export-fix-sql = true

# tables need to check.
[[check-tables]]
schema = "e2e_csv"
tables = ["escape", "t"]
check-struct-only = false

[[table-config]]
schema = "e2e_csv"
table = "t"
[task]
output-dir = "./output"

[[table-config.source-tables]]
instance-id = "source-1"
schema = "e2e_csv"
table = "t"
source-instances = ["mysql1"]

[[table-config]]
schema = "e2e_csv"
table = "escape"
target-instance = "tidb0"

[[table-config.source-tables]]
instance-id = "source-1"
schema = "e2e_csv"
table = "escape"
target-check-tables = ["e2e_csv.escape", "e2e_csv.t"]

[[source-db]]
[data-sources]
[data-sources.mysql1]
host = "127.0.0.1"
port = 3306
user = "root"
password = ""
instance-id = "source-1"

[target-db]
[data-sources.tidb0]
host = "127.0.0.1"
port = 4000
user = "root"
Expand Down
31 changes: 10 additions & 21 deletions dumpling/tests/ignore_generate_column/conf/diff_config.toml
Original file line number Diff line number Diff line change
@@ -1,39 +1,28 @@
# diff Configuration.

log-level = "info"

chunk-size = 1000

check-thread-count = 4

sample-percent = 100
export-fix-sql = true

use-checksum = true
check-struct-only = false

fix-sql-file = "fix.sql"
[task]
output-dir = "./output"

# tables need to check.
[[check-tables]]
schema = "ignore_generate"
tables = ["~t.*"]
source-instances = ["mysql1"]

[[table-config]]
schema = "ignore_generate"
table = "t"
target-instance = "tidb0"

[[table-config.source-tables]]
instance-id = "source-1"
schema = "ignore_generate"
table = "t"
target-check-tables = ["ignore_generate.t"]

[[source-db]]
[data-sources]
[data-sources.mysql1]
host = "127.0.0.1"
port = 3306
user = "root"
password = ""
instance-id = "source-1"

[target-db]
[data-sources.tidb0]
host = "127.0.0.1"
port = 4000
user = "root"
Expand Down
31 changes: 10 additions & 21 deletions dumpling/tests/rows/conf/diff_config.toml
Original file line number Diff line number Diff line change
@@ -1,39 +1,28 @@
# diff Configuration.

log-level = "info"

chunk-size = 1000

check-thread-count = 4

sample-percent = 100
export-fix-sql = true

use-checksum = true
check-struct-only = false

fix-sql-file = "fix.sql"
[task]
output-dir = "./output"

# tables need to check.
[[check-tables]]
schema = "rows"
tables = ["~t.*"]
source-instances = ["mysql1"]

[[table-config]]
schema = "rows"
table = "t"
target-instance = "tidb0"

[[table-config.source-tables]]
instance-id = "source-1"
schema = "rows"
table = "t"
target-check-tables = ["rows.t"]

[[source-db]]
[data-sources]
[data-sources.mysql1]
host = "127.0.0.1"
port = 3306
user = "root"
password = ""
instance-id = "source-1"

[target-db]
[data-sources.tidb0]
host = "127.0.0.1"
port = 4000
user = "root"
Expand Down
24 changes: 11 additions & 13 deletions dumpling/tests/rows_extreme_int/conf/diff_config.toml
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
# diff Configuration.

log-level = "info"
check-thread-count = 4

chunk-size = 1000
export-fix-sql = true

check-thread-count = 4
check-struct-only = false

sample-percent = 100
[task]
output-dir = "./output"

use-checksum = true
source-instances = ["mysql1"]

fix-sql-file = "fix.sql"
target-instance = "tidb0"

# tables need to check.
[[check-tables]]
schema = "rei"
tables = ["~t.*"]
target-check-tables = ["rei.t*"]

[[source-db]]
[data-sources]
[data-sources.mysql1]
host = "127.0.0.1"
port = 3306
user = "root"
password = ""
instance-id = "source-1"

[target-db]
[data-sources.tidb0]
host = "127.0.0.1"
port = 4000
user = "root"
Expand Down
5 changes: 5 additions & 0 deletions errors.toml
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,11 @@ error = '''
Incorrect usage of %s and %s
'''

["executor:1235"]
error = '''
%-.32s is not supported. To enable this experimental feature, set '%-.32s' in the configuration file.
'''

["executor:1242"]
error = '''
Subquery returns more than 1 row
Expand Down
1 change: 1 addition & 0 deletions executor/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -1013,6 +1013,7 @@ func (a *ExecStmt) LogSlowQuery(txnTS uint64, succ bool, hasMoreResults bool) {
WriteSQLRespTotal: stmtDetail.WriteSQLRespDuration,
ResultRows: GetResultRowsCount(a.Ctx, a.Plan),
ExecRetryCount: a.retryCount,
IsExplicitTxn: sessVars.TxnCtx.IsExplicit,
}
if a.retryCount > 0 {
slowItems.ExecRetryTime = costTime - sessVars.DurationParse - sessVars.DurationCompile - time.Since(a.retryStartTime)
Expand Down
Loading

0 comments on commit 13d9696

Please sign in to comment.