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

ASF GitHub Bot commented on YARN-11467:
---------------------------------------

slfan1989 commented on code in PR #5565:
URL: https://github.com/apache/hadoop/pull/5565#discussion_r1178658969


##########
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/test/java/org/apache/hadoop/yarn/server/resourcemanager/TestRMHA.java:
##########
@@ -742,6 +746,102 @@ public void 
testResourceProfilesManagerAfterRMWentStandbyThenBackToActive()
         rm.getRMContext().getResourceProfilesManager());
   }
 
+  @Test
+  public void testTransitionedToActiveWithExcludeFileNotExist() throws 
Exception {
+    final String errUnforcedRequest = "User request succeeded even when " +
+        "automatic failover is enabled";
+
+    Configuration conf = new YarnConfiguration(configuration);
+    String nodeExcludeFilePath = "/tmp/non-existent-path-" + UUID.randomUUID();
+    conf.set(YarnConfiguration.RM_NODES_EXCLUDE_FILE_PATH, 
nodeExcludeFilePath);
+
+    DataOutputStream output = null;
+    final File confFile =
+        new 
File("target/test-classes/"+YarnConfiguration.YARN_SITE_CONFIGURATION_FILE);
+    final File backupConfFile = new File(
+        "target/test-classes/" + YarnConfiguration.YARN_SITE_CONFIGURATION_FILE
+            + ".backup." + UUID.randomUUID());
+    boolean hasRenamed = false;
+    try {
+      if (confFile.exists()) {
+        hasRenamed = confFile.renameTo(backupConfFile);
+        if (!hasRenamed) {
+          Assert.fail("Can not rename " + confFile.getAbsolutePath() + " to "
+              + backupConfFile.getAbsolutePath());
+        }
+      }
+      if (!confFile.createNewFile()) {
+        Assert.fail(
+            "Can not create " + 
YarnConfiguration.YARN_SITE_CONFIGURATION_FILE);
+      }
+      output = new DataOutputStream(Files.newOutputStream(confFile.toPath()));
+      conf.writeXml(output);
+    } finally {
+      if (output != null) {
+        output.close();
+      }
+    }
+
+    try {
+      rm = new MockRM(conf);

Review Comment:
   Shouldn't `rm` be closed after the test?





> RM failover may fail when the nodes.exclude-path file does not exist
> --------------------------------------------------------------------
>
>                 Key: YARN-11467
>                 URL: https://issues.apache.org/jira/browse/YARN-11467
>             Project: Hadoop YARN
>          Issue Type: Bug
>            Reporter: dzcxzl
>            Priority: Minor
>              Labels: pull-request-available
>
> {code:java}
> Caused by: org.apache.hadoop.ha.ServiceFailedException: RefreshAll operation 
> failed
>     at 
> org.apache.hadoop.yarn.server.resourcemanager.AdminService.refreshAll(AdminService.java:788)
>     at 
> org.apache.hadoop.yarn.server.resourcemanager.AdminService.transitionToActive(AdminService.java:315)
>     ... 29 more
> Caused by: java.nio.file.NoSuchFileException: 
> /tmp/non-existent-path-788aa744-1395-40ca-bdb5-f93bffc92cfb
>     at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
>     at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
>     at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
>     at 
> sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:214)
>     at java.nio.file.Files.newByteChannel(Files.java:361)
>     at java.nio.file.Files.newByteChannel(Files.java:407)
>     at 
> java.nio.file.spi.FileSystemProvider.newInputStream(FileSystemProvider.java:384)
>     at java.nio.file.Files.newInputStream(Files.java:152)
>     at 
> org.apache.hadoop.util.HostsFileReader.readFileToMap(HostsFileReader.java:126)
>     at 
> org.apache.hadoop.util.HostsFileReader.refreshInternal(HostsFileReader.java:214)
>     at 
> org.apache.hadoop.util.HostsFileReader.refresh(HostsFileReader.java:192)
>     at 
> org.apache.hadoop.yarn.server.resourcemanager.NodesListManager.refreshHostsReader(NodesListManager.java:258)
>     at 
> org.apache.hadoop.yarn.server.resourcemanager.NodesListManager.refreshNodes(NodesListManager.java:232)
>     at 
> org.apache.hadoop.yarn.server.resourcemanager.NodesListManager.refreshNodes(NodesListManager.java:224)
>     at 
> org.apache.hadoop.yarn.server.resourcemanager.AdminService.refreshNodes(AdminService.java:490)
>     at 
> org.apache.hadoop.yarn.server.resourcemanager.AdminService.refreshAll(AdminService.java:778)
>  {code}



--
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