pingcap / pingcap/tidb

delete region cause run statement failed

Open
#58,187 4 comments 0 reactions 0 assignees View on GitHub
question
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)
run SQL
```sql
SET @@global.MAX_EXECUTION_TIME = 30000;
CREATE DATABASE region_merge;
CREATE TABLE region_merge.t1 (id bigint primary key);
SPLIT TABLE region_merge.t1 BETWEEN (-9223372036854775808) AND (9223372036854775807) REGIONS 40;
SELECT count(distinct region_id) from information_schema.tikv_region_status where db_name = 'region_merge' and table_name = 't1';
insert into region_merge.t1 values (-9223372036854775808),(0),(1),(9223372036854775807);
delete from region_merge.t1;
```
It is a TiCDC [integration test case](https://github.com/pingcap/tiflow/blob/master/tests/integration_tests/region_merge/run.sh) and has had frequent failures recently.

### 2. What did you expect to see? (Required)
every thing is ok
### 3. What did you see instead (Required)
ERROR 1105 (HY000) at line 1: context canceled
```log
[2024/12/12 08:23:19.729 +08:00] [WARN] [session.go:2163] ["run statement failed"] [conn=3925868580] [session_alias=] [schemaVersion=56] [error="context canceled"] [session="{\n \"currDBName\": \"\",\n \"id\": 3925868580,\n \"status\": 2,\n \"strictMode\": true,\n \"user\": {\n \"Username\": \"root\",\n \"Hostname\": \"127.0.0.1\",\n \"CurrentUser\": false,\n \"AuthUsername\": \"root\",\n \"AuthHostname\": \"%\",\n \"AuthPlugin\": \"mysql_native_password\"\n }\n}"]
[2024/12/12 08:23:19.730 +08:00] [INFO] [conn.go:1184] ["command dispatched failed"] [conn=3925868580] [session_alias=] [connInfo="id:3925868580, addr:127.0.0.1:37696 status:10, collation:utf8mb4_general_ci, user:root"] [command=Query]
[status="inTxn:0, autocommit:1"]
[sql="delete from region_merge.t1"]
[txn_mode=PESSIMISTIC] [timestamp=454547996589424660]
[err="context canceled
\ngithub.com/tikv/client-go/v2/internal/locate.(*RegionRequestSender).sendReqToRegion
\n\t/home/jenkins/agent/workspace/build_tidb_multi_branch_master/go/pkg/mod/github.com/tikv/client-go/v2@v2.0.8-0.20241120024459-05d115b3e88b/internal/locate/region_request.go:1203
\ngithub.com/tikv/client-go/v2/internal/locate.(*RegionRequestSender).SendReqCtx
\n\t/home/jenkins/agent/workspace/build_tidb_multi_branch_master/go/pkg/mod/github.com/tikv/client-go/v2@v2.0.8-0.20241120024459-05d115b3e88b/internal/locate/region_request.go:870
\ngithub.com/tikv/client-go/v2/txnkv/txnsnapshot.(*ClientHelper).SendReqCtx\n\t/home/jenkins/agent/workspace/build_tidb_multi_branch_master/go/pkg/mod/github.com/tikv/client-go/v2@v2.0.8-0.20241120024459-05d115b3e88b/txnkv/txnsnapshot/client_helper.go:146\ngithub.com/pingcap/tidb/pkg/store/copr.(*copIteratorWorker).handleTaskOnce
\n\t/home/jenkins/agent/workspace/build_tidb_multi_branch_master/go/src/github.com/pingcap/tidb/pkg/store/copr/coprocessor.go:1279
\ngithub.com/pingcap/tidb/pkg/store/copr.(*copIteratorWorker).handleTask\n\t/home/jenkins/agent/workspace/build_tidb_multi_branch_master/go/src/github.com/pingcap/tidb/pkg/store/copr/coprocessor.go:1169
\ngithub.com/pingcap/tidb/pkg/store/copr.(*copIteratorWorker).run\n\t/home/jenkins/agent/workspace/build_tidb_multi_branch_master/go/src/github.com/pingcap/tidb/pkg/store/copr/coprocessor.go:836
\nruntime.goexit\n\t/home/jenkins/agent/workspace/build_tidb_multi_branch_master/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.23.4.linux-amd64/src/runtime/asm_amd64.s:1700
\ngithub.com/pingcap/errors.AddStack\n\t/home/jenkins/agent/workspace/build_tidb_multi_branch_master/go/pkg/mod/github.com/pingcap/errors@v0.11.5-0.20240318064555-6bd07397691f/errors.go:178
\ngithub.com/pingcap/errors.Trace\n\t/home/jenkins/agent/workspace/build_tidb_multi_branch_master/go/pkg/mod/github.com/pingcap/errors@v0.11.5-0.20240318064555-6bd07397691f/juju_adaptor.go:15
\ngithub.com/pingcap/tidb/pkg/store/driver/error.ToTiDBErr\n\t/home/jenkins/agent/workspace/build_tidb_multi_branch_master/go/src/github.com/pingcap/tidb/pkg/store/driver/error/error.go:208\ngithub.com/pingcap/tidb/pkg/store/copr.(*copIteratorWorker).handleTaskOnce\n\t/home/jenkins/agent/workspace/build_tidb_multi_branch_master/go/src/github.com/pingcap/tidb/pkg/store/copr/coprocessor.go:1281\ngithub.com/pingcap/tidb/pkg/store/copr.(*copIteratorWorker).handleTask\n\t/home/jenkins/agent/workspace/build_tidb_multi_branch_master/go/src/github.com/pingcap/tidb/pkg/store/copr/coprocessor.go:1169\ngithub.com/pingcap/tidb/pkg/store/copr.(*copIteratorWorker).run\n\t/home/jenkins/agent/workspace/build_tidb_multi_branch_master/go/src/github.com/pingcap/tidb/pkg/store/copr/coprocessor.go:836
\nruntime.goexit\n\t/home/jenkins/agent/workspace/build_tidb_multi_branch_master/go/pkg/mod/golang.org/toolchain@v0.0.1-go1.23.4.linux-amd64/src/runtime/asm_amd64.s:1700"]
```

**detail:** https://do.pingcap.net/jenkins/blue/organizations/jenkins/pingcap%2Ftiflow%2Fperiodics_cdc_integration_mysql_test/detail/periodics_cdc_integration_mysql_test/4/pipeline

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

master

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.