tiflow icon indicating copy to clipboard operation
tiflow copied to clipboard

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

Open pingyu opened this issue 1 month ago • 1 comments

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/[email protected]/pkg/meta/model/job_args.go:873
github.com/pingcap/tidb/pkg/meta/model.(*RenameTablesArgs).decodeV1(0xc0043d70e0, 0xc0044d2820)
	github.com/pingcap/[email protected]/pkg/meta/model/job_args.go:852 +0x59b
github.com/pingcap/tidb/pkg/meta/model.getOrDecodeArgsV1[...](0xc0043d70e0?, 0xc00448cd01)
	github.com/pingcap/[email protected]/pkg/meta/model/job_args.go:66 +0x23
github.com/pingcap/tidb/pkg/meta/model.getOrDecodeArgs[...](0x53597a0?, 0xc0044cef80?)
	github.com/pingcap/[email protected]/pkg/meta/model/job_args.go:90 +0x25
github.com/pingcap/tidb/pkg/meta/model.GetRenameTablesArgs(...)
	github.com/pingcap/[email protected]/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/[email protected]/errgroup/errgroup.go:79 +0x50
created by golang.org/x/sync/errgroup.(*Group).Go in goroutine 503
	golang.org/x/[email protected]/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]

pingyu avatar Nov 11 '25 02:11 pingyu

From @joechenrh , see https://github.com/pingcap/tidb/blob/293331cd9211c214f3431ff789210374378e9697/pkg/ddl/ddl_worker.go#L1448-L1453, the 6th job args is removed on success when run on 7.5, while in 8.5 we expect 6 args

if the job is run on 8.5, either job args v1 or v2, the 6th args will be kept

D3Hunter avatar Nov 11 '25 03:11 D3Hunter