Skip to content
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

Lightning import fails if auto_increment / auto_random column is NULL and backend is local/importer #34208

Closed
fubinzh opened this issue Jun 21, 2021 · 3 comments · Fixed by #34552
Assignees
Labels
affects-6.0 component/lightning This issue is related to Lightning of TiDB. severity/major type/bug The issue is confirmed as a bug.

Comments

@fubinzh
Copy link

fubinzh commented Jun 21, 2021

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?
    If possible, provide a recipe for reproducing the error.
  • create a table with auto increment / auto random bigint as primary key

CREATE TABLE t_auto_incr (
id bigint PRIMARY KEY AUTO_INCREMENT,
c char(40) NOT NULL DEFAULT '');

CREATE TABLE t_auto_random (
id bigint PRIMARY KEY AUTO_RANDOM(3),
c char(40) NOT NULL DEFAULT '');

  • create sql file for tidb-lightning import, which contains 2 rows, and primary key column is NULL

[root@centos76_vm auto_increment]# more test.t_auto_incr.1.sql
INSERT INTO t_auto_incr VALUES
(NULL, 'HhdyJnKnnFkYMltimhLCZnzTyvHYgZKmqcsxidPV');
INSERT INTO t_auto_incr VALUES
(NULL, 'TaCiCHTXSlpWtqdjmExJLsvWdWZvpWqFSeyQNTky');

  • Use tidb-linghtning to import the rows in the SQL file to TiDB using local or importer backend
  1. What did you expect to see?
  • Import should be successfully, and id column is auto generated.
  1. What did you see instead?
  • Lightning import fails with below errors, only one row inserted into TiDB whose id is 0.

Note: Import is OK if tidb backend is used for lightning import.

[root@centos76_vm auto_increment]# tiup tidb-lightning:v5.0.2 -config lighting.toml
Starting component tidb-lightning: /root/.tiup/components/tidb-lightning/v5.0.2/tidb-lightning -config lighting.toml
Verbose debug logs will be written to tidb-lightning.log

Error: checksum mismatched remote vs local => (checksum: 8717407354590535884 vs 10040980041112552038) (total_kvs: 1 vs 2) (total_bytes:63 vs 126)
tidb lightning encountered error: checksum mismatched remote vs local => (checksum: 8717407354590535884 vs 10040980041112552038) (total_kvs: 1 vs 2) (total_bytes:63 vs 126)
Error: run /root/.tiup/components/tidb-lightning/v5.0.2/tidb-lightning (wd:/root/.tiup/data/SawwSYl) failed: exit status 1

MySQL [test]> select * from t_auto_incr;
+----+------------------------------------------+
| id | c |
+----+------------------------------------------+
| 0 | TaCiCHTXSlpWtqdjmExJLsvWdWZvpWqFSeyQNTky |
+----+------------------------------------------+
1 row in set (0.01 sec)

  1. What version of BR and TiDB/TiKV/PD are you using?

br: v5.0.2 and v5.1.0

  1. Operation logs

    • Please upload br.log for BR if possible
    • Please upload tidb-lightning.log for TiDB-Lightning if possible
    • Please upload tikv-importer.log from TiKV-Importer if possible
    • Other interesting logs
  2. Configuration of the cluster and the task

    • tidb-lightning.toml for TiDB-Lightning if possible
    • tikv-importer.toml for TiKV-Importer if possible
    • topology.yml if deployed by TiUP
  3. Screenshot/exported-PDF of Grafana dashboard or metrics' graph in Prometheus if possible

@fubinzh fubinzh added type/bug The issue is confirmed as a bug. severity/major component/import labels Jun 21, 2021
@sleepymole sleepymole transferred this issue from pingcap/br Apr 25, 2022
@sleepymole sleepymole added component/lightning This issue is related to Lightning of TiDB. and removed component/import labels Apr 25, 2022
@niubell
Copy link
Contributor

niubell commented Apr 27, 2022

/assign niubell

@niubell
Copy link
Contributor

niubell commented Apr 27, 2022

/assign dsdashun

@niubell
Copy link
Contributor

niubell commented Apr 27, 2022

/unassign niubell

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-6.0 component/lightning This issue is related to Lightning of TiDB. severity/major type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants