Skip to content

Conversation

@Ryan19929
Copy link
Contributor

@Ryan19929 Ryan19929 commented Dec 15, 2025

问题#654

当上游表被DROP后重建(表名相同但table_id不同)时,table级别的CCR同步任务还是按照旧table id请求binlog,直到binlog过期。

解决方案

自动检测并恢复:通过 table_id 变化识别表重建,自动触发全量同步。

核心逻辑:

  1. 遇到 BINLOG_NOT_FOUND_TABLE 时,检查上游表是否存在及 table_id 是否变化
  2. 表不存在 → 等待重建
  3. 表重建(table_id 变化)→ 自动触发全量同步
  4. 表存在但 table_id 未变 → binlog 未就绪(回收或其他情况,但表还是存在),等待重试

主要改动

  1. job_progress.go: 新增 TableDroppedFlag 和 TableDroppedTime 状态字段
  2. job.go: 新增 checkTableExistsForTableSync() 和 handleTableNotFoundForTableSync() 检测逻辑
  3. job_pipeline.go: pipeline 模式支持表重建检测

Feature Flag

-feature_resync_on_table_recreate=false # 默认关闭

涉及doris

apache/doris#59044

@Ryan19929 Ryan19929 marked this pull request as draft December 16, 2025 06:16
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.

1 participant