[ 
https://issues.apache.org/jira/browse/HDFS-16499?focusedWorklogId=739541&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-739541
 ]

ASF GitHub Bot logged work on HDFS-16499:
-----------------------------------------

                Author: ASF GitHub Bot
            Created on: 10/Mar/22 15:29
            Start Date: 10/Mar/22 15:29
    Worklog Time Spent: 10m 
      Work Description: umamaheswararao commented on a change in pull request 
#4058:
URL: https://github.com/apache/hadoop/pull/4058#discussion_r823332317



##########
File path: 
hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/sps/ExternalStoragePolicySatisfier.java
##########
@@ -96,20 +96,28 @@ private static void secureLogin(Configuration conf)
         socAddr.getHostName());
   }
 
-  private static NameNodeConnector getNameNodeConnector(Configuration conf)
-      throws IOException, InterruptedException {
+  public static NameNodeConnector getNameNodeConnector(Configuration conf, 
boolean forTest)
+      throws InterruptedException {
     final Collection<URI> namenodes = DFSUtil.getInternalNsRpcUris(conf);
     final Path externalSPSPathId = HdfsServerConstants.MOVER_ID_PATH;
+    String serverName = ExternalStoragePolicySatisfier.class.getSimpleName();
     while (true) {
       try {
         final List<NameNodeConnector> nncs = NameNodeConnector
             .newNameNodeConnectors(namenodes,
-                ExternalStoragePolicySatisfier.class.getSimpleName(),
+                serverName,
                 externalSPSPathId, conf,
                 NameNodeConnector.DEFAULT_MAX_IDLE_ITERATIONS);
         return nncs.get(0);
       } catch (IOException e) {
         LOG.warn("Failed to connect with namenode", e);
+        if (e.getMessage().equals("Another " + serverName + " is running.")) {

Review comment:
       It's quite some time I looked at this code. Thanks a lot for working on 
these improvements.
   How about using ExitUtil class to terminate. That class has static methods 
to disable exit. That you can use it from tests.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: common-issues-unsubscr...@hadoop.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 739541)
    Time Spent: 0.5h  (was: 20m)

> [SPS]: Should not start indefinitely while another SPS process is running
> -------------------------------------------------------------------------
>
>                 Key: HDFS-16499
>                 URL: https://issues.apache.org/jira/browse/HDFS-16499
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>            Reporter: tomscut
>            Assignee: tomscut
>            Priority: Major
>              Labels: pull-request-available
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> Normally, we can only start one SPS process at a time. When one process is 
> running, start another process and retry indefinitely. I think, in this case, 
> we should exit immediately.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to