ZhaoBQ commented on a change in pull request #1901:
URL: https://github.com/apache/hbase/pull/1901#discussion_r448078744



##########
File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/util/RegionMover.java
##########
@@ -653,41 +673,52 @@ private void deleteFile(String filename) {
   }
 
   /**
-   * @return List of servers from the exclude file in format 'hostname:port'.
+   * @param filename The file should have 'host:port' per line
+   * @return List of servers from the file in format 'hostname:port'.
    */
-  private List<String> readExcludes(String excludeFile) throws IOException {
-    List<String> excludeServers = new ArrayList<>();
-    if (excludeFile == null) {
-      return excludeServers;
-    } else {
+  private List<String> readServersFromFile(String filename) throws IOException 
{
+    List<String> servers = new ArrayList<>();
+    if (filename != null) {
       try {
-        Files.readAllLines(Paths.get(excludeFile)).stream().map(String::trim)
-            .filter(((Predicate<String>) 
String::isEmpty).negate()).map(String::toLowerCase)
-            .forEach(excludeServers::add);
+        Files.readAllLines(Paths.get(filename)).stream().map(String::trim)
+          .filter(((Predicate<String>) 
String::isEmpty).negate()).map(String::toLowerCase)
+          .forEach(servers::add);
       } catch (IOException e) {
-        LOG.warn("Exception while reading excludes file, continuing anyways", 
e);
+        LOG.error("Exception while reading servers from file,", e);
+        throw e;
       }
-      return excludeServers;
     }
+    return servers;
   }
 
   /**
-   * Excludes the servername whose hostname and port portion matches the list 
given in exclude file
+   * Designates or excludes the servername whose hostname and port portion 
matches the list given
+   * in the file.
+   * Example:<br>
+   * If you want to designated RSs, suppose designatedFile has RS1, 
regionServers has RS1, RS2 and
+   * RS3. When call includeExcludeRegionServers(designatedFile, regionServers, 
true), regionServers
+   * left RS1.
+   * If you want to exclude RSs, suppose excludeFile has RS1, regionServers 
has RS1, RS2 and RS3.
+   * When call includeExcludeRegionServers(excludeFile, servers, false), 
regionServers left RS2 and
+   * RS3.

Review comment:
       done. Thank you @virajjasani 




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to