使用mysql导出的sql文件,导入tidb,经常会有类似这样的错误。

1.[Err] 8229 - TTL manager has timed out, pessimistic locks may expire, please commit or rollback this transaction

2.Transaction is too large, size

  1. 麻烦提供具体的版本号以及操作步骤。
  2. Transcation is too large 的问题是老问题了。可以先参考下论坛的帖子以及 FAQ 的专栏。
    [FAQ] tidb 导入大量数据提示 8004 - Transaction is too large, size: xxx

版本号用的是dockerhub的最新版本latest,应该是4+。操作就是把sql文件导入ti

TTL 的问题可以参考一下:
https://docs.pingcap.com/zh/tidb/stable/troubleshoot-lock-conflicts#ttl-manager-has-timed-out

表结构:
CREATE TABLE table_name (
c1 datetime NOT NULL,
c2 datetime NOT NULL,
c3 varchar(255) COLLATE utf8mb4_general_ci NOT NULL,
c4 varchar(255) COLLATE utf8mb4_general_ci DEFAULT NULL,
c5 int(11) DEFAULT NULL,
c6 datetime NOT NULL,
c7 datetime NOT NULL,
PRIMARY KEY (c1,c2,c3) USING BTREE,
KEY idx_concurrent (c3,c4) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;

导入时上面还有很多表,很多数据
报错:

[Err] 8229 - TTL manager has timed out, pessimistic locks may expire, please commit or rollback this transaction
[Err] INSERT INTO table_name VALUES (‘2020-02-23 09:09:56’, ‘2020-02-23 09:10:11’, ‘761908’, ‘f422c88a-3ee6-4361-b558-d70d3aa12238’, ‘24’, ‘2020-02-24 01:10:00’, ‘2020-02-24 01:10:00’);
INSERT INTO table_name VALUES (‘2020-02-23 09:10:06’, ‘2020-02-23 09:10:53’, ‘483991’, ‘8826e272-2ecf-45eb-b557-9a10d8c3ba90’, ‘21’, ‘2020-02-24 01:10:36’, ‘2020-02-24 01:10:36’);
INSERT INTO table_name VALUES (‘2020-02-23 09:10:09’, ‘2020-02-23 09:10:37’, ‘608962’, ‘4e0991a0-ffe2-4d5a-8683-6c31048df8f9’, ‘20’, ‘2020-02-24 01:09:57’, ‘2020-02-24 01:09:57’);
INSERT INTO table_name VALUES (‘2020-02-23 09:10:11’, ‘2020-02-23 09:10:16’, ‘761908’, ‘f422c88a-3ee6-4361-b558-d70d3aa12238’, ‘23’, ‘2020-02-24 01:10:00’, ‘2020-02-24 01:10:00’);
INSERT INTO table_name VALUES (‘2020-02-23 09:10:16’, ‘2020-02-23 09:10:19’, ‘761908’, ‘f422c88a-3ee6-4361-b558-d70d3aa12238’, ‘22’, ‘2020-02-24 01:10:00’, ‘2020-02-24 01:10:00’);
INSERT INTO table_name VALUES (‘2020-02-23 09:10:16’, ‘2020-02-23 09:10:37’, ‘980969’, ‘bd5fec0e-51cc-4b6d-bdd2-938d282bd292’, ‘3’, ‘2020-02-24 01:10:26’, ‘2020-02-24 01:10:26’);
INSERT INTO table_name VALUES (‘2020-02-23 09:10:16’, ‘2020-02-23 09:10:40’, ‘497364’, ‘9e3748f7-79c9-4206-9237-2207cf38139d’, ‘20’, ‘2020-02-24 01:10:12’, ‘2020-02-24 01:10:12’);
INSERT INTO table_name VALUES (‘2020-02-23 09:10:19’, ‘2020-02-23 09:10:24’, ‘761908’, ‘f422c88a-3ee6-4361-b558-d70d3aa12238’, ‘21’, ‘2020-02-24 01:10:00’, ‘2020-02-24 01:10:00’);
INSERT INTO table_name VALUES (‘2020-02-23 09:10:24’, ‘2020-02-23 09:10:27’, ‘761908’, ‘f422c88a-3ee6-4361-b558-d70d3aa12238’, ‘20’, ‘2020-02-24 01:10:00’, ‘2020-02-24 01:10:00’);
INSERT INTO table_name VALUES (‘2020-02-23 09:10:27’, ‘2020-02-23 09:10:30’, ‘761908’, ‘f422c88a-3ee6-4361-b558-d70d3aa12238’, ‘19’, ‘2020-02-24 01:10:00’, ‘2020-02-24 01:10:00’);
INSERT INTO table_name VALUES (‘2020-02-23 09:10:30’, ‘2020-02-23 09:10:33’, ‘761908’, ‘f422c88a-3ee6-4361-b558-d70d3aa12238’, ‘18’, ‘2020-02-24 01:10:00’, ‘2020-02-24 01:10:00’);
INSERT INTO table_name VALUES (‘2020-02-23 09:10:33’, ‘2020-02-23 09:10:34’, ‘761908’, ‘f422c88a-3ee6-4361-b558-d70d3aa12238’, ‘17’, ‘2020-02-24 01:10:00’, ‘2020-02-24 01:10:00’);
INSERT INTO table_name VALUES (‘2020-02-23 09:10:34’, ‘2020-02-23 09:10:40’, ‘761908’, ‘f422c88a-3ee6-4361-b558-d70d3aa12238’, ‘16’, ‘2020-02-24 01:10:00’, ‘2020-02-24 01:10:00’);
INSERT INTO table_name VALUES (‘2020-02-23 09:10:36’, ‘2020-02-23 09:11:05’, ‘117396’, ‘c42be028-b007-4538-a7f5-20c63c7e6081’, ‘22’, ‘2020-02-24 01:10:35’, ‘2020-02-24 01:10:35’);
INSERT INTO table_name VALUES (‘2020-02-23 09:10:37’, ‘2020-02-23 09:10:38’, ‘608962’, ‘4e0991a0-ffe2-4d5a-8683-6c31048df8f9’, ‘19’, ‘2020-02-24 01:09:57’, ‘2020-02-24 01:09:57’);
INSERT INTO table_name VALUES (‘2020-02-23 09:10:37’, ‘2020-02-23 09:10:52’, ‘980969’, ‘bd5fec0e-51cc-4b6d-bdd2-938d282bd292’, ‘2’, ‘2020-02-24 01:10:26’, ‘2020-02-24 01:10:26’);
INSERT INTO table_name VALUES (‘2020-02-23 09:10:38’, ‘2020-02-23 09:10:50’, ‘608962’, ‘4e0991a0-ffe2-4d5a-8683-6c31048df8f9’, ‘20’, ‘2020-02-24 01:09:57’, ‘2020-02-24 01:09:57’);
INSERT INTO table_name VALUES (‘2020-02-23 09:10:40’, ‘2020-02-23 09:10:45’, ‘761908’, ‘f422c88a-3ee6-4361-b558-d70d3aa12238’, ‘15’, ‘2020-02-24 01:10:00’, ‘2020-02-24 01:10:00’);
INSERT INTO table_name VALUES (‘2020-02-23 09:10:40’, ‘2020-02-23 09:11:34’, ‘497364’, ‘9e3748f7-79c9-4206-9237-2207cf38139d’, ‘21’, ‘2020-02-24 01:10:12’, ‘2020-02-24 01:10:12’);
INSERT INTO table_name VALUES (‘2020-02-23 09:10:45’, ‘2020-02-23 09:10:50’, ‘761908’, ‘f422c88a-3ee6-4361-b558-d70d3aa12238’, ‘14’, '2020-02-24 01:10:00
[Msg] Finished - Unsuccessfully

  1. 可以根据之前提到的文章把 TiDB 参数 performance.max-txn-ttl 调大。
  2. 对原来 Mysql 的数据同步到 TiDB 的话。建议可以使用 DM 或者 Mydumper/dumpling + loader/lightning 的方式导入。https://docs.pingcap.com/zh/tidb/dev/ecosystem-tool-user-guide#tidb-生态工具功能概览

此话题已在最后回复的 1 分钟后被自动关闭。不再允许新回复。