pingcap / pingcap/tidb

tidb-lightning skips restore table schema when create table sql is not end with ";"

Open
#32,430 6 comments 0 reactions 0 assignees View on GitHub
component/lightning severity/minor type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

Please answer these questions before submitting your issue. Thanks!

### 1. Minimal reproduce step (Required)
use v5.3.0 tidb-lightning to restore following data:
test-schema-create.sql:
```
CREATE DATABASE `test`;
```

test.t.schema.sql:
```
CREATE TABLE `t` (id int primary key, v varchar(32))
```

test.t.0.sql
```
INSERT INTO `t` VALUES (1, "test");
```

### 2. What did you expect to see? (Required)
tidb-lightning should import successfully.

### 3. What did you see instead (Required)
```
[2022/02/17 04:48:48.794 +00:00] [ERROR] [lightning.go:219] ["tidb lightning encountered error"] [error="table 't' schema not found"] [errorVerbose="table 't' schema not found\ngithub.com/pingcap/tidb/br/pkg/lightning/restore.LoadSchemaInfo\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/br/pkg/lightning/restore/tidb.go:278\ngithub.com/pingcap/tidb/br/pkg/lightning/restore.(*Controller).restoreSchema\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/br/br/pkg/lightning/restore/restore.go:771\ngithub.com/pingcap/tidb/br/pkg/lightning/restore.(*Controller).Run...
```

### 4. What is your TiDB version? (Required)
v5.3.0

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.