Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复 #23 问题 #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

修复 #23 问题 #24

wants to merge 1 commit into from

Conversation

AprilYoLies
Copy link

当客户端向集群发起写入请求时,会根据 brpc 的负载均衡策略选取一个节点进行写入,如果被选中的节点不是 Leader 节点,而是从节点,就会报 com.baidu.brpc.exceptions.RpcException: serviceInterface must not be set repeatedly, please use another RpcClient 异常,原因是此时从节点需要向 Leader 发起操作,但是拿到的 rpcClient 已经绑定其它服务接口。

@@ -29,6 +29,12 @@ public Peer(RaftProto.Server server) {
isCatchUp = false;
}

public RpcClient createClient() {
return new RpcClient(new Endpoint(
Copy link
Owner

Choose a reason for hiding this comment

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

这个client感觉应该保存在Peer里,两个client名称上区分下,分别是用于raft内部通信client、提供给application去写入的client。

@liuzihua699 liuzihua699 mentioned this pull request Mar 18, 2021
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.

None yet

2 participants