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 03:31:35 UTC

[hbase] branch branch-2.3 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-2.3
in repository https://gitbox.apache.org/repos/asf/hbase.git


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

commit c05241d69d17b8743e0efbfbacb3fc7258e8d715
Author: Narges Shadab <54...@users.noreply.github.com>
AuthorDate: Thu Mar 4 19:26:12 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 a9bb685..4b58b5d 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
@@ -221,11 +221,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;
   }