You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2021/09/22 15:00:13 UTC

[GitHub] [nifi] greyp9 opened a new pull request #5409: NIFI-9235 - Improve PutHDFS documentation; conflict detection

greyp9 opened a new pull request #5409:
URL: https://github.com/apache/nifi/pull/5409


   #### Description of PR
   
   Add hook to `AbstractHadoopProcessor.resetHDFSResources()`, allowing subclasses to operate on `FileSystem` after initialization.  Processor `PutHDFS` uses this hook to query the HDFS endpoint for default ACL.  If a default ACLis present, log warning when PutHDFS umask is configured, as HDFS ignores it by design.
   
   In order to streamline the review of the contribution we ask you
   to ensure the following steps have been taken:
   
   ### For all changes:
   - [x] Is there a JIRA ticket associated with this PR? Is it referenced 
        in the commit message?
   
   - [x] Does your PR title start with **NIFI-XXXX** where XXXX is the JIRA number you are trying to resolve? Pay particular attention to the hyphen "-" character.
   
   - [x] Has your PR been rebased against the latest commit within the target branch (typically `main`)?
   
   - [x] Is your initial contribution a single, squashed commit? _Additional commits in response to PR reviewer feedback should be made on this branch and pushed to allow change tracking. Do not `squash` or use `--force` when pushing to allow for clean monitoring of changes._
   
   ### For code changes:
   - [x] Have you ensured that the full suite of tests is executed via `mvn -Pcontrib-check clean install` at the root `nifi` folder?
   - [ ] Have you written or updated unit tests to verify your changes?
   - [x] Have you verified that the full build is successful on JDK 8?
   - [x] Have you verified that the full build is successful on JDK 11?
   - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)? 
   - [ ] If applicable, have you updated the `LICENSE` file, including the main `LICENSE` file under `nifi-assembly`?
   - [ ] If applicable, have you updated the `NOTICE` file, including the main `NOTICE` file found under `nifi-assembly`?
   - [ ] If adding new Properties, have you added `.displayName` in addition to .name (programmatic access) for each of the new properties?
   
   ### For documentation related changes:
   - [ ] Have you ensured that format looks appropriate for the output in which it is rendered?
   
   ### Note:
   Please ensure that once the PR is submitted, you check GitHub Actions CI for build issues and submit an update to your PR as soon as possible.
   


-- 
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@nifi.apache.org

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



[GitHub] [nifi] greyp9 commented on a change in pull request #5409: NIFI-9235 - Improve PutHDFS documentation; conflict detection

Posted by GitBox <gi...@apache.org>.
greyp9 commented on a change in pull request #5409:
URL: https://github.com/apache/nifi/pull/5409#discussion_r716947901



##########
File path: nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/PutHDFS.java
##########
@@ -228,6 +232,20 @@ protected void preProcessConfiguration(final Configuration config, final Process
         FsPermission.setUMask(config, new FsPermission(dfsUmask));
     }
 
+    @Override
+    protected void preProcessFileSystem(final FileSystem fileSystem, final ProcessContext context) throws IOException {
+        if (fileSystem instanceof DistributedFileSystem) {
+            final Path dirPath = new Path(context.getProperty(DIRECTORY).getValue());

Review comment:
       Changed the logic to throw on detection of this situation, as otherwise the file is written to HDFS with less restrictive permissions than are intended.




-- 
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@nifi.apache.org

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



[GitHub] [nifi] exceptionfactory commented on a change in pull request #5409: NIFI-9235 - Improve PutHDFS documentation; conflict detection

Posted by GitBox <gi...@apache.org>.
exceptionfactory commented on a change in pull request #5409:
URL: https://github.com/apache/nifi/pull/5409#discussion_r718052930



##########
File path: nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/PutHDFS.java
##########
@@ -228,6 +240,14 @@ protected void preProcessConfiguration(final Configuration config, final Process
         FsPermission.setUMask(config, new FsPermission(dfsUmask));
     }
 
+    @OnScheduled
+    public void onScheduled(final ProcessContext context) {

Review comment:
       Should there a corresponding `onStopped` method that clears the `aclCache`?




-- 
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@nifi.apache.org

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



[GitHub] [nifi] exceptionfactory closed pull request #5409: NIFI-9235 - Improve PutHDFS documentation; conflict detection

Posted by GitBox <gi...@apache.org>.
exceptionfactory closed pull request #5409:
URL: https://github.com/apache/nifi/pull/5409


   


-- 
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@nifi.apache.org

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



[GitHub] [nifi] exceptionfactory commented on a change in pull request #5409: NIFI-9235 - Improve PutHDFS documentation; conflict detection

Posted by GitBox <gi...@apache.org>.
exceptionfactory commented on a change in pull request #5409:
URL: https://github.com/apache/nifi/pull/5409#discussion_r714078574



##########
File path: nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/PutHDFS.java
##########
@@ -228,6 +232,20 @@ protected void preProcessConfiguration(final Configuration config, final Process
         FsPermission.setUMask(config, new FsPermission(dfsUmask));
     }
 
+    @Override
+    protected void preProcessFileSystem(final FileSystem fileSystem, final ProcessContext context) throws IOException {
+        if (fileSystem instanceof DistributedFileSystem) {
+            final Path dirPath = new Path(context.getProperty(DIRECTORY).getValue());

Review comment:
       The `Directory` property indicates support for FlowFile Expression Language, which means that `getProperty()` needs to call `evaluateAttributeExpressions(FlowFile)`.  Since the FlowFile is not available in this method, it looks like a different approach is necessary.
   
   One option is implementing this hook through a method called from `onTrigger()`, but that would log a warning for every invocation of the Processor.
   
   Since the only current purpose of this hook is to log a warning, this may not be the best approach to the issue. Perhaps adding a note to the umask property would be a better option?




-- 
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@nifi.apache.org

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



[GitHub] [nifi] greyp9 commented on a change in pull request #5409: NIFI-9235 - Improve PutHDFS documentation; conflict detection

Posted by GitBox <gi...@apache.org>.
greyp9 commented on a change in pull request #5409:
URL: https://github.com/apache/nifi/pull/5409#discussion_r718697472



##########
File path: nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/pom.xml
##########
@@ -78,6 +78,11 @@
             <version>1.15.0-SNAPSHOT</version>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>com.github.ben-manes.caffeine</groupId>
+            <artifactId>caffeine</artifactId>
+            <version>2.8.1</version>

Review comment:
       That seems to work.  Updated.




-- 
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@nifi.apache.org

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



[GitHub] [nifi] greyp9 commented on a change in pull request #5409: NIFI-9235 - Improve PutHDFS documentation; conflict detection

Posted by GitBox <gi...@apache.org>.
greyp9 commented on a change in pull request #5409:
URL: https://github.com/apache/nifi/pull/5409#discussion_r718674120



##########
File path: nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/pom.xml
##########
@@ -78,6 +78,11 @@
             <version>1.15.0-SNAPSHOT</version>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>com.github.ben-manes.caffeine</groupId>
+            <artifactId>caffeine</artifactId>
+            <version>2.8.1</version>

Review comment:
       Looks like 3.x requires Java 11:
   ```
   [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project nifi-hdfs-processors: Compilation failure: Compilation failure: 
   [ERROR] nifi/nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/PutHDFS.java:[19,41] error: cannot access Cache
   [ERROR]   bad class file: .m2/repository/com/github/ben-manes/caffeine/caffeine/3.0.4/caffeine-3.0.4.jar(com/github/benmanes/caffeine/cache/Cache.class)
   [ERROR]     class file has wrong version 55.0, should be 52.0
   [ERROR]     Please remove or make sure it appears in the correct subdirectory of the classpath.
   ```

##########
File path: nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/pom.xml
##########
@@ -78,6 +78,11 @@
             <version>1.15.0-SNAPSHOT</version>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>com.github.ben-manes.caffeine</groupId>
+            <artifactId>caffeine</artifactId>
+            <version>2.8.1</version>

Review comment:
       That seems to work.  Updated.




-- 
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@nifi.apache.org

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



[GitHub] [nifi] exceptionfactory commented on a change in pull request #5409: NIFI-9235 - Improve PutHDFS documentation; conflict detection

Posted by GitBox <gi...@apache.org>.
exceptionfactory commented on a change in pull request #5409:
URL: https://github.com/apache/nifi/pull/5409#discussion_r718052046



##########
File path: nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/pom.xml
##########
@@ -78,6 +78,11 @@
             <version>1.15.0-SNAPSHOT</version>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>com.github.ben-manes.caffeine</groupId>
+            <artifactId>caffeine</artifactId>
+            <version>2.8.1</version>

Review comment:
       The latest version is `3.0.4`, can you use the latest version?




-- 
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@nifi.apache.org

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



[GitHub] [nifi] greyp9 commented on a change in pull request #5409: NIFI-9235 - Improve PutHDFS documentation; conflict detection

Posted by GitBox <gi...@apache.org>.
greyp9 commented on a change in pull request #5409:
URL: https://github.com/apache/nifi/pull/5409#discussion_r714329247



##########
File path: nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/PutHDFS.java
##########
@@ -228,6 +232,20 @@ protected void preProcessConfiguration(final Configuration config, final Process
         FsPermission.setUMask(config, new FsPermission(dfsUmask));
     }
 
+    @Override
+    protected void preProcessFileSystem(final FileSystem fileSystem, final ProcessContext context) throws IOException {
+        if (fileSystem instanceof DistributedFileSystem) {
+            final Path dirPath = new Path(context.getProperty(DIRECTORY).getValue());

Review comment:
       > The `Directory` property indicates support for FlowFile Expression Language, which means that `getProperty()` needs to call `evaluateAttributeExpressions(FlowFile)`. Since the FlowFile is not available in this method, it looks like a different approach is necessary.
   > 
   > One option is implementing this hook through a method called from `onTrigger()`, but that would log a warning for every invocation of the Processor.
   > 
   > Since the only current purpose of this hook is to log a warning, this may not be the best approach to the issue. Perhaps adding a note to the umask property would be a better option?
   
   Thanks. 
   
   In addition to the doc update, I'd like to explore a different means to alert on this condition, if it is detected.  Having both should provide a helpful user experience.  I think I understand the constraints here; I'll give it another try.
   




-- 
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@nifi.apache.org

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



[GitHub] [nifi] greyp9 commented on a change in pull request #5409: NIFI-9235 - Improve PutHDFS documentation; conflict detection

Posted by GitBox <gi...@apache.org>.
greyp9 commented on a change in pull request #5409:
URL: https://github.com/apache/nifi/pull/5409#discussion_r718674120



##########
File path: nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/pom.xml
##########
@@ -78,6 +78,11 @@
             <version>1.15.0-SNAPSHOT</version>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>com.github.ben-manes.caffeine</groupId>
+            <artifactId>caffeine</artifactId>
+            <version>2.8.1</version>

Review comment:
       Looks like 3.x requires Java 11:
   ```
   [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project nifi-hdfs-processors: Compilation failure: Compilation failure: 
   [ERROR] nifi/nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/PutHDFS.java:[19,41] error: cannot access Cache
   [ERROR]   bad class file: .m2/repository/com/github/ben-manes/caffeine/caffeine/3.0.4/caffeine-3.0.4.jar(com/github/benmanes/caffeine/cache/Cache.class)
   [ERROR]     class file has wrong version 55.0, should be 52.0
   [ERROR]     Please remove or make sure it appears in the correct subdirectory of the classpath.
   ```




-- 
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@nifi.apache.org

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



[GitHub] [nifi] exceptionfactory commented on a change in pull request #5409: NIFI-9235 - Improve PutHDFS documentation; conflict detection

Posted by GitBox <gi...@apache.org>.
exceptionfactory commented on a change in pull request #5409:
URL: https://github.com/apache/nifi/pull/5409#discussion_r718680459



##########
File path: nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/pom.xml
##########
@@ -78,6 +78,11 @@
             <version>1.15.0-SNAPSHOT</version>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>com.github.ben-manes.caffeine</groupId>
+            <artifactId>caffeine</artifactId>
+            <version>2.8.1</version>

Review comment:
       Thanks for pointing that out @greyp9. In that case, what about version `2.9.2`?




-- 
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@nifi.apache.org

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



[GitHub] [nifi] exceptionfactory commented on a change in pull request #5409: NIFI-9235 - Improve PutHDFS documentation; conflict detection

Posted by GitBox <gi...@apache.org>.
exceptionfactory commented on a change in pull request #5409:
URL: https://github.com/apache/nifi/pull/5409#discussion_r718052046



##########
File path: nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/pom.xml
##########
@@ -78,6 +78,11 @@
             <version>1.15.0-SNAPSHOT</version>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>com.github.ben-manes.caffeine</groupId>
+            <artifactId>caffeine</artifactId>
+            <version>2.8.1</version>

Review comment:
       The latest version is `3.0.4`, can you use the latest version?

##########
File path: nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/PutHDFS.java
##########
@@ -228,6 +240,14 @@ protected void preProcessConfiguration(final Configuration config, final Process
         FsPermission.setUMask(config, new FsPermission(dfsUmask));
     }
 
+    @OnScheduled
+    public void onScheduled(final ProcessContext context) {

Review comment:
       Should there a corresponding `onStopped` method that clears the `aclCache`?

##########
File path: nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/pom.xml
##########
@@ -78,6 +78,11 @@
             <version>1.15.0-SNAPSHOT</version>
             <scope>test</scope>
         </dependency>
+        <dependency>
+            <groupId>com.github.ben-manes.caffeine</groupId>
+            <artifactId>caffeine</artifactId>
+            <version>2.8.1</version>

Review comment:
       Thanks for pointing that out @greyp9. In that case, what about version `2.9.2`?




-- 
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@nifi.apache.org

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



[GitHub] [nifi] greyp9 commented on a change in pull request #5409: NIFI-9235 - Improve PutHDFS documentation; conflict detection

Posted by GitBox <gi...@apache.org>.
greyp9 commented on a change in pull request #5409:
URL: https://github.com/apache/nifi/pull/5409#discussion_r716947901



##########
File path: nifi-nar-bundles/nifi-hadoop-bundle/nifi-hdfs-processors/src/main/java/org/apache/nifi/processors/hadoop/PutHDFS.java
##########
@@ -228,6 +232,20 @@ protected void preProcessConfiguration(final Configuration config, final Process
         FsPermission.setUMask(config, new FsPermission(dfsUmask));
     }
 
+    @Override
+    protected void preProcessFileSystem(final FileSystem fileSystem, final ProcessContext context) throws IOException {
+        if (fileSystem instanceof DistributedFileSystem) {
+            final Path dirPath = new Path(context.getProperty(DIRECTORY).getValue());

Review comment:
       Changed the logic to throw on detection of this situation, as otherwise the file is written to HDFS with less restrictive permissions than are intended.




-- 
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@nifi.apache.org

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