active-active: add failpoint to construct data loss, data redundant and lww violation scenarios#4215
Conversation
Signed-off-by: Jianjun Liao <jianjun.liao@outlook.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary of ChangesHello @Leavrth, 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 enhances the testing capabilities for active-active replication scenarios by introducing several failpoints. These failpoints allow developers to deliberately inject data loss, data redundancy/mutation, and Last-Write-Wins (LWW) violations into the replication process. This is crucial for validating the robustness and consistency checking mechanisms of the system under various failure conditions, ensuring that the active-active setup behaves as expected when inconsistencies arise. Highlights
🧠 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. Changelog
Activity
Using Gemini Code AssistThe 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
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 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
|
|
|
There was a problem hiding this comment.
Code Review
This pull request introduces several failpoints to simulate different failure scenarios in active-active replication, such as data loss, data redundancy, and LWW violations. The changes in pkg/sink/mysql/mysql_writer_dml.go correctly add a failpoint to bypass LWW logic. However, there's an issue in downstreamadapter/sink/cloudstorage/writer.go where the failpoint for dropping messages doesn't work as intended due to incorrect usage of failpoint.Continue(). I've left a specific comment with a suggestion for a fix.
| failpoint.Inject("cloudStorageSinkDropMessage", func() { | ||
| log.Warn("cloudStorageSinkDropMessage: dropping message to simulate data loss", | ||
| zap.Int("workerID", d.id), | ||
| zap.String("keyspace", d.changeFeedID.Keyspace()), | ||
| zap.Stringer("changefeed", d.changeFeedID.ID()), | ||
| zap.String("dataFilePath", dataFilePath)) | ||
| callbacks = append(callbacks, msg.Callback) | ||
| failpoint.Continue() | ||
| }) |
There was a problem hiding this comment.
failpoint.Continue() does not skip the current loop iteration as a continue statement would. Instead, it jumps to the statement immediately following the failpoint.Inject block. This means the message processing logic below will still execute, causing the message not to be dropped and its callback to be appended twice.
To correctly skip processing the current message, you should use failpoint.Goto("continueLoop") and add a continueLoop: label at the end of the for loop body.
Signed-off-by: Jianjun Liao <jianjun.liao@outlook.com>
What problem does this PR solve?
Issue Number: close #xxx
What is changed and how it works?
Check List
Tests
Questions
Will it cause performance regression or break compatibility?
Do you need to update user documentation, design documentation or monitoring documentation?
Release note