maheshk114 commented on a change in pull request #883: HIVE-22736 Support 
multiple encryption zones in replication
URL: https://github.com/apache/hive/pull/883#discussion_r370051185
 
 

 ##########
 File path: 
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/ReplChangeManager.java
 ##########
 @@ -493,4 +524,29 @@ public static String joinWithSeparator(Iterable<?> 
strings) {
   public static String[] getListFromSeparatedString(String 
commaSeparatedString) {
     return commaSeparatedString.split("\\s*" + TXN_WRITE_EVENT_FILE_SEPARATOR 
+ "\\s*");
   }
+
+  private static Path getCmRoot(Path path) throws IOException {
+    Path cmroot = null;
+    HdfsEncryptionShim pathEncryptionShim = 
hadoopShims.createHdfsEncryptionShim(path.getFileSystem(conf), conf);
+    if (!pathEncryptionShim.isPathEncrypted(path)) {
+      cmroot = cmRootMapping.get(NO_ENCRYPTION);
+    } else {
+      EncryptionZone encryptionZone = 
pathEncryptionShim.getEncryptionZoneForPath(path);
+      cmroot = cmRootMapping.get(encryptionZone.getPath());
+      if (cmroot == null) {
+        synchronized (instance) {
+          cmroot = new Path(path.getFileSystem(conf).getUri() + 
encryptionZone.getPath()
+                  + MetastoreConf.getVar(conf, ConfVars.REPLCMENCRYPTEDDIR));
+          FileSystem cmFs = cmroot.getFileSystem(conf);
+          // Create cmroot with permission 700 if not exist
+          if (!cmFs.exists(cmroot)) {
+            cmFs.mkdirs(cmroot);
+            cmFs.setPermission(cmroot, new FsPermission("700"));
+          }
+          cmRootMapping.put(encryptionZone.getPath(), cmroot);
 
 Review comment:
   Do we need a map..or a set is fine ..as the mapping from EZ root to CM root 
is constant ?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to