You are viewing a plain text version of this content. The canonical link for it is here.
Posted to gitbox@hive.apache.org by GitBox <gi...@apache.org> on 2020/05/20 18:27:16 UTC

[GitHub] [hive] aasha opened a new pull request #1028: HIVE-23519 : Read Ranger Configs from Classpath

aasha opened a new pull request #1028:
URL: https://github.com/apache/hive/pull/1028


   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] pkumarsinha commented on a change in pull request #1028: HIVE-23519 : Read Ranger Configs from Classpath

Posted by GitBox <gi...@apache.org>.
pkumarsinha commented on a change in pull request #1028:
URL: https://github.com/apache/hive/pull/1028#discussion_r428938361



##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/repl/RangerDumpTask.java
##########
@@ -81,12 +79,16 @@ public int execute() {
       if (rangerRestClient == null) {
         rangerRestClient = getRangerRestClient();
       }
-      String rangerEndpoint = conf.getVar(REPL_AUTHORIZATION_PROVIDER_SERVICE_ENDPOINT);
+      InputStream inputStream = RangerDumpTask.class.getClassLoader()

Review comment:
       Move the conf reading to another method. Does conf.addResource also closes the stream? If not close the input stream.

##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/repl/RangerDumpTask.java
##########
@@ -81,12 +79,16 @@ public int execute() {
       if (rangerRestClient == null) {
         rangerRestClient = getRangerRestClient();
       }
-      String rangerEndpoint = conf.getVar(REPL_AUTHORIZATION_PROVIDER_SERVICE_ENDPOINT);
+      InputStream inputStream = RangerDumpTask.class.getClassLoader()
+          .getResourceAsStream(ReplUtils.RANGER_CONFIGURATION_RESOURCE_NAME);
+      if (inputStream != null) {
+        conf.addResource(inputStream);
+      }
+      String rangerHiveServiceName = conf.get(ReplUtils.RANGER_HIVE_SERVICE_NAME);
+      String rangerEndpoint = conf.get(ReplUtils.RANGER_REST_URL);
       if (StringUtils.isEmpty(rangerEndpoint) || !rangerRestClient.checkConnection(rangerEndpoint)) {
-        throw new Exception("Ranger endpoint is not valid. "
-                + "Please pass a valid config hive.repl.authorization.provider.service.endpoint");
+        throw new Exception("Ranger endpoint is not valid.");

Review comment:
       One another thing missing in log is, say if rangerEndpoint is null, we will not know whether the the conf for it is not present or the inputStream itself is null.
   May be, you may want to switch to another version of getResource(), (URL based on).
   In that case we will have URL of conf file  to log and we need not bother to close inputStream. 

##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/repl/RangerDumpTask.java
##########
@@ -81,12 +79,16 @@ public int execute() {
       if (rangerRestClient == null) {
         rangerRestClient = getRangerRestClient();
       }
-      String rangerEndpoint = conf.getVar(REPL_AUTHORIZATION_PROVIDER_SERVICE_ENDPOINT);
+      InputStream inputStream = RangerDumpTask.class.getClassLoader()
+          .getResourceAsStream(ReplUtils.RANGER_CONFIGURATION_RESOURCE_NAME);
+      if (inputStream != null) {
+        conf.addResource(inputStream);
+      }
+      String rangerHiveServiceName = conf.get(ReplUtils.RANGER_HIVE_SERVICE_NAME);
+      String rangerEndpoint = conf.get(ReplUtils.RANGER_REST_URL);
       if (StringUtils.isEmpty(rangerEndpoint) || !rangerRestClient.checkConnection(rangerEndpoint)) {
-        throw new Exception("Ranger endpoint is not valid. "
-                + "Please pass a valid config hive.repl.authorization.provider.service.endpoint");
+        throw new Exception("Ranger endpoint is not valid.");

Review comment:
       Adding the endpoint in log message will help debug when required.

##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/repl/RangerLoadTask.java
##########
@@ -83,10 +81,15 @@ public int execute() {
       if (rangerRestClient == null) {
         rangerRestClient = getRangerRestClient();
       }
-      String rangerEndpoint = conf.getVar(REPL_AUTHORIZATION_PROVIDER_SERVICE_ENDPOINT);
+      InputStream inputStream = RangerDumpTask.class.getClassLoader()

Review comment:
       Even though it works, change it to, RangerLoadTask.class.getClassLoader() or even just getClass().getClassLoader() is fine.

##########
File path: ql/src/java/org/apache/hadoop/hive/ql/exec/repl/RangerLoadTask.java
##########
@@ -83,10 +81,15 @@ public int execute() {
       if (rangerRestClient == null) {
         rangerRestClient = getRangerRestClient();
       }
-      String rangerEndpoint = conf.getVar(REPL_AUTHORIZATION_PROVIDER_SERVICE_ENDPOINT);
+      InputStream inputStream = RangerDumpTask.class.getClassLoader()
+          .getResourceAsStream(ReplUtils.RANGER_CONFIGURATION_RESOURCE_NAME);
+      if (inputStream != null) {
+        conf.addResource(inputStream);
+      }
+      String rangerHiveServiceName = conf.get(ReplUtils.RANGER_HIVE_SERVICE_NAME);
+      String rangerEndpoint = conf.get(ReplUtils.RANGER_REST_URL);
       if (StringUtils.isEmpty(rangerEndpoint) || !rangerRestClient.checkConnection(rangerEndpoint)) {
-        throw new Exception("Ranger endpoint is not valid. "
-                + "Please pass a valid config hive.repl.authorization.provider.service.endpoint");
+        throw new Exception("Ranger endpoint is not valid.");

Review comment:
       Same comments here




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] github-actions[bot] commented on pull request #1028: HIVE-23519 : Read Ranger Configs from Classpath

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on pull request #1028:
URL: https://github.com/apache/hive/pull/1028#issuecomment-662764618


   This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
   Feel free to reach out on the dev@hive.apache.org list if the patch is in need of reviews.


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org


[GitHub] [hive] github-actions[bot] closed pull request #1028: HIVE-23519 : Read Ranger Configs from Classpath

Posted by GitBox <gi...@apache.org>.
github-actions[bot] closed pull request #1028:
URL: https://github.com/apache/hive/pull/1028


   


----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: gitbox-unsubscribe@hive.apache.org
For additional commands, e-mail: gitbox-help@hive.apache.org