You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "justinrsweeney (via GitHub)" <gi...@apache.org> on 2023/02/10 16:44:58 UTC

[GitHub] [solr] justinrsweeney opened a new pull request, #1348: Adding support for compression within the ZkCLI tool

justinrsweeney opened a new pull request, #1348:
URL: https://github.com/apache/solr/pull/1348

   https://issues.apache.org/jira/browse/SOLR-16608
   
   # Description
   
   This provides support for compressed state.json for the ZkCLI tool. This will allow for using the ZkCLI tool to get and put state.json files and ensure they are correctly compressed when put and uncompressed when retrieved. This will allow Solr administrators to retrieve and modify state.json while maintaining compression.
   
   # Solution
   
   This uses the local solr home by default to get the configured settings from solr.xml for compressed state. If this tool is run without providing solr home, then you will not be able to rely on compression being configured.
   
   # Tests
   
   Added new tests to the ZkCLITest to cover cases with compression as well.
   
   # Checklist
   
   Please review the following and check all that apply:
   
   - [X] I have reviewed the guidelines for [How to Contribute](https://wiki.apache.org/solr/HowToContribute) and my code conforms to the standards described there to the best of my ability.
   - [X] I have created a Jira issue and added the issue ID to my pull request title.
   - [ ] I have given Solr maintainers [access](https://help.github.com/en/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork) to contribute to my PR branch. (optional but recommended)
   - [X] I have developed this patch against the `main` branch.
   - [X] I have run `./gradlew check`.
   - [X] I have added tests for my changes.
   - [ ] I have added documentation for the [Reference Guide](https://github.com/apache/solr/tree/main/solr/solr-ref-guide)
   


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

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


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


[GitHub] [solr] epugh commented on pull request #1348: Adding support for compression within the ZkCLI tool

Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on PR #1348:
URL: https://github.com/apache/solr/pull/1348#issuecomment-1426096729

   Oh, and thanks for giving the CLI some love!


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

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


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


[GitHub] [solr] justinrsweeney commented on pull request #1348: Adding support for compression within the ZkCLI tool

Posted by "justinrsweeney (via GitHub)" <gi...@apache.org>.
justinrsweeney commented on PR #1348:
URL: https://github.com/apache/solr/pull/1348#issuecomment-1440676642

   > This looks like it does the job. However, I was sort of thinking that compression would be more of a wrapper around the underlying data structure? Kind of like a `ZipInputStream` might wrap a `InputStream`? It seems like there is a lot of logic in the CLI around all the compression, and that it might be ripe for bugs...
   > 
   > Maybe thinking it would look more like `ZKReader reader = getZKReader()` and you woudn't see all the compression logic?
   > 
   > Someday I want to break up ZKCli.java and make it easier to reason about.
   
   I don't think that'll be doable here. In this case, reading is actually handled fine. Putting files into ZK is where there is a bit of complexity. I did refactor the check if data should be compressed into its own method now to make it a little cleaner.
   
   I do agree that a larger refactor of this code would be beneficial in the future.


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

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


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


[GitHub] [solr] justinrsweeney merged pull request #1348: Adding support for compression within the ZkCLI tool

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


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

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


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


[GitHub] [solr] epugh commented on pull request #1348: Adding support for compression within the ZkCLI tool

Posted by "epugh (via GitHub)" <gi...@apache.org>.
epugh commented on PR #1348:
URL: https://github.com/apache/solr/pull/1348#issuecomment-1426096269

   This looks like it does the job.  However, I was sort of thinking that compression would be more of a wrapper around the underlying data structure?   Kind of like a `ZipInputStream` might wrap a `InputStream`?    It seems like there is a lot of logic in the CLI around all the compression, and that it might be ripe for bugs...    
   
   Maybe thinking it would look more like `ZKReader reader = getZKReader()` and you woudn't see all the compression logic?
   
   Someday I want to break up ZKCli.java and make it easier to reason about.   
   


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

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


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


[GitHub] [solr] sonatype-lift[bot] commented on a diff in pull request #1348: Adding support for compression within the ZkCLI tool

Posted by "sonatype-lift[bot] (via GitHub)" <gi...@apache.org>.
sonatype-lift[bot] commented on code in PR #1348:
URL: https://github.com/apache/solr/pull/1348#discussion_r1103036740


##########
solr/core/src/java/org/apache/solr/cloud/ZkCLI.java:
##########
@@ -255,9 +266,43 @@ public static void main(String[] args)
         zkServer.parseConfig();
         zkServer.start();
       }
+
+      int minStateByteLenForCompression = -1;
+      Compressor compressor = new ZLibCompressor();
+
+      if (solrHome != null) {
+        try {
+          Path solrHomePath = Paths.get(solrHome);

Review Comment:
   <picture><img alt="7% of developers fix this issue" src="https://lift.sonatype.com/api/commentimage/fixrate/7/display.svg"></picture>
   
   <b>*[PATH_TRAVERSAL_IN](https://find-sec-bugs.github.io/bugs.htm#PATH_TRAVERSAL_IN):</b>*  This API (java/nio/file/Paths.get(Ljava/lang/String;[Ljava/lang/String;)Ljava/nio/file/Path;) reads a file whose location might be specified by user input
   
   ---
   
   <details><summary>ℹī¸ Expand to see all <b>@sonatype-lift</b> commands</summary>
   
   You can reply with the following commands. For example, reply with ***@sonatype-lift ignoreall*** to leave out all findings.
   | **Command** | **Usage** |
   | ------------- | ------------- |
   | `@sonatype-lift ignore` | Leave out the above finding from this PR |
   | `@sonatype-lift ignoreall` | Leave out all the existing findings from this PR |
   | `@sonatype-lift exclude <file\|issue\|path\|tool>` | Exclude specified `file\|issue\|path\|tool` from Lift findings by updating your config.toml file |
   
   **Note:** When talking to LiftBot, you need to **refresh** the page to see its response.
   <sub>[Click here](https://github.com/apps/sonatype-lift/installations/new) to add LiftBot to another repo.</sub></details>
   
   
   
   ---
   
   <b>Help us improve LIFT! (<i>Sonatype LiftBot external survey</i>)</b>
   
   Was this a good recommendation for you? <sub><small>Answering this survey will not impact your Lift settings.</small></sub>
   
   [ [🙁 Not relevant](https://www.sonatype.com/lift-comment-rating?comment=387751237&lift_comment_rating=1) ] - [ [😕 Won't fix](https://www.sonatype.com/lift-comment-rating?comment=387751237&lift_comment_rating=2) ] - [ [😑 Not critical, will fix](https://www.sonatype.com/lift-comment-rating?comment=387751237&lift_comment_rating=3) ] - [ [🙂 Critical, will fix](https://www.sonatype.com/lift-comment-rating?comment=387751237&lift_comment_rating=4) ] - [ [😊 Critical, fixing now](https://www.sonatype.com/lift-comment-rating?comment=387751237&lift_comment_rating=5) ]



##########
solr/server/scripts/cloud-scripts/zkcli.sh:
##########
@@ -21,6 +23,6 @@ log4j_config="file:$sdir/../../resources/log4j2-console.xml"
 #...
 #   -DzkDigestCredentialsFile=/path/to/zkDigestCredentialsFile.properties
 #...
-PATH=$JAVA_HOME/bin:$PATH $JVM $SOLR_ZK_CREDS_AND_ACLS $ZKCLI_JVM_FLAGS -Dlog4j.configurationFile=$log4j_config \
+PATH=$JAVA_HOME/bin:$PATH $JVM $SOLR_ZK_CREDS_AND_ACLS $ZKCLI_JVM_FLAGS -Dlog4j.configurationFile=$log4j_config -DsolrHome=$solr_home \

Review Comment:
   <picture><img alt="29% of developers fix this issue" src="https://lift.sonatype.com/api/commentimage/fixrate/29/display.svg"></picture>
   
   <b>*[SC2086](https://github.com/koalaman/shellcheck/wiki/SC2086):</b>*  Double quote to prevent globbing and word splitting.
   
   ❗❗ <b>3 similar findings have been found in this PR</b>
   
   <details><summary>🔎 Expand here to view all instances of this finding</summary><br/>
     
     
   <div align=\"center\">
   
   
   | **File Path** | **Line Number** |
   | ------------- | ------------- |
   | solr/server/scripts/cloud-scripts/zkcli.sh | [26](https://github.com/apache/solr/blob/81b33305e8e19f0cc3d451a23d130d198fc582b3/solr/server/scripts/cloud-scripts/zkcli.sh#L26) |
   | solr/server/scripts/cloud-scripts/zkcli.sh | [26](https://github.com/apache/solr/blob/81b33305e8e19f0cc3d451a23d130d198fc582b3/solr/server/scripts/cloud-scripts/zkcli.sh#L26) |
   | solr/server/scripts/cloud-scripts/zkcli.sh | [26](https://github.com/apache/solr/blob/81b33305e8e19f0cc3d451a23d130d198fc582b3/solr/server/scripts/cloud-scripts/zkcli.sh#L26) |
   <p><a href="https://lift.sonatype.com/results/github.com/apache/solr/01GRY3EEVY0B0WRDCH2PBTHFHE?t=Shellcheck|SC2086" target="_blank">Visit the Lift Web Console</a> to find more details in your report.</p></div></details>
   
   
   
   ---
   
   <details><summary>ℹī¸ Expand to see all <b>@sonatype-lift</b> commands</summary>
   
   You can reply with the following commands. For example, reply with ***@sonatype-lift ignoreall*** to leave out all findings.
   | **Command** | **Usage** |
   | ------------- | ------------- |
   | `@sonatype-lift ignore` | Leave out the above finding from this PR |
   | `@sonatype-lift ignoreall` | Leave out all the existing findings from this PR |
   | `@sonatype-lift exclude <file\|issue\|path\|tool>` | Exclude specified `file\|issue\|path\|tool` from Lift findings by updating your config.toml file |
   
   **Note:** When talking to LiftBot, you need to **refresh** the page to see its response.
   <sub>[Click here](https://github.com/apps/sonatype-lift/installations/new) to add LiftBot to another repo.</sub></details>
   
   
   
   ---
   
   <b>Help us improve LIFT! (<i>Sonatype LiftBot external survey</i>)</b>
   
   Was this a good recommendation for you? <sub><small>Answering this survey will not impact your Lift settings.</small></sub>
   
   [ [🙁 Not relevant](https://www.sonatype.com/lift-comment-rating?comment=387752894&lift_comment_rating=1) ] - [ [😕 Won't fix](https://www.sonatype.com/lift-comment-rating?comment=387752894&lift_comment_rating=2) ] - [ [😑 Not critical, will fix](https://www.sonatype.com/lift-comment-rating?comment=387752894&lift_comment_rating=3) ] - [ [🙂 Critical, will fix](https://www.sonatype.com/lift-comment-rating?comment=387752894&lift_comment_rating=4) ] - [ [😊 Critical, fixing now](https://www.sonatype.com/lift-comment-rating?comment=387752894&lift_comment_rating=5) ]



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

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


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