Skip to content

[flink][cdc] Skip dropped tables when restoring source splits - #11368

Open
zhangyue19921010 wants to merge 2 commits into
apache:masterfrom
zhangyue19921010:contrib/restore-cdc-after-table-removal-current-20261123
Open

zhangyue19921010 wants to merge 2 commits into
apache:masterfrom
zhangyue19921010:contrib/restore-cdc-after-table-removal-current-20261123

Conversation

@zhangyue19921010

@zhangyue19921010 zhangyue19921010 commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Purpose

Fixes #11367.

When a Paimon CDC source scans a database or warehouse with table unset, restoring after a source table is dropped fails if the checkpoint still contains pending or assigned splits. Skip coordinator splits for tables excluded during metadata restore, and finish reader splits whose table is unavailable when their schema is loaded so remaining tables can continue.

This change covers discovery across multiple tables. An explicitly selected missing table still follows the existing discovery behavior.

The catalog is consulted only when a split's schema is not cached, so warm splits make no extra lookups. Successful table lookups remain cached. Missing tables are not cached, and other catalog errors still propagate.

Tests

  • Four real-source checkpoint regressions cover pending/assigned splits with one/all source tables removed. They fail on unchanged master and pass with the fix; the surviving table's rows are verified.
  • Table-manager controls cover rediscovery after an unavailable lookup, no catalog lookup for a cached schema, and propagation of catalog errors.
  • Current head: CDCSourceTableManagerTest, CDCSourceSplitReaderTest and CDCSourceRestoreTest (30 tests) pass with Checkstyle and Spotless enabled.

Validated on JDK 11 with Java 8 source target. The new unfinished-split trigger is verified through source APIs and serialized state. The existing Flink integration control drops a table after consuming its rows, then restores and rescales.

@zhangyue19921010

Copy link
Copy Markdown
Contributor Author

CI stopped in JDK setup (tar exit 2). Could you rerun the failed job?

@JingsongLi JingsongLi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This fixes a documented recovery failure for database-wide CDC. I ran 39 tests on Flink 1, including the pending and assigned split regressions and the savepoint/rescale integration test. All passed. A separate reader test found a regression for warehouses with many active tables.

Identifier identifier = nextSplit.getIdentifier();
currentSplitId = nextSplit.splitId();
// Reader state can contain splits for a table removed while the job was stopped.
if (!tableManager.isTableAvailable(identifier)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P2] Keep catalog lookups off the warm split path. This availability check runs for newly assigned splits too. I read Parquet splits from 257 ordinary append tables in round-robin order through a single reader with the default cache sizes. After warm-up, the base reader made zero additional Catalog.getTable calls and this reader made 257 per round. The 1,024-entry schema and read caches still had every table, but the 256-entry table cache missed on every split. With a REST catalog and catalog.properties.cache-enabled=false, that means a synchronous GetTable request per split on the fetch thread. Please limit the check to restored splits, or detect missing tables when loading an uncached schema or reader.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 5a573a9: the availability check now happens only when the split schema is not cached (getTableSchemaIfAvailable), so warm splits make no extra Catalog.getTable calls while restored splits, which start with empty caches, still skip dropped tables (covered by a new counting-catalog test).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Paimon CDC cannot restore unfinished splits after a source table is dropped

2 participants