Skip to content

Conversation

@takaidohigasi
Copy link

@takaidohigasi takaidohigasi commented Jan 8, 2026

What problem does this PR solve?

Issue Number: close #3964

When Debezium encoding fails, the current error log lacks context information, making it difficult to debug which table/column caused the issue.

Related tiflow PR: pingcap/tiflow#12484

What is changed and how it works?

Improve error logging for Debezium encoding failures by adding detailed context information.

When Debezium encoding fails, the error log now includes:

  • schema: database/schema name
  • table: table name
  • column: column name that caused the error
  • value: the actual value (truncated to 1024 bytes if too large)
  • commitTs: the commit timestamp of the event

The commitTs in the log can be used to skip problematic events using checkpoint override.

Before:

[ERROR] ["write Debezium field value meet error"] [error="..."]

After:

[ERROR] ["failed to write Debezium field value"]
  [schema=testdb] [table=users] [column=status]
  [value=...] [commitTs=12345] [error="..."]

Check List

Tests

  • Unit test

Questions

Will it cause performance regression or break compatibility?

No. This only affects error logging path which is not performance critical.

Do you need to update user documentation, design documentation or monitoring documentation?

No.

Release note

Add CDC error log contents when debezium sink was errored

@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-linked-issue do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Jan 8, 2026
@ti-chi-bot
Copy link

ti-chi-bot bot commented Jan 8, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign asddongmen for approval. For more information see the Code Review Process.
Please ensure that each of them provides their approval before proceeding.

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

Details Needs approval from an approver in each of these files:

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 added contribution This PR is from a community contributor. first-time-contributor Indicates that the PR was contributed by an external member and is a first-time contributor. needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. labels Jan 8, 2026
@ti-chi-bot
Copy link

ti-chi-bot bot commented Jan 8, 2026

Hi @takaidohigasi. Thanks for your PR.

I'm waiting for a pingcap member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@ti-chi-bot
Copy link

ti-chi-bot bot commented Jan 8, 2026

Welcome @takaidohigasi!

It looks like this is your first PR to pingcap/ticdc 🎉.

I'm the bot to help you request reviewers, add labels and more, See available commands.

We want to make sure your contribution gets all the attention it needs!



Thank you, and welcome to pingcap/ticdc. 😃

@pingcap-cla-assistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@gemini-code-assist
Copy link

Summary of Changes

Hello @takaidohigasi, 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 significantly enhances the debugging experience for Debezium encoding issues by enriching error logs with crucial contextual details. Previously, error messages were generic, but now they provide specific information about the database, table, column, and value that caused the failure, along with the commit timestamp, making it much easier to pinpoint and resolve problems.

Highlights

  • Enhanced Debezium Error Logging: Improved error messages for Debezium encoding failures by including detailed contextual information such as schema, table, column, truncated value, and commit timestamp.
  • Function Signature Update: The writeDebeziumFieldValues function now accepts an additional commitTs parameter to facilitate more comprehensive error logging.
  • Value Truncation in Logs: Error logs now truncate the problematic value to 1024 bytes to prevent excessively long log entries, ensuring readability and manageability.

🧠 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 size/S Denotes a PR that changes 10-29 lines, ignoring generated files. release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/needs-triage-completed release-note Denotes a PR that will be considered when it comes time to generate release notes. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. release-note-none Denotes a PR that doesn't merit a release note. do-not-merge/needs-linked-issue labels Jan 8, 2026
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 significantly improves error logging for Debezium encoding failures by adding valuable context like schema, table, column, and the problematic value. This will make debugging much easier.

My review includes one main suggestion to make the new logging code more robust. It addresses a potential panic when converting data to a string and improves the readability of logged binary data. Overall, this is a great enhancement.

Add detailed error logging when Debezium field value encoding fails.
The error log now includes:
- Schema name
- Table name
- Column name
- Value (truncated to 1024 chars if too large, hex-encoded for binary types)
- Commit timestamp

This helps diagnose encoding issues like enum columns with invalid
string values (e.g., issue #12474 in tiflow).

Additionally, added panic recovery and hex encoding for binary types
to ensure safe and readable error logging.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@takaidohigasi takaidohigasi force-pushed the improve-debezium-error-logging branch from 5cf8307 to 260de85 Compare January 8, 2026 14:05
@takaidohigasi
Copy link
Author

Thanks for the review! I've addressed both concerns:

  1. Panic recovery: Added defer/recover pattern around datum.String() to handle potential panics from corrupted data
  2. Binary data hex encoding: Added hex encoding for binary column types (BLOB, VARBINARY, etc.) using hex.EncodeToString(datum.GetBytes()) for better readability

The updated code now safely handles both edge cases. See commit 260de85.

@ti-chi-bot ti-chi-bot bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. do-not-merge/needs-triage-completed and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. do-not-merge/needs-linked-issue labels Jan 8, 2026
@wk989898
Copy link
Collaborator

wk989898 commented Jan 8, 2026

/ok-to-test

@ti-chi-bot ti-chi-bot bot added the ok-to-test Indicates a PR is ready to be tested. label Jan 8, 2026
@ti-chi-bot ti-chi-bot bot removed the needs-ok-to-test Indicates a PR created by contributors and need ORG member send '/ok-to-test' to start testing. label Jan 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

contribution This PR is from a community contributor. do-not-merge/needs-triage-completed first-time-contributor Indicates that the PR was contributed by an external member and is a first-time contributor. ok-to-test Indicates a PR is ready to be tested. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve error logging for Debezium encoding failures

2 participants