Skip to content

fix MetaClient bug - #144

Open
zhixiongning wants to merge 7 commits into
vesoft-inc:masterfrom
zhixiongning:master
Open

fix MetaClient bug#144
zhixiongning wants to merge 7 commits into
vesoft-inc:masterfrom
zhixiongning:master

Conversation

@zhixiongning

@zhixiongning zhixiongning commented Mar 9, 2026

Copy link
Copy Markdown

What type of PR is this?

  • bug
  • feature
  • enhancement

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:

@CLAassistant

CLAassistant commented Mar 9, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 getResponse with retry parameters and add updateLeader() 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.

Comment thread src/mclient/MetaClient.cpp Outdated
Comment thread src/mclient/MetaClient.cpp Outdated
Comment thread include/nebula/mclient/MetaClient.h Outdated
yuhongwei380
yuhongwei380 previously approved these changes Sep 4, 2026
@yuhongwei380
yuhongwei380 requested review from yuhongwei380 and removed request for yuhongwei380 September 4, 2026 03:07
yuhongwei380
yuhongwei380 previously approved these changes Sep 7, 2026
@xiajingchun

Copy link
Copy Markdown
Contributor

@zhixiongning please check the CI failures and make sure the code changes can compile successfully.

@yuhongwei380
yuhongwei380 self-requested a review September 7, 2026 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants