pingcap / pingcap/ticdc

TiCDC panic for "index out of range [0] with length 0" when upstream TiDB (v7.5) execute rename tables

Open
#3,112 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

may-affects-9.0 severity/major type/bug
Dominant language
Go
Stars
56
Forks
63
Avg merge
2d 20h
Merged PRs (30d)
34

Description

What did you do?
  1. Setup the upstream & downstream cluster and TiCDC.

  2. Create the changefeed.

  3. Execute the DDL on upstream TiDB:

CREATE TABLE t1 ...
CREATE TABLE t2 ...
RENAME TABLE t1 TO t3, t2 TO t4;
What did you expect to see?

Nothing wrong.

What did you see instead?

TiCDC panic:

panic: runtime error: index out of range [0] with length 0

goroutine 507 [running]:
github.com/pingcap/tidb/pkg/meta/model.GetRenameTablesArgsFromV1(...)
	github.com/pingcap/tidb@v1.1.0-beta.0.20250415080739-a02630cc24cf/pkg/meta/model/job_args.go:873
github.com/pingcap/tidb/pkg/meta/model.(*RenameTablesArgs).decodeV1(0xc0043d70e0, 0xc0044d2820)
	github.com/pingcap/tidb@v1.1.0-beta.0.20250415080739-a02630cc24cf/pkg/meta/model/job_args.go:852 +0x59b
github.com/pingcap/tidb/pkg/meta/model.getOrDecodeArgsV1[...](0xc0043d70e0?, 0xc00448cd01)
	github.com/pingcap/tidb@v1.1.0-beta.0.20250415080739-a02630cc24cf/pkg/meta/model/job_args.go:66 +0x23
github.com/pingcap/tidb/pkg/meta/model.getOrDecodeArgs[...](0x53597a0?, 0xc0044cef80?)
	github.com/pingcap/tidb@v1.1.0-beta.0.20250415080739-a02630cc24cf/pkg/meta/model/job_args.go:90 +0x25
github.com/pingcap/tidb/pkg/meta/model.GetRenameTablesArgs(...)
	github.com/pingcap/tidb@v1.1.0-beta.0.20250415080739-a02630cc24cf/pkg/meta/model/job_args.go:885
github.com/pingcap/tiflow/cdc/puller.(*ddlJobPullerImpl).handleRenameTables(0xc002d0cc80, 0xc0044d2820)
	github.com/pingcap/tiflow/cdc/puller/ddl_puller.go:547 +0x58
github.com/pingcap/tiflow/cdc/puller.(*ddlJobPullerImpl).handleJob(0xc002d0cc80, 0xc0044d2820)
	github.com/pingcap/tiflow/cdc/puller/ddl_puller.go:367 +0x16c8
github.com/pingcap/tiflow/cdc/puller.(*ddlJobPullerImpl).handleRawKVEntry(0xc002d0cc80, {0x5e8f060, 0xc002a8a0a0}, 0xc000dd84d0)
	github.com/pingcap/tiflow/cdc/puller/ddl_puller.go:211 +0xd9
github.com/pingcap/tiflow/cdc/puller.(*ddlJobPullerImpl).Run.func3()
	github.com/pingcap/tiflow/cdc/puller/ddl_puller.go:154 +0xb5
golang.org/x/sync/errgroup.(*Group).Go.func1()
	golang.org/x/sync@v0.13.0/errgroup/errgroup.go:79 +0x50
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 503
	golang.org/x/sync@v0.13.0/errgroup/errgroup.go:76 +0x96

Test case: https://tcms.pingcap.net/dashboard/executions/plan/7973676

Explore-logs-2025-11-11 09_53_37.txt.zip

Versions of the cluster

Upstream TiDB cluster version (execute SELECT tidb_version(); in a MySQL client):

MySQL [(none)]> select tidb_version();
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version()                                                                                                                                                                                                                                          |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v7.5.6-serverless
Edition: Community
Git Commit Hash: 2a68453f417d80af45b3e0aa4598f0360c924d50
Git Branch: None
UTC Build Time: 2025-11-05 10:24:50
GoVersion: go1.24.4
Race Enabled: false
Check Table Before Drop: false
Store: tikv |
+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.001 sec)

Upstream TiKV version (execute tikv-server --version):

CSE + replication worker

TiCDC version (execute cdc version):

["Welcome to Change Data Capture (CDC)"] [release-version=v8.5.3] [git-hash=4d578e92b87cc67288a832da6b050434f51ef94e] [git-branch=HEAD] [utc-build-time="2025-08-22 07:53:39"] [go-version=go1.23.8]

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with cdc/puller/ddl_puller.go, especially handleRenameTables, and trace the TiDB job_args.go calls shown in the panic. Reproduce the multi-table RENAME TABLE sequence on the listed TiDB and TiCDC versions, using the linked test case and logs. Done means TiCDC processes the rename without an index-out-of-range panic.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
databases, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.