You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by mo...@apache.org on 2017/04/23 02:12:55 UTC

zeppelin git commit: [ZEPPELIN-2410]: Using UUID from filename in registry cache dir inste…

Repository: zeppelin
Updated Branches:
  refs/heads/master 2f9011405 -> 96de73049


[ZEPPELIN-2410]: Using UUID from filename in registry cache dir inste\u2026

\u2026ad of uri.

### What is this PR for?

Fixing issue ZEPPELIN-2410:

The previous version of this file used the full uri as file name in the
cache. This included special characters like the : in http: which
caused problems.

Since this is just a cache file, a better approach is to use an UUID.

The UUID is constructed from the URI to avoid the cache dir to grow
over time (in case there is no clean up of the cache dir).

Output of `ls -la` on macOS before the fix:
```
drwxr-xr-x  4 fries  staff  136 17 Apr 22:28 .
drwxr-xr-x  8 fries  staff  272 21 Apr 12:43 ..
drwxr-xr-x  3 fries  staff  102 17 Apr 10:39 https:
```

Output of `ls -la` on macOS after the fix:
```
drwxr-xr-x  4 fries  staff    136 21 Apr 17:32 .
drwxr-xr-x  8 fries  staff    272 21 Apr 17:32 ..
-rw-r--r--  1 fries  staff  89666 21 Apr 17:32 a6618b3e-540a-340e-b624-07bf7f2b5e7d
```

Note: Windows 7 just fails to create the cache before the fix.

### What type of PR is it?
[Bug Fix]

### What is the Jira issue?

https://issues.apache.org/jira/browse/ZEPPELIN-2410?filter=-2

### How should this be tested?

Non-Regression Test.
Run on Windows, check cache dir.

### Screenshots (if appropriate)

N/A

### Questions:
* Does the licenses files need update?
No
* Is there breaking changes for older versions?
No
* Does this needs documentation?
No

Author: Christian Fries <em...@christian-fries.de>

Closes #2276 from cfries/helium-cache-filename-patch and squashes the following commits:

5fda58f [Christian Fries] [ZEPPELIN-2410]: Using UUID from filename in registry cache dir instead of uri.


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

Branch: refs/heads/master
Commit: 96de73049fb34877bc6049891f34d835e220a013
Parents: 2f90114
Author: Christian Fries <em...@christian-fries.de>
Authored: Fri Apr 21 17:07:00 2017 +0200
Committer: Lee moon soo <mo...@apache.org>
Committed: Sat Apr 22 19:12:50 2017 -0700

----------------------------------------------------------------------
 .../java/org/apache/zeppelin/helium/HeliumOnlineRegistry.java  | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/zeppelin/blob/96de7304/zeppelin-zengine/src/main/java/org/apache/zeppelin/helium/HeliumOnlineRegistry.java
----------------------------------------------------------------------
diff --git a/zeppelin-zengine/src/main/java/org/apache/zeppelin/helium/HeliumOnlineRegistry.java b/zeppelin-zengine/src/main/java/org/apache/zeppelin/helium/HeliumOnlineRegistry.java
index d6bf499..b1c3a83 100644
--- a/zeppelin-zengine/src/main/java/org/apache/zeppelin/helium/HeliumOnlineRegistry.java
+++ b/zeppelin-zengine/src/main/java/org/apache/zeppelin/helium/HeliumOnlineRegistry.java
@@ -32,6 +32,7 @@ import java.net.URL;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
+import java.util.UUID;
 
 /**
  * This registry reads helium package json data
@@ -55,7 +56,10 @@ public class HeliumOnlineRegistry extends HeliumRegistry {
   public HeliumOnlineRegistry(String name, String uri, File registryCacheDir) {
     super(name, uri);
     registryCacheDir.mkdirs();
-    this.registryCacheFile = new File(registryCacheDir, name);
+
+    UUID registryCacheFileUuid = UUID.nameUUIDFromBytes(uri.getBytes());
+    this.registryCacheFile = new File(registryCacheDir, registryCacheFileUuid.toString());
+
     gson = new Gson();
   }