You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "jojochuang (via GitHub)" <gi...@apache.org> on 2023/11/30 04:19:01 UTC

[PR] HDDS-9804. ozone freon dfsg --path must be FQDN. [ozone]

jojochuang opened a new pull request, #5704:
URL: https://github.com/apache/ozone/pull/5704

   
   ## What changes were proposed in this pull request?
   Add check to prevent invalid --path parameter in ozone freon dfsg command.
   
   Please describe your PR in detail:
   * It's a trivial change but took me several hours to troubleshoot so thought it's worth fixing.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-9804
   
   ## How was this patch tested?
   
   Manually tested on a cluster.


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

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-9804. ozone freon dfsg --path must be FQDN. [ozone]

Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on code in PR #5704:
URL: https://github.com/apache/ozone/pull/5704#discussion_r1410869710


##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/HadoopFsGenerator.java:
##########
@@ -87,6 +87,10 @@ public Void call() throws Exception {
 
     configuration = createOzoneConfiguration();
     uri = URI.create(rootPath);
+    String scheme = uri.getScheme();
+    if (scheme == null) {
+      throw new IllegalArgumentException("--path requires FQDN");
+    }
     String disableCacheName = String.format("fs.%s.impl.disable.cache",
         uri.getScheme());

Review Comment:
   ```suggestion
       String scheme = Optional.ofNullable(uri.getScheme())
           .orElseGet(() -> FileSystem.getDefaultUri(configuration).getScheme());
       String disableCacheName = String.format("fs.%s.impl.disable.cache", scheme);
   ```
   
   (also add `import java.util.Optional`)
   
   Or can use `if` block, if you prefer.



##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/HadoopFsGenerator.java:
##########
@@ -87,6 +87,10 @@ public Void call() throws Exception {
 
     configuration = createOzoneConfiguration();
     uri = URI.create(rootPath);
+    String scheme = uri.getScheme();
+    if (scheme == null) {
+      throw new IllegalArgumentException("--path requires FQDN");
+    }

Review Comment:
   We don't even need to completely replace `uri`, can use scheme of default URI only for disabling the cache.



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

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-9804. ozone freon dfsg does not work with relative --path [ozone]

Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai merged PR #5704:
URL: https://github.com/apache/ozone/pull/5704


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

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-9804. ozone freon dfsg --path must be FQDN. [ozone]

Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on code in PR #5704:
URL: https://github.com/apache/ozone/pull/5704#discussion_r1410887621


##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/HadoopFsGenerator.java:
##########
@@ -87,6 +87,10 @@ public Void call() throws Exception {
 
     configuration = createOzoneConfiguration();
     uri = URI.create(rootPath);
+    String scheme = uri.getScheme();
+    if (scheme == null) {
+      throw new IllegalArgumentException("--path requires FQDN");
+    }
     String disableCacheName = String.format("fs.%s.impl.disable.cache",
         uri.getScheme());

Review Comment:
   Maybe should also fail if `scheme` is `file`.



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

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-9804. ozone freon dfsg --path must be FQDN. [ozone]

Posted by "ayushtkn (via GitHub)" <gi...@apache.org>.
ayushtkn commented on code in PR #5704:
URL: https://github.com/apache/ozone/pull/5704#discussion_r1410204758


##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/HadoopFsGenerator.java:
##########
@@ -87,6 +87,10 @@ public Void call() throws Exception {
 
     configuration = createOzoneConfiguration();
     uri = URI.create(rootPath);
+    String scheme = uri.getScheme();
+    if (scheme == null) {

Review Comment:
   does this work?
   ```
       if (!uri.isAbsolute()) {
   ```
   



##########
hadoop-ozone/tools/src/main/java/org/apache/hadoop/ozone/freon/HadoopFsGenerator.java:
##########
@@ -87,6 +87,10 @@ public Void call() throws Exception {
 
     configuration = createOzoneConfiguration();
     uri = URI.create(rootPath);
+    String scheme = uri.getScheme();
+    if (scheme == null) {
+      throw new IllegalArgumentException("--path requires FQDN");
+    }

Review Comment:
   Shouldn't we use the default FS in that case? If no FS is specified explicitly, the defaultFs should be used, right? Something like this:
   ```
       if (scheme == null) {
         URI defaultUri = FileSystem.getDefaultUri(configuration)
         uri = new URI(defaultUri.getScheme(), defaultUri.getAuthority(), uri.getPath());
       }
   ``` 



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

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org


Re: [PR] HDDS-9804. ozone freon dfsg does not work with relative --path [ozone]

Posted by "adoroszlai (via GitHub)" <gi...@apache.org>.
adoroszlai commented on PR #5704:
URL: https://github.com/apache/ozone/pull/5704#issuecomment-1844802289

   Thanks @jojochuang for the patch, @ayushtkn, @nandakumar131 for the review.


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

To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org