maheshk114 commented on a change in pull request #899: HIVE-22844 Add 
validation and retry logic in cm
URL: https://github.com/apache/hive/pull/899#discussion_r379252079
 
 

 ##########
 File path: 
standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/ReplChangeManager.java
 ##########
 @@ -156,23 +156,31 @@ private ReplChangeManager(Configuration conf) throws 
MetaException {
           cmRootDir = MetastoreConf.getVar(conf, ConfVars.REPLCMDIR);
           encryptedCmRootDir = MetastoreConf.getVar(conf, 
ConfVars.REPLCMENCRYPTEDDIR);
           fallbackNonEncryptedCmRootDir = MetastoreConf.getVar(conf, 
ConfVars.REPLCMFALLBACKNONENCRYPTEDDIR);
+          //validate cmRootEncrypted is absolute
+          Path cmRootEncrypted = new Path(encryptedCmRootDir);
+          if (cmRootEncrypted.isAbsolute()) {
+            throw new MetaException(ConfVars.REPLCMENCRYPTEDDIR.getHiveName() 
+ " should be a relative path");
+          }
+          Path cmRootFallback = new Path(fallbackNonEncryptedCmRootDir);
+          if (!cmRootFallback.isAbsolute()) {
+            throw new MetaException(ConfVars.REPLCMENCRYPTEDDIR.getHiveName() 
+ " should be absolute path");
+          }
           //Create default cm root
           Path cmroot = new Path(cmRootDir);
           createCmRoot(cmroot);
           FileSystem cmRootFs = cmroot.getFileSystem(conf);
           HdfsEncryptionShim pathEncryptionShim = hadoopShims
                   .createHdfsEncryptionShim(cmRootFs, conf);
-          Path cmRootEncrypted = new Path(encryptedCmRootDir);
-          if (cmRootEncrypted.isAbsolute()) {
-            throw new MetaException(ConfVars.REPLCMENCRYPTEDDIR.getHiveName() 
+ " should be a relative path");
-          }
           if (pathEncryptionShim.isPathEncrypted(cmroot)) {
             //If cm root is encrypted we keep using it for the encryption zone
             String encryptionZonePath = cmRootFs.getUri()
                     + 
pathEncryptionShim.getEncryptionZoneForPath(cmroot).getPath();
-            encryptionZones.put(encryptionZonePath, cmRootDir);
+            encryptionZoneToCmrootMapping.put(encryptionZonePath, cmRootDir);
           } else {
-            encryptionZones.put(NO_ENCRYPTION, cmRootDir);
+            encryptionZoneToCmrootMapping.put(NO_ENCRYPTION, cmRootDir);
+          }
+          if (cmRootFs.exists(cmRootFallback) && 
pathEncryptionShim.isPathEncrypted(cmRootFallback)) {
 
 Review comment:
   what if whole hdfs root is encrypted and user does not want non-encrypted 
CMroot ?

----------------------------------------------------------------
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