fix MetaClient bug - #144
Conversation
There was a problem hiding this comment.
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
Pull request overview
Fixes intermittent meta RPC failures in multi-metad deployments by tracking and retrying against the current meta leader instead of always using the last configured address.
Changes:
- Introduce
leader_tracking with a mutex to select the meta host for requests. - Retry meta requests on leader-related errors and on transport exceptions, updating the cached leader.
- Extend
getResponsewith retry parameters and addupdateLeader()helper.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/mclient/MetaClient.cpp | Selects cached leader for RPCs, retries on leader change/exception, and updates leader cache. |
| include/nebula/mclient/MetaClient.h | Adds mutex + leader state, extends getResponse signature, and declares updateLeader(). |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
@zhixiongning please check the CI failures and make sure the code changes can compile successfully. |
What type of PR is this?
What problem(s) does this PR solve?
Issue(s) number: 140
Description:
When I use nebula-cpp to scan data, it will be failed sometimes. Three metad servers are deployed in the environment.
I noticed that metad client use metaAddrs_.back() to connect to the server. However, metaAddrs_.back() is not necessarily the leader and errors will occurred sometimes.
How do you solve it?
When the selected metad is not the leader, the leader information will be obtained from the response message and the request will be retried. Meanwhile, the local leader will be updated for the next request.
Special notes for your reviewer, ex. impact of this fix, design document, etc: