Skip to content

Conversation

@wk989898
Copy link
Collaborator

@wk989898 wk989898 commented Dec 18, 2025

What problem does this PR solve?

Issue Number: close #3726 close #3689

What is changed and how it works?

Before this PR, table trigger redo dispatcher and table trigger event dispatcher used the same start-ts to init schemastore. But actually, the event dispatcher will get true start-ts by querying the downstream, and the event dispatcher start-ts may be greater than the redo dispatcher start-ts. If the redo dispatcher uses this start-ts, it may meet "no version found" error. because some tables are dropped or truncated. That makes some redo dispatchers blocked and checkpointTs lag increases.

In this PR, table trigger redo dispatcher start-ts is split from the event dispatcher start-ts. It's more like two independent responses sent to the maintainer.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Questions

Will it cause performance regression or break compatibility?
Do you need to update user documentation, design documentation or monitoring documentation?

Release note

Please refer to [Release Notes Language Style Guide](https://pingcap.github.io/tidb-dev-guide/contribute-to-tidb/release-notes-style-guide.html) to write a quality release note.

If you don't think this PR needs a release note then fill it with `None`.

@ti-chi-bot
Copy link

ti-chi-bot bot commented Dec 18, 2025

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-linked-issue release-note Denotes a PR that will be considered when it comes time to generate release notes. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Dec 18, 2025
@gemini-code-assist
Copy link

Summary of Changes

Hello @wk989898, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request is currently a work-in-progress, focusing on refining the initialization logic for redo dispatchers by temporarily adjusting the startTs recovery mechanism. Concurrently, the integration test suite has been reconfigured to concentrate on a specific failover scenario, suggesting a targeted debugging or development effort related to redo functionality.

Highlights

  • Redo Dispatcher Initialization: The newRedoDispatchers function has been modified to adjust how startTs is determined for new redo dispatchers, specifically bypassing a recovery information lookup from the MySQL sink.
  • Integration Test Focus: The integration test configuration has been temporarily altered to run only the fail_over_ddl_mix_with_syncpoint test multiple times, likely for focused debugging or validation of specific scenarios.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@ti-chi-bot ti-chi-bot bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Dec 18, 2025
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request appears to be a work-in-progress, with changes primarily focused on testing and debugging. In downstreamadapter/dispatchermanager/dispatcher_manager_redo.go, logic for fetching recovery info for redo dispatchers has been commented out. This is a critical change as the surrounding comments indicate this logic prevents a potential panic. This should be addressed before merging. In tests/integration_tests/run_heavy_it_in_ci.sh, the integration test suite for MySQL has been altered to repeatedly run a single test case. This seems to be for debugging and should be reverted to restore the full test suite. Given the WIP nature of this PR, these changes are likely temporary, but it's important to highlight them to ensure they are not merged into the main branch in their current state.

@wk989898
Copy link
Collaborator Author

/test pull-cdc-mysql-integration-heavy

2 similar comments
@wk989898
Copy link
Collaborator Author

/test pull-cdc-mysql-integration-heavy

@wk989898
Copy link
Collaborator Author

/test pull-cdc-mysql-integration-heavy

@wk989898 wk989898 changed the title [WIP] redo: create redo dispatcher with correct start-ts Dec 19, 2025
@wk989898
Copy link
Collaborator Author

/test pull-cdc-mysql-integration-heavy

@ti-chi-bot ti-chi-bot bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Dec 23, 2025
@ti-chi-bot ti-chi-bot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 24, 2025
@wk989898
Copy link
Collaborator Author

/test all

@wk989898
Copy link
Collaborator Author

/test all

@wk989898
Copy link
Collaborator Author

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the creation of redo dispatchers to ensure they use the correct start-ts. The main change involves removing the logic that aligned the redo dispatcher's start-ts with the MySQL sink's recovery state. This change is propagated throughout the system, with updates to protobuf messages to carry separate redo-related information (RedoCheckpointTs, RedoSchemas), and refactoring in the maintainer and dispatcher orchestrator for cleaner separation of default and redo mode handling. Additionally, several integration tests for consistent replication have been enabled, which is a positive sign of increased confidence in this feature. The changes generally look good and improve code clarity. I have one comment regarding a potentially misleading comment.

Comment on lines 109 to 112
// UpdateMeta used to update redo meta log.
// The checkpoint-ts is always less than the resolved-ts because it represents the minimum checkpoint-ts of the global event dispatcher.
// The event dispatcher does not advance until the resolved-ts exceeds the event's commit-ts.
// only for redo table trigger event dispatcher.

Choose a reason for hiding this comment

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

medium

The comment on lines 110-111 states that checkpoint-ts is always less than resolved-ts. However, with the changes in this PR (specifically the removal of start-ts alignment logic in dispatcher_manager_redo.go), it seems possible for event dispatchers to start at a later timestamp than redo dispatchers, especially with a MySQL sink.

This would mean checkpoint-ts (from event dispatchers) could be greater than resolved-ts (from redo dispatchers), at least initially. This contradicts the comment.

Could you please clarify if this understanding is correct? If so, this comment is misleading and should be updated to reflect the new logic and explain why checkpoint-ts > resolved-ts is now acceptable. For example, is it only an initial state that gets resolved quickly?


// Step 1: Determine start timestamp and update DDL dispatcher
startTs := c.determineStartTs(allNodesResp)
startTs, redoStartTs := c.determineStartTs(allNodesResp)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we need to make a common function for bootstrap for redoMode or normalMode? I see a lot of similar logic here

@wk989898
Copy link
Collaborator Author

/test all

@wk989898
Copy link
Collaborator Author

/test all

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Dec 25, 2025
@wk989898 wk989898 added do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. and removed do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. labels Dec 25, 2025
@3AceShowHand 3AceShowHand self-requested a review December 25, 2025 11:40
// UpdateMeta used to update redo meta log.
// The checkpoint-ts is always less than the resolved-ts because it represents the minimum checkpoint-ts of the global event dispatcher.
// The event dispatcher does not advance until the resolved-ts exceeds the event's commit-ts.
// It is possible that the checkpoint-ts is greater than resolved-ts in the beginning because the event dispatcher query the start-ts from mysql sink.
Copy link
Collaborator

Choose a reason for hiding this comment

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

The explanation of why the checkpoint-ts may greater than the resolved-ts at the beginning is not clear.

Why query the start-ts from the mysql sink may cause the above case.

Copy link
Collaborator Author

@wk989898 wk989898 Dec 26, 2025

Choose a reason for hiding this comment

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

I confirm that the checkpoint-ts is always less than or equal resolved-ts.

@ti-chi-bot ti-chi-bot bot added the lgtm label Dec 26, 2025
@ti-chi-bot
Copy link

ti-chi-bot bot commented Dec 26, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 3AceShowHand, hongyunyan

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [3AceShowHand,hongyunyan]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot removed the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Dec 26, 2025
@ti-chi-bot
Copy link

ti-chi-bot bot commented Dec 26, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-12-25 05:22:58.96014002 +0000 UTC m=+2314523.773917582: ☑️ agreed by hongyunyan.
  • 2025-12-26 07:18:35.704781824 +0000 UTC m=+2407860.518559396: ☑️ agreed by 3AceShowHand.

@ti-chi-bot
Copy link

ti-chi-bot bot commented Dec 26, 2025

@wk989898: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-error-log-review 9225270 link true /test pull-error-log-review

Full PR test history. Your PR dashboard.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

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

Labels

approved lgtm release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

changefeed checkpoint ts stuck with redo enabled wrong startTs for redo dispatcher when maintainer is restart

3 participants