inconsistent index time_index handle count 2 isn't equal to value count 1
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
Please answer these questions before submitting your issue. Thanks!
### 1. Minimal reproduce step (Required)
1. 部署 v4.0.12
2. CREATE GLOBAL BINDING
use test
CREATE TABLE `a1` (`id` int(11) NOT NULL ,`k` varchar(30) DEFAULT NULL,PRIMARY KEY (`id`),KEY `k_1` (`k`),KEY `k_2` (`k`));
CREATE TABLE `b1` (`id` int(11) NOT NULL ,`k` varchar(30) DEFAULT NULL,PRIMARY KEY (`id`),KEY `k_1` (`k`),KEY `k_2` (`k`));
CREATE session BINDING FOR select * from a1 where k >10 USING select * from a1 use index(k_2) where k >10;
CREATE GLOBAL BINDING FOR select * from a1 where k >10 USING select * from a1 use index(k_2) where k >10;
show global bindings\G

3. tiup cluster upgrade [cluster_name] v5.4.1 --offline
4. tiup cluster start [cluster_name]
5. inconsistent index handles
[2022/11/24 11:09:59.788 +08:00] [INFO] [domain.go:432] ["full load and reset schema validator"]
[2022/11/24 11:09:59.788 +08:00] [INFO] [ddl.go:347] ["[ddl] start DDL"] [ID=d1baf3a8-d9a8-43a9-bd90-5fb4967aa3d0] [runWorker=true]
[2022/11/24 11:09:59.789 +08:00] [INFO] [manager.go:189] ["start campaign owner"] [ownerInfo="[ddl] /tidb/ddl/fg/owner"]
[2022/11/24 11:09:59.789 +08:00] [INFO] [ddl.go:336] ["[ddl] start delRangeManager OK"] ["is a emulator"=false]
[2022/11/24 11:09:59.789 +08:00] [INFO] [ddl_worker.go:156] ["[ddl] start DDL worker"] [worker="worker 1, tp general"]
[2022/11/24 11:09:59.789 +08:00] [INFO] [ddl_worker.go:156] ["[ddl] start DDL worker"] [worker="worker 2, tp add index"]
[2022/11/24 11:09:59.799 +08:00] [ERROR] [distsql.go:1277] ["inconsistent index handles"] [table_name=] [index=time_index] [index_cnt=2] [table_cnt=1] [missing_handles="[2030002]"] [total_handles="[2030002 2163769]"]
[2022/11/24 11:09:59.799 +08:00] [FATAL] [terror.go:292] ["unexpected error"] [error="inconsistent index time_index handle count 2 isn't equal to value count 1"] [stack="[github.com/pingcap/tidb/parser/terror.MustNil\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/parser/terror/terror.go:292\nmain.createStoreAndDomain\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/tidb-server/main.go:297\nmain.main\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/tidb-server/main.go:202\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:225](http://github.com/pingcap/tidb/parser/terror.MustNil/n/t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/parser/terror/terror.go:292/nmain.createStoreAndDomain/n/t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/tidb-server/main.go:297/nmain.main/n/t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/tidb-server/main.go:202/nruntime.main/n/t/usr/local/go/src/runtime/proc.go:225)"] [stack="[github.com/pingcap/tidb/parser/terror.MustNil\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/parser/terror/terror.go:292\nmain.createStoreAndDomain\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/tidb-server/main.go:297\nmain.main\n\t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/tidb-server/main.go:202\nruntime.main\n\t/usr/local/go/src/runtime/proc.go:225](http://github.com/pingcap/tidb/parser/terror.MustNil/n/t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/parser/terror/terror.go:292/nmain.createStoreAndDomain/n/t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/tidb-server/main.go:297/nmain.main/n/t/home/jenkins/agent/workspace/build-common/go/src/github.com/pingcap/tidb/tidb-server/main.go:202/nruntime.main/n/t/usr/local/go/src/runtime/proc.go:225)"]
### 2. What did you expect to see? (Required)
success
### 3. What did you see instead (Required)
inconsistent index handles
### 4. What is your TiDB version? (Required)
v4.0.12
Contributor guide
Assessment
This issue has not been assessed yet.