You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by ni...@apache.org on 2019/12/17 13:18:08 UTC

[kylin] branch master updated: KYLIN-4303 Fix the bug that HBaseAdmin is not closed properly

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

nic pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kylin.git


The following commit(s) were added to refs/heads/master by this push:
     new 526769a  KYLIN-4303 Fix the bug that HBaseAdmin is not closed properly
526769a is described below

commit 526769a8a18d158bd5215d5755cd9319d0d98e31
Author: weibin0516 <co...@126.com>
AuthorDate: Tue Dec 17 16:44:35 2019 +0800

    KYLIN-4303 Fix the bug that HBaseAdmin is not closed properly
---
 .../apache/kylin/rest/job/KylinHealthCheckJob.java | 27 ++++++++++++++--------
 1 file changed, 17 insertions(+), 10 deletions(-)

diff --git a/server-base/src/main/java/org/apache/kylin/rest/job/KylinHealthCheckJob.java b/server-base/src/main/java/org/apache/kylin/rest/job/KylinHealthCheckJob.java
index 0e25117..6f8b53f 100644
--- a/server-base/src/main/java/org/apache/kylin/rest/job/KylinHealthCheckJob.java
+++ b/server-base/src/main/java/org/apache/kylin/rest/job/KylinHealthCheckJob.java
@@ -199,20 +199,27 @@ public class KylinHealthCheckJob extends AbstractApplication {
     private void checkHBaseTables(List<CubeInstance> cubes) throws IOException {
         reporter.log("## Checking HBase Table of segments");
         HBaseAdmin hbaseAdmin = new HBaseAdmin(HBaseConfiguration.create());
-        for (CubeInstance cube : cubes) {
-            for (CubeSegment segment : cube.getSegments()) {
-                if (segment.getStatus() != SegmentStatusEnum.NEW) {
-                    String tableName = segment.getStorageLocationIdentifier();
-                    if ((!hbaseAdmin.tableExists(tableName)) || (!hbaseAdmin.isTableEnabled(tableName))) {
-                        reporter.log("HBase table: {} not exist for segment: {}, project: {}", tableName, segment,
-                                cube.getProject());
-                        reporter.log(
-                                "The rebuild url: -d '{\"startTime\":'{}', \"endTime\":'{}', \"buildType\":\"REFRESH\"}' /kylin/api/cubes/{}/build",
-                                segment.getTSRange().start, segment.getTSRange().end, cube.getName());
+        try {
+            for (CubeInstance cube : cubes) {
+                for (CubeSegment segment : cube.getSegments()) {
+                    if (segment.getStatus() != SegmentStatusEnum.NEW) {
+                        String tableName = segment.getStorageLocationIdentifier();
+                        if ((!hbaseAdmin.tableExists(tableName)) || (!hbaseAdmin.isTableEnabled(tableName))) {
+                            reporter.log("HBase table: {} not exist for segment: {}, project: {}", tableName, segment,
+                                    cube.getProject());
+                            reporter.log(
+                                    "The rebuild url: -d '{\"startTime\":'{}', \"endTime\":'{}', \"buildType\":\"REFRESH\"}' /kylin/api/cubes/{}/build",
+                                    segment.getTSRange().start, segment.getTSRange().end, cube.getName());
+                        }
                     }
                 }
             }
+        } finally {
+            if (null != hbaseAdmin) {
+                hbaseAdmin.close();
+            }
         }
+
     }
 
     private void checkCubeHoles(List<CubeInstance> cubes) {