pingcap / pingcap/tidb

Wrong ROW_COUNT using admin show ddl jobs when setting tidb_enable_dist_task= on

Open
#58,932 4 comments 0 reactions 1 assignee Claimed by @tangenta View on GitHub
component/ddl impact/wrong-result may-affects-5.4 may-affects-6.1 may-affects-6.5 may-affects-7.1 may-affects-7.5 may-affects-8.1 may-affects-8.5 severity/major type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

tidb_enable_dist_task = off is by default on v7.5.5. When we enable it and execute the add index ddl, the index could be created successfully but there are 0 in ROW_COUNT in admin show ddl jobs. The situation seems not happening on v8.5.0.

### 1. Minimal reproduce step (Required)
/Users/test/db.toml:
temp-dir = "/Users/test/temp"

tiup playground v7.5.5 --db.config /Users/test/db.toml

use test;

drop table if exists test_table ;

CREATE TABLE test_table (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(50),
age INT
);

-- 插入 10 行数据
INSERT INTO test_table (name, age) VALUES ('Alice', 25);
INSERT INTO test_table (name, age) VALUES ('Bob', 30);
INSERT INTO test_table (name, age) VALUES ('Charlie', 35);
INSERT INTO test_table (name, age) VALUES ('David', 40);
INSERT INTO test_table (name, age) VALUES ('Eve', 45);
INSERT INTO test_table (name, age) VALUES ('Frank', 50);
INSERT INTO test_table (name, age) VALUES ('Grace', 55);
INSERT INTO test_table (name, age) VALUES ('Henry', 60);
INSERT INTO test_table (name, age) VALUES ('Ivy', 65);
INSERT INTO test_table (name, age) VALUES ('Jack', 70);

-- 创建索引
SET GLOBAL tidb_enable_dist_task= off;
CREATE INDEX idx_age1 ON test_table(age);
CREATE INDEX idx_age2 ON test_table(age);
CREATE INDEX idx_age3 ON test_table(age);
CREATE INDEX idx_age4 ON test_table(age);
CREATE INDEX idx_age5 ON test_table(age);
SET GLOBAL tidb_enable_dist_task= on;
CREATE INDEX idx_age6 ON test_table(age);
CREATE INDEX idx_age7 ON test_table(age);
CREATE INDEX idx_age8 ON test_table(age);
CREATE INDEX idx_age9 ON test_table(age);
CREATE INDEX idx_age10 ON test_table(age);

### 2. What did you expect to see? (Required)
Column ROW_COUNT should be 10 for all add index operations.

### 3. What did you see instead (Required)
```sql
mysql> admin show ddl jobs;
+--------+---------+------------+------------------------+--------------+-----------+----------+-----------+---------------------+---------------------+---------------------+--------+
| JOB_ID | DB_NAME | TABLE_NAME | JOB_TYPE | SCHEMA_STATE | SCHEMA_ID | TABLE_ID | ROW_COUNT | CREATE_TIME | START_TIME | END_TIME | STATE |
+--------+---------+------------+------------------------+--------------+-----------+----------+-----------+---------------------+---------------------+---------------------+--------+
| 148 | test | test_table | add index /* ingest */ | public | 2 | 137 | 10 | 2025-01-15 11:33:38 | 2025-01-15 11:33:38 | 2025-01-15 11:33:41 | synced |
| 147 | test | test_table | add index /* ingest */ | public | 2 | 137 | 0 | 2025-01-15 11:33:35 | 2025-01-15 11:33:35 | 2025-01-15 11:33:38 | synced |
| 146 | test | test_table | add index /* ingest */ | public | 2 | 137 | 10 | 2025-01-15 11:33:32 | 2025-01-15 11:33:32 | 2025-01-15 11:33:35 | synced |
| 145 | test | test_table | add index /* ingest */ | public | 2 | 137 | 0 | 2025-01-15 11:33:29 | 2025-01-15 11:33:29 | 2025-01-15 11:33:32 | synced |
| 144 | test | test_table | add index /* ingest */ | public | 2 | 137 | 10 | 2025-01-15 11:33:25 | 2025-01-15 11:33:25 | 2025-01-15 11:33:29 | synced |
| 143 | test | test_table | add index /* ingest */ | public | 2 | 137 | 10 | 2025-01-15 11:33:24 | 2025-01-15 11:33:24 | 2025-01-15 11:33:25 | synced |
| 142 | test | test_table | add index /* ingest */ | public | 2 | 137 | 10 | 2025-01-15 11:33:23 | 2025-01-15 11:33:23 | 2025-01-15 11:33:24 | synced |
| 141 | test | test_table | add index /* ingest */ | public | 2 | 137 | 10 | 2025-01-15 11:33:23 | 2025-01-15 11:33:23 | 2025-01-15 11:33:23 | synced |
| 140 | test | test_table | add index /* ingest */ | public | 2 | 137 | 10 | 2025-01-15 11:33:22 | 2025-01-15 11:33:22 | 2025-01-15 11:33:23 | synced |
| 139 | test | test_table | add index /* ingest */ | public | 2 | 137 | 10 | 2025-01-15 11:33:21 | 2025-01-15 11:33:21 | 2025-01-15 11:33:22 | synced |
+--------+---------+------------+------------------------+--------------+-----------+----------+-----------+---------------------+---------------------+---------------------+--------+
```

### 4. What is your TiDB version? (Required)

v7.5.5

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.