Open dveeden opened 3 years ago
For the TRIGGER
permission:
mysql 8.0.22 > CREATE USER foo;
Query OK, 0 rows affected (0.01 sec)
mysql 8.0.22 > GRANT TRIGGER ON *.* TO foo;
Query OK, 0 rows affected (0.01 sec)
mysql 8.0.22 > SHOW GRANTS FOR foo\G
*************************** 1. row ***************************
Grants for foo@%: GRANT TRIGGER ON *.* TO `foo`@`%`
1 row in set (0.00 sec)
tidb 5.7.25-TiDB-v5.0.1 > CREATE USER foo;
Query OK, 0 rows affected (0.03 sec)
tidb 5.7.25-TiDB-v5.0.1 > GRANT TRIGGER ON *.* TO foo;
Query OK, 0 rows affected (0.03 sec)
tidb 5.7.25-TiDB-v5.0.1 > SHOW GRANTS FOR foo\G
*************************** 1. row ***************************
Grants for foo@%: GRANT Trigger ON *.* TO 'foo'@'%'
1 row in set (0.00 sec)
It may be comparing TRIGGER
against Trigger
, but I'm not sure yet
When will LOAD DATA LOCAL INFILE ... REPLACE INTO be supported? This is very important to us!!!
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 LOAD DATA LOCAL INFILE ... REPLACE INTO
? any specific usecase? With MySQL Shell dump and load or something else? Information like this can help with prioritization and also to make sure we fully cover that usecase.
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
LOAD DATA LOCAL INFILE ... REPLACE INTO
? any specific usecase? With MySQL Shell dump and load or something else? Information like this can help with prioritization and also to make sure we fully cover that usecase.
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.
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
LOAD DATA LOCAL INFILE ... REPLACE INTO
? any specific usecase? With MySQL Shell dump and load or something else? Information like this can help with prioritization and also to make sure we fully cover that usecase.
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 LOAD DATA LOCAL INFILE ... REPLACE INTO
. Currently, there is no better alternative, so we really hope to support it.
LOAD DATA ... REPLACE INTO
should be supported in https://github.com/pingcap/tidb/pull/41947 . Welcome to test it in the coming release
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
variable