tiflow
tiflow copied to clipboard
TiCDC does not replicate ALTER TABLE SHARD_ROW_ID_BITS and ATTRIBUTES statements
What did you do?
create a tidb sink, and execute on upstream:
CREATE TABLE t (a INT, b varchar(200) primary key NONCLUSTERED, INDEX idx1(a)) SHARD_ROW_ID_BITS = 4 PRE_SPLIT_REGIONS=2;
ALTER TABLE t SHARD_ROW_ID_BITS = 3;
ALTER TABLE t ATTRIBUTES 'merge_option=deny';
then run on downstream:
show create table t;
select * from information_schema.attributes where id = 'schema/test/t';
What did you expect to see?
the "show create table t" statement in downstream shows SHARD_ROW_ID_BITS = 3.
the "information_schema.attributes" table has a "merge_option=deny" entry.
What did you see instead?
none of them happened, because the two DDLs are not replicated.
Versions of the cluster
reproduced on v6.5.11 and v8.5.3
[2025/10/27 17:15:15.866 +08:00] [INFO] [ddl_puller.go:129] ["handle ddl job"] [namespace=default] [changefeed=test_ddl_puller] [query="ALTER TABLE t SHARD_ROW_ID_BITS = 7"] [job="ID:89, Type:shard row ID, State:done, SchemaState:public, SchemaID:2, TableID:80, RowCount:0, ArgLen:0, start time: 2025-10-27 17:15:15.504 +0800 HKT, Err:<nil>, ErrCount:0, SnapshotVersion:0"] [skip=true]
[2025/10/27 17:20:38.981 +08:00] [INFO] [ddl_puller.go:129] ["handle ddl job"] [namespace=default] [changefeed=test_ddl_puller] [query="ALTER TABLE t ATTRIBUTES 'merge_option=allow'"] [job="ID:93, Type:alter table attributes, State:done, SchemaState:public, SchemaID:2, TableID:80, RowCount:0, ArgLen:0, start time: 2025-10-27 17:20:38.958 +0800 HKT, Err:<nil>, ErrCount:0, SnapshotVersion:0"] [skip=true]
These DDLs are skipped because shard row ID and alter table attributes are not whitelisted. Accompanying this with another whitelisted option can workaround the problem (note "skip=false"):
[2025/10/27 17:15:50.995 +08:00] [INFO] [ddl_puller.go:129] ["handle ddl job"] [namespace=default] [changefeed=test_ddl_puller] [query="ALTER TABLE t SHARD_ROW_ID_BITS = 8 COMMENT='www'"] [job="ID:91, Type:modify table comment, State:done, SchemaState:public, SchemaID:2, TableID:80, RowCount:0, ArgLen:0, start time: 2025-10-27 17:15:50.805 +0800 HKT, Err:<nil>, ErrCount:0, SnapshotVersion:0"] [skip=false]
Adding these 2 options into the whitelist similar to #12329 should be enough to fix the issue.
(Internal reference: TICKET-6817)