Skip to content

Commit fe5aa97

Browse files
authored
lightning: fix build error and failed test (#34058)
ref #31913
1 parent 7866626 commit fe5aa97

File tree

6 files changed

+13
-21
lines changed

6 files changed

+13
-21
lines changed

br/pkg/lightning/restore/restore_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ import (
5858
"github.com/pingcap/tidb/br/pkg/storage"
5959
"github.com/pingcap/tidb/br/pkg/version/build"
6060
"github.com/pingcap/tidb/ddl"
61+
"github.com/pingcap/tidb/table/tables"
6162
tmock "github.com/pingcap/tidb/util/mock"
6263
)
6364

@@ -558,8 +559,7 @@ func (s *tableRestoreSuite) TestRestoreEngineFailed(c *C) {
558559
}
559560
defer close(rc.saveCpCh)
560561
go func() {
561-
for cp := range rc.saveCpCh {
562-
cp.waitCh <- nil
562+
for range rc.saveCpCh {
563563
}
564564
}()
565565

@@ -573,7 +573,7 @@ func (s *tableRestoreSuite) TestRestoreEngineFailed(c *C) {
573573
c.Assert(err, IsNil)
574574
_, indexUUID := backend.MakeUUID("`db`.`table`", -1)
575575
_, dataUUID := backend.MakeUUID("`db`.`table`", 0)
576-
realBackend := tidb.NewTiDBBackend(nil, "replace", nil)
576+
realBackend := tidb.NewTiDBBackend(nil, "replace")
577577
mockBackend.EXPECT().OpenEngine(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil)
578578
mockBackend.EXPECT().OpenEngine(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil)
579579
mockBackend.EXPECT().CloseEngine(gomock.Any(), gomock.Any(), gomock.Any()).Return(nil).AnyTimes()

br/pkg/lightning/restore/tidb.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ loopCreate:
182182
}
183183

184184
func createIfNotExistsStmt(p *parser.Parser, createTable, dbName, tblName string) ([]string, error) {
185-
stmts, _, err := p.ParseSQL(createTable)
185+
stmts, _, err := p.Parse(createTable, "", "")
186186
if err != nil {
187187
return []string{}, err
188188
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
CREATE TABLE t(i INT PRIMARY KEY, s varchar(32), j TINYINT, KEY s_j (s, i)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
INSERT INTO t (s, i, j) VALUES
2+
("this_is_test1", 1, 1),
3+
("this_is_test2", 2, 2),
4+
("this_is_test3", 3, 3),
5+
("this_is_test4", 4, 4),
6+
("this_is_test5", 5, 5);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
INSERT INTO t(s, i, j) VALUES ("another test case", 6, 6);

br/tests/lightning_new_collation/run.sh

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -23,27 +23,11 @@ cur=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
2323
# restart cluster with new collation enabled
2424
start_services --tidb-cfg $cur/tidb-new-collation.toml
2525

26-
# Populate the mydumper source
27-
DBPATH="$TEST_DIR/nc.mydump"
28-
mkdir -p $DBPATH
29-
echo 'CREATE DATABASE nc;' > "$DBPATH/nc-schema-create.sql"
30-
# create table with collate `utf8_general_ci`, the index key will be different between old/new collation
31-
echo "CREATE TABLE t(i INT PRIMARY KEY, s varchar(32), j TINYINT, KEY s_j (s, i)) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;" > "$DBPATH/nc.t-schema.sql"
32-
cat > "$DBPATH/nc.t.0.sql" << _EOF_
33-
INSERT INTO t (s, i, j) VALUES
34-
("this_is_test1", 1, 1),
35-
("this_is_test2", 2, 2),
36-
("this_is_test3", 3, 3),
37-
("this_is_test4", 4, 4),
38-
("this_is_test5", 5, 5);
39-
_EOF_
40-
echo 'INSERT INTO t(s, i, j) VALUES ("another test case", 6, 6);' > "$DBPATH/nc.t.1.sql"
41-
4226
for BACKEND in local importer tidb; do
4327
# Start importing the tables.
4428
run_sql 'DROP DATABASE IF EXISTS nc'
4529

46-
run_lightning -d "$DBPATH" --backend $BACKEND 2> /dev/null
30+
run_lightning --backend $BACKEND 2> /dev/null
4731

4832
run_sql 'SELECT count(*), sum(i) FROM `nc`.t'
4933
check_contains "count(*): 6"

0 commit comments

Comments
 (0)