From ad6eb5bb03f3dc925cc0441ee06b3ae8ec80ff02 Mon Sep 17 00:00:00 2001 From: Dennis Zhuang Date: Fri, 20 Oct 2023 22:22:37 +0800 Subject: [PATCH] fix: missing peer id when refreshing leader, #1012 --- .../src/main/java/com/alipay/sofa/jraft/RouteTable.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/jraft-core/src/main/java/com/alipay/sofa/jraft/RouteTable.java b/jraft-core/src/main/java/com/alipay/sofa/jraft/RouteTable.java index 99a2e936b..7530fa3a7 100644 --- a/jraft-core/src/main/java/com/alipay/sofa/jraft/RouteTable.java +++ b/jraft-core/src/main/java/com/alipay/sofa/jraft/RouteTable.java @@ -232,11 +232,13 @@ public Status refreshLeader(final CliClientService cliClientService, final Strin "Group %s is not registered in RouteTable, forgot to call updateConfiguration?", groupId); } final Status st = Status.OK(); - final CliRequests.GetLeaderRequest.Builder rb = CliRequests.GetLeaderRequest.newBuilder(); - rb.setGroupId(groupId); - final CliRequests.GetLeaderRequest request = rb.build(); + TimeoutException timeoutException = null; for (final PeerId peer : conf) { + final CliRequests.GetLeaderRequest.Builder rb = CliRequests.GetLeaderRequest.newBuilder(); + rb.setGroupId(groupId); + rb.setPeerId(peer.toString()); + final CliRequests.GetLeaderRequest request = rb.build(); if (!cliClientService.connect(peer.getEndpoint())) { if (st.isOk()) { st.setError(-1, "Fail to init channel to %s", peer);