tidb icon indicating copy to clipboard operation
tidb copied to clipboard

Fast reorg create index is stuck at the stage of merging temp index, and the ddl job fails after retries

Open fzzf678 opened this issue 7 months ago • 0 comments

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

set global tidb_ddl_enable_fast_reorg = on; -- turn off dxf after 8.5 at the same time

And add index with workload, the workload is updating the column related to the index col frequently. In the merge temp index stage, there will be los of write conflict in log. And after the ddl job reach the maximum retry count, ddl job will faild.

CREATE TABLE `t` (
  `a` varchar(64) NOT NULL , 
  `b` varchar(64) NOT NULL , 
  `c` varchar(64) DEFAULT NULL,
  `d` bigint(20) NOT NULL,
  `e` int(11) NOT NULL,
  `f` bigint(20) NOT NULL,
  `g` varchar(128) NOT NULL,
  `h` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `i` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`a`,`b`)
);

alter table t add index(b, f);

-- workload like this 
INSERT INTO
  `t` (
    `a`,
    `b`,
    `c`,
    `d`,
    `e`,
    `f`,
    `g`
  )
VALUES
  (...) ON DUPLICATE KEY 
UPDATE
  `a` = VALUES (`a`),
  `b` = VALUES (`b`),
  `c` = VALUES (`c`),
  `d` = VALUES(`d`),
  `e` = VALUES(`e`),
  `f` = VALUES (`f`),
  `g` = VALUES (`g`);

2. What did you expect to see? (Required)

Add index success

3. What did you see instead (Required)

Add index reatch the max error limit and failed.

Execute: Write conflict, txnStartTS=458282835105808427, conflictStartTS=458282835118915588, conflictCommitTS=0, key=????, reason=Optimistic [try again later].

4. What is your TiDB version? (Required)

v7.5.6

fzzf678 avatar May 30 '25 10:05 fzzf678