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 2022/08/11 16:45:36 UTC

[GitHub] [nifi] hawko2600 opened a new pull request, #6294: Nifi 2827 - Add support for ZSTD compression format

hawko2600 opened a new pull request, #6294:
URL: https://github.com/apache/nifi/pull/6294

   <!-- Licensed to the Apache Software Foundation (ASF) under one or more -->
   <!-- contributor license agreements.  See the NOTICE file distributed with -->
   <!-- this work for additional information regarding copyright ownership. -->
   <!-- The ASF licenses this file to You under the Apache License, Version 2.0 -->
   <!-- (the "License"); you may not use this file except in compliance with -->
   <!-- the License.  You may obtain a copy of the License at -->
   <!--     http://www.apache.org/licenses/LICENSE-2.0 -->
   <!-- Unless required by applicable law or agreed to in writing, software -->
   <!-- distributed under the License is distributed on an "AS IS" BASIS, -->
   <!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -->
   <!-- See the License for the specific language governing permissions and -->
   <!-- limitations under the License. -->
   
   # Summary
   
   [NIFI-2827](https://issues.apache.org/jira/browse/NIFI-2827)
   
   # Tracking
   
   Please complete the following tracking steps prior to pull request creation.
   
   ### Issue Tracking
   
   - [x ] [Apache NiFi Jira](https://issues.apache.org/jira/browse/NIFI) issue created
   
   ### Pull Request Tracking
   
   - [ x] Pull Request title starts with Apache NiFi Jira issue number, such as `NIFI-00000`
   - [ x] Pull Request commit message starts with Apache NiFi Jira issue number, as such `NIFI-00000`
   
   ### Pull Request Formatting
   
   - [x ] Pull Request based on current revision of the `main` branch
   - [x ] Pull Request refers to a feature branch with one commit containing changes
   
   # Verification
   
   Please indicate the verification steps performed prior to pull request creation.
   
   ### Build
   
   - [ ] Build completed using `mvn clean install -P contrib-check`
     - [ ] JDK 8
     - [x ] JDK 11
     - [ ] JDK 17
   
   ### Licensing
   
   - [x ] New dependencies are compatible with the [Apache License 2.0](https://apache.org/licenses/LICENSE-2.0) according to the [License Policy](https://www.apache.org/legal/resolved.html)
   - [x ] New dependencies are documented in applicable `LICENSE` and `NOTICE` files
   
   ### Documentation
   
   - [x ] Documentation formatting appears as expected in rendered files
   


-- 
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] MikeThomsen commented on a diff in pull request #6294: NIFI-2827 - Add support for ZSTD compression format

Posted by GitBox <gi...@apache.org>.
MikeThomsen commented on code in PR #6294:
URL: https://github.com/apache/nifi/pull/6294#discussion_r962161081


##########
minifi/pom.xml:
##########
@@ -504,6 +504,11 @@ limitations under the License.
                 <artifactId>lzma-java</artifactId>
                 <version>1.3</version>
             </dependency>
+            <dependency>

Review Comment:
   Not specific to this line, but minifi and nifi-standard-bundle need their NOTICE files updated to include this dependency so Facebook gets the appropriate attribution since we are redistributing their binaries.



##########
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/CompressContent.java:
##########
@@ -328,6 +335,11 @@ public void process(final InputStream rawIn, final OutputStream rawOut) throws I
                                     mimeTypeRef.set("application/x-lz4-framed");
                                     compressionOut = new CompressorStreamFactory().createCompressorOutputStream(compressionFormat.toLowerCase(), bufferedOut);
                                     break;
+                                case COMPRESSION_FORMAT_ZSTD:
+                                    final int zstdcompressionLevel = context.getProperty(COMPRESSION_LEVEL).asInteger() * 2;

Review Comment:
   Non-standard variable name. Also, why is the value multiplied by 2?



##########
nifi-nar-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/main/java/org/apache/nifi/json/JsonRecordSetWriter.java:
##########
@@ -72,6 +72,7 @@ public class JsonRecordSetWriter extends DateTimeTextRecordSetWriter implements
     public static final String COMPRESSION_FORMAT_SNAPPY = "snappy";
     public static final String COMPRESSION_FORMAT_SNAPPY_FRAMED = "snappy framed";
     public static final String COMPRESSION_FORMAT_NONE = "none";
+    public static final String COMPRESSION_FORMAT_ZSTD = "zstd";

Review Comment:
   Would like to see a unit test that validates this doesn't break anything.



-- 
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] asfgit closed pull request #6294: NIFI-2827 - Add support for ZSTD compression format

Posted by GitBox <gi...@apache.org>.
asfgit closed pull request #6294: NIFI-2827 - Add support for ZSTD compression format
URL: https://github.com/apache/nifi/pull/6294


-- 
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] hawko2600 commented on a diff in pull request #6294: NIFI-2827 - Add support for ZSTD compression format

Posted by GitBox <gi...@apache.org>.
hawko2600 commented on code in PR #6294:
URL: https://github.com/apache/nifi/pull/6294#discussion_r962205842


##########
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/CompressContent.java:
##########
@@ -328,6 +335,11 @@ public void process(final InputStream rawIn, final OutputStream rawOut) throws I
                                     mimeTypeRef.set("application/x-lz4-framed");
                                     compressionOut = new CompressorStreamFactory().createCompressorOutputStream(compressionFormat.toLowerCase(), bufferedOut);
                                     break;
+                                case COMPRESSION_FORMAT_ZSTD:
+                                    final int zstdcompressionLevel = context.getProperty(COMPRESSION_LEVEL).asInteger() * 2;

Review Comment:
   I used the same format variable name as per the similar variable for other formats, unsure of the issue. Literally copied the line, cut the other format label out, replaced with zstd.
   
   I noted this on Jira; zstd has 22 compression levels, though they advise not to use more than 20. It effectively changes block size similar to gzip - there's just more refined tweaking available. Sadly at this point in the nifi code there's no easy way to support all 22 levels as nifi is setup for the 9 levels of other formats. I know it's not ideal but multiplying the value by 2 spreads the 9 levels of nifi across 18 of the 20 preferred zstd levels effectively the same as other formats, whilst retaining the zstd function of level 0 meaning "I don't know, let the algorithm figure it out" as 2*0=0.
   
   I was adding support for this one format, not trying to refactor how compression is supported generally. Over not having it at all, I'll take the simple approach and a more general "now that we have it, how do we effect all 22 levels" can be addressed in a separate issue.
   
   On the phone version of GitHub I can't seem to reply to the first comment, but the NOTICE files already have the necessary info as zstd was included for years via apache commons and so the license was already there. The only thing missing was the supporting code to enable the format.
   



-- 
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] MikeThomsen commented on a diff in pull request #6294: NIFI-2827 - Add support for ZSTD compression format

Posted by GitBox <gi...@apache.org>.
MikeThomsen commented on code in PR #6294:
URL: https://github.com/apache/nifi/pull/6294#discussion_r962325077


##########
minifi/pom.xml:
##########
@@ -504,6 +504,11 @@ limitations under the License.
                 <artifactId>lzma-java</artifactId>
                 <version>1.3</version>
             </dependency>
+            <dependency>

Review Comment:
   Fair enough and TBH I think ARM support is still underway so anyone trying this on ARM is kinda signing themselves up to be a guinea pig in terms of support :-D



-- 
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] hawko2600 commented on a diff in pull request #6294: NIFI-2827 - Add support for ZSTD compression format

Posted by GitBox <gi...@apache.org>.
hawko2600 commented on code in PR #6294:
URL: https://github.com/apache/nifi/pull/6294#discussion_r962206304


##########
minifi/pom.xml:
##########
@@ -504,6 +504,11 @@ limitations under the License.
                 <artifactId>lzma-java</artifactId>
                 <version>1.3</version>
             </dependency>
+            <dependency>

Review Comment:
   The zstd license is already in the notice files as it is included in apache commons, which is how I'm effecting it. The jni component was either BSD or Apache license off the top of my head, also already included.
   
   I didn't have a free rpi to test the jni component on ARM, this is my 2nd concern (the first being I can't possibly test heap utilization of every possible data flow). That's what field testing is for 😊



-- 
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] MikeThomsen commented on pull request #6294: NIFI-2827 - Add support for ZSTD compression format

Posted by GitBox <gi...@apache.org>.
MikeThomsen commented on PR #6294:
URL: https://github.com/apache/nifi/pull/6294#issuecomment-1236397820

   Thanks for the contribution.


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