-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improved support for MySQL Shell dump and load #24515
Comments
For the
It may be comparing |
- See pingcap/tidb#24515 ``` MySQL Error 1105 (HY000): Load Data: don't support load data with replace field: LOAD DATA LOCAL INFILE '/tmp/mysqlsh_dump_employees/employees@titles@@0.tsv.zst' REPLACE INTO TABLE `employees`.`titles` CHARACTER SET 'utf8mb4' FIELDS TERMINATED BY ' ' ESCAPED BY '\\' LINES STARTING BY '' TERMINATED BY '\n' (`emp_no`, `title`, `from_date`, `to_date`) ```
- See pingcap/tidb#24515 ``` MySQL Error 1105 (HY000): Load Data: don't support load data with replace field: LOAD DATA LOCAL INFILE '/tmp/mysqlsh_dump_employees/employees@titles@@0.tsv.zst' REPLACE INTO TABLE `employees`.`titles` CHARACTER SET 'utf8mb4' FIELDS TERMINATED BY ' ' ESCAPED BY '\\' LINES STARTING BY '' TERMINATED BY '\n' (`emp_no`, `title`, `from_date`, `to_date`) ```
- See pingcap/tidb#24515 ``` MySQL Error 1105 (HY000): Load Data: don't support load data with replace field: LOAD DATA LOCAL INFILE '/tmp/mysqlsh_dump_employees/employees@titles@@0.tsv.zst' REPLACE INTO TABLE `employees`.`titles` CHARACTER SET 'utf8mb4' FIELDS TERMINATED BY ' ' ESCAPED BY '\\' LINES STARTING BY '' TERMINATED BY '\n' (`emp_no`, `title`, `from_date`, `to_date`) ```
- See pingcap/tidb#24515 ``` MySQL Error 1105 (HY000): Load Data: don't support load data with replace field: LOAD DATA LOCAL INFILE '/tmp/mysqlsh_dump_employees/employees@titles@@0.tsv.zst' REPLACE INTO TABLE `employees`.`titles` CHARACTER SET 'utf8mb4' FIELDS TERMINATED BY ' ' ESCAPED BY '\\' LINES STARTING BY '' TERMINATED BY '\n' (`emp_no`, `title`, `from_date`, `to_date`) ```
When will LOAD DATA LOCAL INFILE ... REPLACE INTO be supported? This is very important to us!!! |
@aioas How are you using or planning to use |
For example, in a scenario, I use load data to import 10,000 pieces of data into TiDB, but it fails when the 1000th item is imported. In order to ensure the consistency of the data, I need to import these 10,000 pieces of data from the beginning. I don’t want to delete the imported data through programs or manually. At this time, I need to use load data...replace... to ensure the correctness of the repeated imported data. |
We have a large number of offline computing scenarios of big data, and regularly update user data to the latest, new users are inserted, and old users are updated. The most suitable use is |
|
Development Task
MySQL Shell is a relatively new tool from Oracle which is used as the new CLI for various DBA and developer tasks. One of the features of this tool is dumping and loading data. This is somewhat similar to
mysqldump
andmysqlpump
, but more focus is placed on parallel dumping and restoring to get better performance. This also adds Oracle Cloud features for storing and loading umps.Dumping data from TiDB 5.0
The issues here are:
FLUSH TABLES WITH READ LOCK
. The workaround is to use--consistent=false
.--triggers=false
. I assume it only checks for the permission, even when there are no triggers.Loading data
When loading with
mysqlsh mysql://root@localhost:4000 -- util loadDump /tmp/mysqlsh_dump_employees
the tool fails without a proper error message. Inspecting the TiDB tools shows that the issue is related to the isolation level support.Running
set global tidb_skip_isolation_level_check=1
makes the tool skip over this issue.The next issue is with
LOAD DATA LOCAL INFILE...REPLACE INTO
which isn't supported by TiDB. Unfortunately this incompatibility is not listed on https://docs.pingcap.com/tidb/stable/mysql-compatibility and I don't know of a good workaround.Other compatibility issues
The TiDB logs show that the tool tries to run
SELECT @@SESSION.sql_generate_invisible_primary_key
which is not supported by TiDB. However as this variable was recently introduced in MySQL 8.0 the tool ignores this error.Why compatibility is needed
Tasks
Important:
LOAD DATA LOCAL INFILE ... REPLACE INTO
LOAD DATA LOCAL INFILE ... REPLACE INTO
MySQL compatibilityMinor and/or nice to have:
FLUSH TABLES WITH READ LOCK
(Using@@tidb_snapshot
functionality as documented on https://docs.pingcap.com/tidb/stable/read-historical-data if that's considered safe?)mysqlsh
checks for triggers.READ-UNCOMMITTED
isolationsql_generate_invisible_primary_key
variableThe text was updated successfully, but these errors were encountered: