[ 
https://issues.apache.org/jira/browse/HDDS-11839?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17923658#comment-17923658
 ] 

Sadanand Shenoy commented on HDDS-11839:
----------------------------------------

{code:java}
private void getRaftPeerId(String newLeaderId, SCMRatisServer scmRatisServer) {
String raftPeerID = "";
String serviceID = config.get(ScmConfigKeys.OZONE_SCM_SERVICE_IDS_KEY);
String scmHostName = config.get(ConfUtils.addKeySuffixes(OZONE_SCM_ADDRESS_KEY, 
serviceID ,
newLeaderId));

Optional<RaftPeer> raftPeer = 
scmRatisServer.getDivision().getGroup().getPeers().stream().filter(peer -> 
peer.getAddress().equals(scmHostName))
.findFirst();
if (raftPeer.isPresent()){
raftPeerID = raftPeer.get().getId().toString();
}
}{code}

SCM uses scmUuid as its raftPeerId, In order to find the mapping, we need to 
search the configs for the hostname/address and match it with the 
hostnames/address of the peers in the raftGroup . Something like above. This 
would work when the cluster has correct configurations for these properties. I 
think the method can be used in SCMClientProtocolServer.java

> Mismatch in leadership transfer node ID
> ---------------------------------------
>
>                 Key: HDDS-11839
>                 URL: https://issues.apache.org/jira/browse/HDDS-11839
>             Project: Apache Ozone
>          Issue Type: Bug
>          Components: Ozone CLI
>            Reporter: Pyttel
>            Assignee: Peter Lee
>            Priority: Major
>              Labels: newbie
>
> Leadership transfer expects leader to be identified by UUID for SCM, but node 
> ID for OM:
> {code}
> $ ozone admin scm transfer --new-leader-id scm1
> Target scm1 not found in group [891cd056-3cf1-4e52-9cac-eff0af7bfefe, 
> b25f513f-ddf7-4382-a3f0-fe5b209a7a26, ac63c8ae-1f4c-4fa7-9eed-e279d0b573ff].
> $ ozone admin om transfer --new-leader-id om1
> Transfer leadership successfully to om1.
> {code}
> Ideally it should accept both kinds of ID.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to