You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by sh...@apache.org on 2018/12/22 14:04:35 UTC
[kylin] branch master updated (91efa0c -> b31385f)
This is an automated email from the ASF dual-hosted git repository.
shaofengshi pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/kylin.git.
from 91efa0c KYLIN-3365 Add unit test for the coprocessor code, CubeVisitService
new 6f760ef Minor, delete file before create it
new b31385f KYLIN-3734 Fix UT error: invalid path of global job lock
The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
Summary of changes:
.../kylin/common/metrics/metrics2/JsonFileMetricsReporter.java | 3 ++-
examples/test_case_data/localmeta/kylin.properties | 1 +
pom.xml | 8 +++++++-
server/pom.xml | 5 +++++
.../java/org/apache/kylin/rest/service/ServiceTestBase.java | 10 +++++++++-
.../kylin/storage/hbase/util/ZookeeperDistributedLock.java | 10 +++++++++-
6 files changed, 33 insertions(+), 4 deletions(-)
[kylin] 01/02: Minor, delete file before create it
Posted by sh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
shaofengshi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kylin.git
commit 6f760efb41deab05a3ac4499851ed98e59a74a7b
Author: chao long <wa...@qq.com>
AuthorDate: Thu Dec 20 10:45:51 2018 +0800
Minor, delete file before create it
---
.../apache/kylin/common/metrics/metrics2/JsonFileMetricsReporter.java | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/core-common/src/main/java/org/apache/kylin/common/metrics/metrics2/JsonFileMetricsReporter.java b/core-common/src/main/java/org/apache/kylin/common/metrics/metrics2/JsonFileMetricsReporter.java
index 40cb0a6..c07a997 100644
--- a/core-common/src/main/java/org/apache/kylin/common/metrics/metrics2/JsonFileMetricsReporter.java
+++ b/core-common/src/main/java/org/apache/kylin/common/metrics/metrics2/JsonFileMetricsReporter.java
@@ -98,9 +98,10 @@ public class JsonFileMetricsReporter implements CodahaleReporter {
return;
}
+ fs.delete(tmpPath, true);
+
try (BufferedWriter bw = new BufferedWriter(
new OutputStreamWriter(fs.create(tmpPath, true), StandardCharsets.UTF_8))) {
- fs.delete(tmpPath, true);
bw.write(json);
fs.setPermission(tmpPath, FsPermission.createImmutable((short) 0644));
} catch (IOException e) {
[kylin] 02/02: KYLIN-3734 Fix UT error: invalid path of global job
lock
Posted by sh...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
shaofengshi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kylin.git
commit b31385f8e53d49ad68b5030769c1611a8a64ae9c
Author: chao long <wa...@qq.com>
AuthorDate: Thu Dec 20 20:51:05 2018 +0800
KYLIN-3734 Fix UT error: invalid path of global job lock
---
examples/test_case_data/localmeta/kylin.properties | 1 +
pom.xml | 8 +++++++-
server/pom.xml | 5 +++++
.../java/org/apache/kylin/rest/service/ServiceTestBase.java | 10 +++++++++-
.../kylin/storage/hbase/util/ZookeeperDistributedLock.java | 10 +++++++++-
5 files changed, 31 insertions(+), 3 deletions(-)
diff --git a/examples/test_case_data/localmeta/kylin.properties b/examples/test_case_data/localmeta/kylin.properties
index 434286e..be2ecd4 100644
--- a/examples/test_case_data/localmeta/kylin.properties
+++ b/examples/test_case_data/localmeta/kylin.properties
@@ -141,6 +141,7 @@ kylin.engine.mr.mem-hungry-config-override.test1=mem-test1
kylin.engine.mr.mem-hungry-config-override.test2=mem-test2
kylin.job.lock=org.apache.kylin.job.lock.MockJobLockDup
kylin.job.lock=org.apache.kylin.job.lock.MockJobLock
+kylin.env.zookeeper-connect-string=localhost:12181
diff --git a/pom.xml b/pom.xml
index ac1edf0..b20cc26 100644
--- a/pom.xml
+++ b/pom.xml
@@ -102,6 +102,7 @@
<jamm.version>0.3.1</jamm.version>
<mockito.version>2.7.14</mockito.version>
<powermock.version>1.7.0</powermock.version>
+ <curator.version>2.7.1</curator.version>
<!-- Commons -->
<commons-lang3.version>3.4</commons-lang3.version>
@@ -864,7 +865,12 @@
<artifactId>opensaml</artifactId>
<version>${opensaml.version}</version>
</dependency>
-
+ <dependency>
+ <groupId>org.apache.curator</groupId>
+ <artifactId>curator-test</artifactId>
+ <version>${curator.version}</version>
+ <scope>test</scope>
+ </dependency>
<!-- Spring Core -->
<dependency>
diff --git a/server/pom.xml b/server/pom.xml
index b1365a7..84f54ca 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -299,6 +299,11 @@
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.apache.curator</groupId>
+ <artifactId>curator-test</artifactId>
+ <scope>test</scope>
+ </dependency>
</dependencies>
<build>
diff --git a/server/src/test/java/org/apache/kylin/rest/service/ServiceTestBase.java b/server/src/test/java/org/apache/kylin/rest/service/ServiceTestBase.java
index cf8c2c1..ee5cbd1 100644
--- a/server/src/test/java/org/apache/kylin/rest/service/ServiceTestBase.java
+++ b/server/src/test/java/org/apache/kylin/rest/service/ServiceTestBase.java
@@ -18,8 +18,10 @@
package org.apache.kylin.rest.service;
+import java.io.IOException;
import java.util.Arrays;
+import org.apache.curator.test.TestingServer;
import org.apache.kylin.common.KylinConfig;
import org.apache.kylin.common.util.LocalFileMetadataTestCase;
import org.apache.kylin.metadata.cachesync.Broadcaster;
@@ -50,6 +52,8 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@ActiveProfiles("testing")
public class ServiceTestBase extends LocalFileMetadataTestCase {
+ private static TestingServer server;
+
@Autowired
@Qualifier("userService")
UserService userService;
@@ -59,10 +63,14 @@ public class ServiceTestBase extends LocalFileMetadataTestCase {
staticCreateTestMetadata();
Authentication authentication = new TestingAuthenticationToken("ADMIN", "ADMIN", Constant.ROLE_ADMIN);
SecurityContextHolder.getContext().setAuthentication(authentication);
+
+ server = new TestingServer(12181, true);
+ server.start();
}
@AfterClass
- public static void tearDownResource() {
+ public static void tearDownResource() throws IOException {
+ server.stop();
}
@Before
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 ae146d3..b003ca2 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
@@ -19,6 +19,8 @@
package org.apache.kylin.storage.hbase.util;
import java.io.Closeable;
+import java.io.File;
+import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Random;
import java.util.concurrent.ConcurrentHashMap;
@@ -297,7 +299,13 @@ public class ZookeeperDistributedLock implements DistributedLock, JobLock {
n = path.length();
path = path.replace("//", "/");
}
- return path;
+
+ try {
+ return new File(path).getCanonicalPath();
+ } catch (IOException e) {
+ logger.error("get canonical path failed, use original path", e);
+ return path;
+ }
}
// ============================================================================