Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.
Original topic: Lightning支持mydumper导出的SQL文件嘛
【TiDB Usage Environment】Production\Test Environment\POC
【TiDB Version】v6.1.0
【Encountered Problem】Does Lightning support SQL files exported by mydumper?
【Reproduction Path】
【Problem Phenomenon and Impact】
The SQL files exported by mydumper can be imported using myloader.
Additionally, I encountered an error
Error: [Lightning:Restore:ErrCreateSchema]create schema failed, table: xxx
.xxx
, stmt: restore view schema: run create schema job failed: Error 1046: No database selected
Below is my lightning configuration file
[lightning]
level = "info"
file = "tidb-lightning.log"
[tikv-importer]
backend = "tidb"
sorted-kv-dir = "/tmp/lightning_tmp"
[mydumper]
data-source-dir = "/tmp/export-20220811-095913"
filter = ['*.*', '!mysql.*', '!sys.*', '!INFORMATION_SCHEMA.*', '!PERFORMANCE_SCHEMA.*', '!METRICS_SCHEMA.*', '!INSPECTION_SCHEMA.*']
[tidb]
host = "10.122.x.x"
port = 4000
user = "xxx"
password = "xxx"
status-port = 10080
pd-addr = "10.122.x.x:2379"
//x represents sensitive information, sorry
The configuration file looks fine. Was the backup file exported using Dumpling?
No, exported by mydumper.
Sorry, I made a mistake. I will use myloader to import into TiDB.
Actually, the main issue is that different export tools generate different file names and such. Lightning determines whether a file is a schema file or a data file based on the file name. The data file names also contain corresponding schema and table information, which helps Lightning determine where the file should be imported. If the naming convention is not followed, Lightning won’t be able to make this determination (resulting in the above error).