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

Peter Lee commented on HDDS-11839:
----------------------------------

I tried this:
{code:java}
private String getRaftPeerId(String newLeaderId, SCMRatisServer scmRatisServer) 
{
    String raftPeerID = null;
    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();
    } else {
      // log out newleaderId and the address of all the scm nodeIds
      LOG.error("Cannot find the raft peer for the new leader id: {} in scm 
nodeIds: {}", newLeaderId, scmRatisServer
          
.getDivision().getGroup().getPeers().stream().map(RaftPeer::getAddress).collect(Collectors.toList()));
    }
    return raftPeerID;
  }
{code}
and get:

{code:java}
2025-02-04 23:19:05,407 [IPC Server handler 17 on default port 15021] ERROR 
server.SCMClientProtocolServer 
(SCMClientProtocolServer.java:getRaftPeerId(867)) - Cannot find the raft peer 
for the new leader id: scmNode-2 in scm nodeIds: [localhost:15011, 
localhost:15019, localhost:15003]
{code}

in UT used minOzoneCluster.

> 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