Skip to content

Conversation

@wk989898
Copy link
Collaborator

@wk989898 wk989898 commented Dec 4, 2025

What problem does this PR solve?

Issue Number: close #12436

What is changed and how it works?

In the previous implementation, the error of writer.Close was not handled, and some DMLs may upload failed.
This error should block the advance and cause the changefeed to finally restart.

Check List

Tests

  • Unit test
  • Integration test

Questions

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

Release note

Fix a bug that may cause DML loss while failing to close the writer of the storage sink

@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-triage-completed release-note Denotes a PR that will be considered when it comes time to generate release notes. labels Dec 4, 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 resolves a significant data integrity issue within the TiCDC cloud storage sink. Previously, failures encountered while closing a data writer were not propagated, potentially leading to silent data loss for DML operations. The change ensures that any error during the writer's closure is immediately caught and returned, thereby preventing data loss by halting the process and triggering a necessary changefeed restart to maintain consistency.

Highlights

  • Data Loss Prevention: Addressed a critical bug where DML operations could be lost if the writer.Close operation failed within the cloud storage sink, as the error was not properly handled.
  • Error Handling Improvement: Modified the writeDataFile function to explicitly handle errors from writer.Close. If closing the writer fails, an error is now immediately returned, which will block further advance and cause the changefeed to restart, preventing data inconsistency.
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/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Dec 4, 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

The pull request effectively addresses the bug where writer.Close errors were not properly handled, potentially leading to data loss. By moving the writer.Close call out of the defer block and checking its return value immediately, the system now correctly propagates errors that occur during the writer's closing phase. This ensures that if a write operation succeeds but the subsequent close operation fails, the error is caught and handled, preventing silent data loss and allowing the changefeed to restart as intended. This is a critical fix for data integrity.

@wk989898
Copy link
Collaborator Author

wk989898 commented Dec 4, 2025

/retest

@wk989898
Copy link
Collaborator Author

wk989898 commented Dec 4, 2025

/check-issue-triage-complete

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Dec 5, 2025
@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Dec 5, 2025
@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Dec 5, 2025

[LGTM Timeline notifier]

Timeline:

  • 2025-12-05 00:18:08.558911129 +0000 UTC m=+568233.372688701: ☑️ agreed by asddongmen.
  • 2025-12-05 06:16:43.986505998 +0000 UTC m=+589748.800283560: ☑️ agreed by 3AceShowHand.

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Dec 5, 2025

@flowbehappy: adding LGTM is restricted to approvers and reviewers in OWNERS files.

Details

In response to this:

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.

@ti-chi-bot
Copy link
Contributor

ti-chi-bot bot commented Dec 5, 2025

[APPROVALNOTIFIER] This PR is APPROVED

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

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,asddongmen]

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

@wk989898
Copy link
Collaborator Author

wk989898 commented Dec 5, 2025

/retest

@ti-chi-bot ti-chi-bot bot merged commit 1ea739d into pingcap:master Dec 5, 2025
24 checks passed
@wk989898 wk989898 added needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. labels Dec 5, 2025
@wk989898 wk989898 deleted the patch-29 branch December 5, 2025 13:45
ti-chi-bot pushed a commit to ti-chi-bot/tiflow that referenced this pull request Dec 5, 2025
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.5: #12439.
But this PR has conflicts, please resolve them!

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-7.1: #12440.
But this PR has conflicts, please resolve them!

ti-chi-bot pushed a commit to ti-chi-bot/tiflow that referenced this pull request Dec 5, 2025
@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-6.5: #12441.
But this PR has conflicts, please resolve them!

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-8.5: #12442.

@ti-chi-bot
Copy link
Member

In response to a cherrypick label: new pull request created to branch release-8.1: #12443.

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

Labels

approved lgtm needs-cherry-pick-release-6.5 Should cherry pick this PR to release-6.5 branch. needs-cherry-pick-release-7.1 Should cherry pick this PR to release-7.1 branch. needs-cherry-pick-release-7.5 Should cherry pick this PR to release-7.5 branch. needs-cherry-pick-release-8.1 Should cherry pick this PR to release-8.1 branch. needs-cherry-pick-release-8.5 Should cherry pick this PR to release-8.5 branch. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DML may be lost when using storage sink

5 participants