You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by an...@apache.org on 2021/03/05 09:45:18 UTC

[hbase] branch branch-1 updated: HBASE-25626 Possible Resource Leak in HeterogeneousRegionCountCostFunction

This is an automated email from the ASF dual-hosted git repository.

anoopsamjohn pushed a commit to branch branch-1
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/branch-1 by this push:
     new 4546163  HBASE-25626 Possible Resource Leak in HeterogeneousRegionCountCostFunction
4546163 is described below

commit 4546163d9038201f157283cd687d0a16a3d78b57
Author: Narges Shadab <54...@users.noreply.github.com>
AuthorDate: Fri Mar 5 01:44:49 2021 -0800

    HBASE-25626 Possible Resource Leak in HeterogeneousRegionCountCostFunction
    
    Signed-off-by Anoop Sam John <an...@apache.org>
    Signed-off-by shahrs87 <sh...@gmail.com>
---
 .../master/balancer/HeterogeneousRegionCountCostFunction.java | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/HeterogeneousRegionCountCostFunction.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/HeterogeneousRegionCountCostFunction.java
index 1a62655..dd227e4 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/HeterogeneousRegionCountCostFunction.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/balancer/HeterogeneousRegionCountCostFunction.java
@@ -224,11 +224,14 @@ public class HeterogeneousRegionCountCostFunction extends StochasticLoadBalancer
 
   private List<String> readLines(BufferedReader reader) throws IOException {
     final List<String> records = new ArrayList<>();
-    String line;
-    while ((line = reader.readLine()) != null) {
-      records.add(line);
+    try {
+      String line;
+      while ((line = reader.readLine()) != null) {
+        records.add(line);
+      }
+    } finally {
+      reader.close();
     }
-    reader.close();
     return records;
   }