You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by "mkars10 (via GitHub)" <gi...@apache.org> on 2025/03/21 19:38:52 UTC

[PR] CASSJAVA-89 Fix remove deprecated config chunk_length_kb [cassandra-java-driver]

mkars10 opened a new pull request, #2029:
URL: https://github.com/apache/cassandra-java-driver/pull/2029

   This fixes CASSJAVA-89 by switching from deprecated `chunk_length_kb` to `chunk_length_in_kb`


-- 
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: pr-unsubscribe@cassandra.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Re: [PR] CASSJAVA-89 Fix deprecated table configs in Cassandra 5 [cassandra-java-driver]

Posted by "tolbertam (via GitHub)" <gi...@apache.org>.
tolbertam merged PR #2029:
URL: https://github.com/apache/cassandra-java-driver/pull/2029


-- 
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: pr-unsubscribe@cassandra.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Re: [PR] CASSJAVA-89 Fix remove deprecated config chunk_length_kb [cassandra-java-driver]

Posted by "aratno (via GitHub)" <gi...@apache.org>.
aratno commented on code in PR #2029:
URL: https://github.com/apache/cassandra-java-driver/pull/2029#discussion_r2175022437


##########
query-builder/src/test/java/com/datastax/oss/driver/api/querybuilder/schema/CreateTableTest.java:
##########


Review Comment:
   Would you be open to adding an integration test to check query-builder paths? It would be good to get a test failure on future syntax changes like this one, rather than discovering the issue later when attempting to startup an application on the newer Cassandra version. You could follow `com.datastax.oss.driver.querybuilder.JsonInsertIT` as an example.



##########
query-builder/src/main/java/com/datastax/oss/driver/api/querybuilder/schema/RelationOptions.java:
##########
@@ -58,6 +58,20 @@ default SelfT withCDC(boolean enabled) {
     return withOption("cdc", enabled);
   }
 
+  /**
+   * Defines the crc check chance.
+   *
+   * <p>Note that using this option with a version of Apache Cassandra less than 3.0 will raise a
+   * syntax error.
+   *
+   * <p>If no call is made to this method, the default value set is 0.99.

Review Comment:
   Looks like the default is 1.0, not 0.99. The default is decided on the server and is documented here: https://cassandra.apache.org/doc/latest/cassandra/reference/cql-commands/create-table.html
   
   You can remove this part of the docstring.



##########
query-builder/src/main/java/com/datastax/oss/driver/api/querybuilder/schema/RelationOptions.java:
##########
@@ -185,19 +252,30 @@ default SelfT withCompression(@NonNull String compressionAlgorithmName) {
   }
 
   /**
-   * Configures compression using the given algorithm, chunk length and crc check chance.
+   * Configures compression using the given algorithm, chunk length.
    *
    * <p>Unless specifying a custom compression algorithm implementation, it is recommended to use
    * {@link #withLZ4Compression()}, {@link #withSnappyCompression()}, or {@link
    * #withDeflateCompression()}.
    *
    * @param compressionAlgorithmName The class name of the compression algorithm.
    * @param chunkLengthKB The chunk length in KB of compression blocks. Defaults to 64.
-   * @param crcCheckChance The probability (0.0 to 1.0) that checksum will be checked on each read.
-   *     Defaults to 1.0.
    */
   @NonNull
   @CheckReturnValue
+  default SelfT withCompression(@NonNull String compressionAlgorithmName, int chunkLengthKB) {
+    return withOption(
+        "compression",
+        ImmutableMap.of("class", compressionAlgorithmName, "chunk_length_in_kb", chunkLengthKB));
+  }
+
+  /**
+   * @deprecated This method only exists for backward compatibility. Will not work with Apache
+   *     Cassandra 5.0 or later. Use {@link #withCompression(String, int)} instead.

Review Comment:
   For these docstrings that indicate version support, could you update to include a reference to the relevant Jira?
   ```suggestion
      *     Cassandra 5.0 or later due to removal of deprecated table properties (<a href="https://issues.apache.org/jira/browse/CASSANDRA-18742">CASSANDRA-18742</a>). Use {@link #withCompression(String, int)} instead.
   ```



-- 
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: pr-unsubscribe@cassandra.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Re: [PR] CASSJAVA-89 Fix remove deprecated config chunk_length_kb [cassandra-java-driver]

Posted by "mkars10 (via GitHub)" <gi...@apache.org>.
mkars10 commented on code in PR #2029:
URL: https://github.com/apache/cassandra-java-driver/pull/2029#discussion_r2175738780


##########
query-builder/src/test/java/com/datastax/oss/driver/api/querybuilder/schema/CreateTableTest.java:
##########


Review Comment:
   That's a good idea. It looks like I need to do some more local setup to get integration tests running though. I can take a look at that in a few days.



-- 
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: pr-unsubscribe@cassandra.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Re: [PR] CASSJAVA-89 Fix remove deprecated config chunk_length_kb [cassandra-java-driver]

Posted by "mkars10 (via GitHub)" <gi...@apache.org>.
mkars10 commented on code in PR #2029:
URL: https://github.com/apache/cassandra-java-driver/pull/2029#discussion_r2188601838


##########
query-builder/src/test/java/com/datastax/oss/driver/api/querybuilder/schema/CreateTableTest.java:
##########


Review Comment:
   @aratno I added 3 integration tests to cover the following cases.
   - top-level `crc_check_chance` for C* >= 3.0
   - `chunk_length_in_kb` for C* >= 5.0
   - `chunk_length_kb` for C* < 5.0



-- 
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: pr-unsubscribe@cassandra.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Re: [PR] CASSJAVA-89 Fix remove deprecated config chunk_length_kb [cassandra-java-driver]

Posted by "mkars10 (via GitHub)" <gi...@apache.org>.
mkars10 commented on code in PR #2029:
URL: https://github.com/apache/cassandra-java-driver/pull/2029#discussion_r2173505842


##########
query-builder/src/main/java/com/datastax/oss/driver/api/querybuilder/schema/RelationOptions.java:
##########
@@ -121,22 +145,55 @@ default SelfT withLZ4Compression() {
   }
 
   /**
-   * Configures compression using the Snappy algorithm with the given chunk length and crc check
-   * chance.
+   * Configures compression using the Zstd algorithm with the given chunk length.
    *
-   * @see #withCompression(String, int, double)
+   * @see #withCompression(String, int)
+   */
+  @NonNull
+  @CheckReturnValue
+  default SelfT withZstdCompression(int chunkLengthKB) {
+    return withCompression("org.apache.cassandra.io.compress.ZstdCompressor", chunkLengthKB);

Review Comment:
   Ah, thanks for adding the context I was missing. Just switched over to `ZstdCompressor`



-- 
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: pr-unsubscribe@cassandra.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


Re: [PR] CASSJAVA-89 Fix remove deprecated config chunk_length_kb [cassandra-java-driver]

Posted by "aratno (via GitHub)" <gi...@apache.org>.
aratno commented on code in PR #2029:
URL: https://github.com/apache/cassandra-java-driver/pull/2029#discussion_r2175751985


##########
query-builder/src/test/java/com/datastax/oss/driver/api/querybuilder/schema/CreateTableTest.java:
##########


Review Comment:
   Docs here: https://github.com/apache/cassandra-java-driver/blob/4.x/CONTRIBUTING.md#integration-tests
   
   Let me know if you have any questions - happy to help you get set up.



-- 
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: pr-unsubscribe@cassandra.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org