enhance: Add repair zero-partition-l0 command#462
enhance: Add repair zero-partition-l0 command#462congqixia wants to merge 2 commits intomilvus-io:mainfrom
repair zero-partition-l0 command#462Conversation
Add command setting unexpect partition_id=0 l0 segment Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: congqixia The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Summary of ChangesHello @congqixia, 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 introduces a new administrative command within the 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. 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 a new repair command repair zero-partition-l0 to fix L0 segments with a partition ID of 0. While the intent is valuable, the current implementation has several significant issues. Most critically, the update logic is flawed and could lead to metadata corruption in etcd. There are also problems with error handling, missing input validation, and some typos. I've provided detailed comments and suggestions to address these points.
| for _, info := range segments { | ||
| info.PartitionID = p.TargetPartitionID | ||
| err := common.UpdateSegment(ctx, c.client, info) | ||
| if err != nil { | ||
| fmt.Printf("update segment %d partitionID failed: %s\n", info.GetID(), err.Error()) | ||
| continue | ||
| } | ||
| fmt.Printf("update segment %d partitionID to %d succeed\n", info.GetID(), p.TargetPartitionID) | ||
| } |
There was a problem hiding this comment.
The current repair logic is critically flawed and will likely lead to metadata corruption. The etcd key for a segment and its associated metadata (binlogs, deltalogs, statslogs) is dependent on the partitionID. This implementation changes the partitionID within the SegmentInfo protobuf message but then writes it back to the old etcd key (which is based on partitionID=0). This creates a severe inconsistency between the key and the data.
A correct implementation must perform a "move" operation in etcd:
- Read all metadata for the segment from keys with
partitionID=0. - Delete all of this old metadata.
- Update the
partitionIDin theSegmentInfoand any other affected data structures. - Write the updated metadata to new etcd keys corresponding to the new
partitionID.
Without this, the system's metadata will be in a corrupt state.
Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
Add command setting unexpect partition_id=0 l0 segment