pingcap / pingcap/tidb

lightning create databases even ErrSchemaNotExists happens

Open
#33,835 1 comment 0 reactions 1 assignee Claimed by @niubell View on GitHub
component/lightning type/enhancement
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)
1. run lightning import when file name pattern not correct and didn't configure mydumper.files.

```
[root@centos76_vm tools_test_data]# cd sb_10tables_files_route_test2
[root@centos76_vm sb_10tables_files_route_test2]# ls
lighting.toml metadata sbtest-sbtest1.000000000.csv sbtest-sbtest1-schema.sql sbtest-sbtest2.000000000.csv sbtest-sbtest2-schema.sql sbtest-schema-create.sql tidb-lightning.log
[root@centos76_vm sb_10tables_files_route_test2]# vim lighting.toml
[root@centos76_vm sb_10tables_files_route_test2]#
[root@centos76_vm sb_10tables_files_route_test2]#
[root@centos76_vm sb_10tables_files_route_test2]# tiup tidb-lightning:v6.0.0 -config lighting.toml
Starting component `tidb-lightning`: /root/.tiup/components/tidb-lightning/v6.0.0/tidb-lightning /root/.tiup/components/tidb-lightning/v6.0.0/tidb-lightning -config lighting.toml
Verbose debug logs will be written to /tmp/lightning.log.2022-04-08T18.48.16+0800

Error: [Lightning:Restore:ErrSchemaNotExists]table `sbtest-sbtest1`.`000000000` schema not found
tidb lightning encountered error: [Lightning:Restore:ErrSchemaNotExists]table `sbtest-sbtest1`.`000000000` schema not found
mysql> show databases;
+---------------------+
| Database |
+---------------------+
| sbtest |
| sbtest-sbtest1 |
| sbtest-sbtest2 |

```

### 2. What did you expect to see? (Required)
Lightning should fail, and database sbtest-sbtest1, sbtest-sbtest2 are not created

### 3. What did you see instead (Required)
Database base sbtest-sbtest1, sbtest-sbtest2 are created.
We have seen scenarios where lots of databases created when file name pattern not correct.

### 4. What is your TiDB version? (Required)
Release Version: v6.0.0
Git Commit Hash: 36a9810441ca0e496cbd22064af274b3be771081
Git Branch: heads/refs/tags/v6.0.0
Go Version: go1.18
UTC Build Time: 2022-03-31 10:28:59
Race Enabled: false

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.