You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by ka...@apache.org on 2017/05/24 10:42:46 UTC

[15/50] [abbrv] kylin git commit: KYLIN-2624 fix IT with refactored DistributedLock

KYLIN-2624 fix IT with refactored DistributedLock


Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/be32f758
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/be32f758
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/be32f758

Branch: refs/heads/KYLIN-2606
Commit: be32f75883c21bf32545d1b06158ad7cf36d676b
Parents: f36372b
Author: Yang Li <li...@apache.org>
Authored: Fri May 19 22:02:38 2017 +0800
Committer: Yang Li <li...@apache.org>
Committed: Fri May 19 22:02:38 2017 +0800

----------------------------------------------------------------------
 .../job/impl/threadpool/DistributedScheduler.java   |  1 +
 .../hbase/util/ZookeeperDistributedLock.java        | 16 ++++++++++++----
 2 files changed, 13 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kylin/blob/be32f758/core-job/src/main/java/org/apache/kylin/job/impl/threadpool/DistributedScheduler.java
----------------------------------------------------------------------
diff --git a/core-job/src/main/java/org/apache/kylin/job/impl/threadpool/DistributedScheduler.java b/core-job/src/main/java/org/apache/kylin/job/impl/threadpool/DistributedScheduler.java
index d01cb5a..8812dad 100644
--- a/core-job/src/main/java/org/apache/kylin/job/impl/threadpool/DistributedScheduler.java
+++ b/core-job/src/main/java/org/apache/kylin/job/impl/threadpool/DistributedScheduler.java
@@ -319,6 +319,7 @@ public class DistributedScheduler implements Scheduler<AbstractExecutable>, Conn
         }
         return path;
     }
+    
     @Override
     public void shutdown() throws SchedulerException {
         logger.info("Will shut down Job Engine ....");

http://git-wip-us.apache.org/repos/asf/kylin/blob/be32f758/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/util/ZookeeperDistributedLock.java
----------------------------------------------------------------------
diff --git a/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/util/ZookeeperDistributedLock.java b/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/util/ZookeeperDistributedLock.java
index d181d81..dc2a23e 100644
--- a/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/util/ZookeeperDistributedLock.java
+++ b/storage-hbase/src/main/java/org/apache/kylin/storage/hbase/util/ZookeeperDistributedLock.java
@@ -281,10 +281,18 @@ public class ZookeeperDistributedLock implements DistributedLock, JobLock {
     
     // normalize lock path
     private String norm(String lockPath) {
-        if (lockPath.startsWith(zkPathBase))
-            return lockPath;
-        else
-            return zkPathBase + (lockPath.startsWith("/") ? "" : "/") + lockPath;
+        if (!lockPath.startsWith(zkPathBase))
+            lockPath = zkPathBase + (lockPath.startsWith("/") ? "" : "/") + lockPath;
+        
+        return dropDoubleSlash(lockPath);
+    }
+
+    public static String dropDoubleSlash(String path) {
+        for (int n = Integer.MAX_VALUE; n > path.length();) {
+            n = path.length();
+            path = path.replace("//", "/");
+        }
+        return path;
     }
 
     // ============================================================================