docs: add design doc for etcd watch and session lifecycle fixes#6
docs: add design doc for etcd watch and session lifecycle fixes#6xiaofan-luan wants to merge 1 commit intomainfrom
Conversation
This document describes fixes for several reliability issues in session_util.go: - Handle error return from checkIDExist() and panic on failure - Add context cancellation check in getServerIDWithKey() loop - Add keepalive timeout protection - Use watcher's own context for etcd Watch calls - Handle nil PrevKv on DELETE events - Fix ProcessActiveStandBy to handle ErrCompacted by rewatching Related to: milvus-io/milvus#7989 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: xiaofan-luan 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 @xiaofan-luan, 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 comprehensive design document detailing critical reliability improvements for the etcd session utility module. The document outlines solutions to address various edge cases, including silent failures, infinite loops, zombie sessions, resource leaks, and watch failures, ensuring a more robust and stable distributed system by proactively handling common etcd-related issues. 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 is a well-written and comprehensive design document. It clearly outlines the reliability issues found in session_util.go and details the fixes for each one. The motivation is clear, the design details are well-explained with illustrative code snippets, and the test plan is thorough. The document effectively communicates the scope and impact of the changes. I have one minor suggestion to improve the clarity of a code snippet.
| ```go | ||
| keepaliveTimeout := time.Duration(s.sessionTTL) * time.Second | ||
| timer := time.NewTimer(keepaliveTimeout) | ||
| for { |
There was a problem hiding this comment.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cc1bd55593
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| case _, ok := <-ch: | ||
| if !ok { | ||
| break keepaliveLoop | ||
| } | ||
| timer.Reset(keepaliveTimeout) |
There was a problem hiding this comment.
Drain/stop timer before Reset to avoid spurious timeout
If a keepalive response arrives after the timer has already fired but before timer.C is selected, the select can take the keepalive branch and call timer.Reset without stopping/draining the timer. In Go, resetting an expired timer without first stopping and draining its channel can leave timer.C readable, causing the next iteration to hit the timeout case immediately and exit even though a keepalive just arrived. This would make the session incorrectly expire under tight timing races; the design should mention stopping/draining before reset or using a time.AfterFunc/time.NewTicker pattern.
Useful? React with 👍 / 👎.
Summary
This PR adds a design document describing fixes for several reliability issues in
session_util.go:checkIDExist()and panic on failuregetServerIDWithKey()loopProcessActiveStandByto handleErrCompactedby rewatching with latest revisionRelated
🤖 Generated with Claude Code