Skip to content

add runtime table route conflict detection #5180

@3AceShowHand

Description

@3AceShowHand

Background

Table route rules can map multiple upstream source table names to downstream target table names. TiCDC must not allow two different source tables in one changefeed to write to the same routed target table.

Static validation covers conflicts that already exist at changefeed create/update time, but runtime DDLs can introduce a conflict later, for example:

  • CREATE TABLE / CREATE TABLES / RECOVER TABLE admitting a new source owner.
  • RENAME TABLE / RENAME TABLES replacing an existing source owner with a new one.
  • Drop/recreate or failover/replay paths where route admission state must stay consistent.

Goal

Add runtime table route conflict detection so TiCDC can:

  • Track source-table ownership of routed target tables inside the maintainer.
  • Reject or fail a changefeed when a runtime DDL would admit a second source owner for an already-owned target table.
  • Preserve existing DDL/barrier behavior for route-neutral DDLs.
  • Treat source schema/table name as the route identity, not physical table ID.

Design Summary

The implementation is in PR #5098:

  • Add TargetTableRegistry to atomically validate source owner transitions.
  • Add maintainer-owned routeAdmin to build route transitions from schema-store table info and heartbeat block status.
  • Hook route admission into barrier precheck/apply and non-block schedule paths.
  • Keep TRUNCATE TABLE and partition DDLs as route-neutral when the source table name does not change, even though physical table IDs change.
  • Cache route-neutral BlockTables events so column/index-only DDLs stay cheap.

Validation Scope

PR #5098 includes:

  • Registry unit tests for static and transition conflict checks.
  • Maintainer unit tests for route admission, replay/failover, physical table ID changes, and barrier precheck/apply behavior.
  • Light integration coverage for static conflict, runtime create-table conflict, and multi-rename conflict.
  • Existing table route integration coverage extended with a force-split variant.

Linked PR

Metadata

Metadata

Assignees

Labels

type/feature-requestCategorizes issue or PR as related to a new feature.

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions