You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by "kdn36 (via GitHub)" <gi...@apache.org> on 2026/02/03 10:34:30 UTC

[PR] Add CRC64NVME checksum support [arrow-rs-object-store]

kdn36 opened a new pull request, #633:
URL: https://github.com/apache/arrow-rs-object-store/pull/633

   # Which issue does this PR close?
   
   Closes #611 
   
   # Rationale for this change
    
   Improve (AWS) S3 write performance without compromising object integrity.
   
   # What changes are included in this PR?
   
   Key change is that the `CRC64NVME` checksum algorithm, which is the AWS default checksum algorithm, is added as a supported checksum variant.
   
   Implementation note: if more checksum algorithms are to be supported, a minor refactor how checksum variants are handled would be in order.
   
   # Are there any user-facing changes?
   
   The following `storage_options` key-value pair will be honored:
   ```
       "aws_checksum_algorithm": "CRC64NVME",
   ```
   A typical use case would combine this with
   ```
       "aws_unsigned_payload": "true",
   ```
   
   Kindly review, thanks!
   


-- 
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: github-unsubscribe@arrow.apache.org

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


Re: [PR] Add CRC64NVME checksum support [arrow-rs-object-store]

Posted by "crepererum (via GitHub)" <gi...@apache.org>.
crepererum commented on code in PR #633:
URL: https://github.com/apache/arrow-rs-object-store/pull/633#discussion_r3044086641


##########
src/aws/client.rs:
##########
@@ -708,30 +734,52 @@ impl S3Client {
         }
 
         let (parts, body) = request.send().await?.into_parts();
-        let (e_tag, checksum_sha256) = if is_copy {
+        let (e_tag, checksum_sha256, checksum_crc64nvme) = if is_copy {
             let response = body
                 .bytes()
                 .await
                 .map_err(|source| Error::CreateMultipartResponseBody { source })?;
             let response: CopyPartResult = quick_xml::de::from_reader(response.reader())
                 .map_err(|source| Error::InvalidMultipartResponse { source })?;
-            (response.e_tag, response.checksum_sha256)
+            (
+                response.e_tag,
+                response.checksum_sha256,
+                response.checksum_crc64nvme,
+            )
         } else {
             let e_tag = get_etag(&parts.headers).map_err(|source| Error::Metadata { source })?;
             let checksum_sha256 = parts
                 .headers
                 .get(SHA256_CHECKSUM)
                 .and_then(|v| v.to_str().ok())
                 .map(|v| v.to_string());
-            (e_tag, checksum_sha256)
+            let checksum_crc64nvme = parts
+                .headers
+                .get(CRC64NVME_CHECKSUM)
+                .and_then(|v| v.to_str().ok())
+                .map(|v| v.to_string());
+            (e_tag, checksum_sha256, checksum_crc64nvme)
         };
 
-        let content_id = if self.config.checksum == Some(Checksum::SHA256) {
-            let meta = PartMetadata {
-                e_tag,
-                checksum_sha256,
-            };
-            quick_xml::se::to_string(&meta).unwrap()
+        let content_id = if let Some(checksum) = self.config.checksum {

Review Comment:
   I still don't understand why the match block below just doesn't copy both checksums that you've extracted from the headers (you don't even have to compute it). Why do we strip one of them?



-- 
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: github-unsubscribe@arrow.apache.org

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


Re: [PR] Add CRC64NVME checksum support [arrow-rs-object-store]

Posted by "orlp (via GitHub)" <gi...@apache.org>.
orlp commented on code in PR #633:
URL: https://github.com/apache/arrow-rs-object-store/pull/633#discussion_r2758457570


##########
src/aws/checksum.rs:
##########
@@ -24,12 +24,15 @@ use std::str::FromStr;
 pub enum Checksum {
     /// SHA-256 algorithm.
     SHA256,
+    /// CRC64-NVME algorithm.
+    CRC64NVME,

Review Comment:
   This is *technically* a breaking change because this enum was (erroneously IMO) not marked as `#[non_exhaustive]`. It's up to the maintainer - I personally don't believe anyone is matching on `Checksum`.
   
   But @kdn36 you should definitely mark this enum as `#[non_exhaustive]`.



-- 
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: github-unsubscribe@arrow.apache.org

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


Re: [PR] Add CRC64NVME checksum support [arrow-rs-object-store]

Posted by "kdn36 (via GitHub)" <gi...@apache.org>.
kdn36 commented on PR #633:
URL: https://github.com/apache/arrow-rs-object-store/pull/633#issuecomment-3873523812

   On performance: 
   (1) On a local dev machine (minio same-host, backed by memory tmpfs, so no IO latency), the time to sink 2.3 GB drops from ~1.7s (SHA256) to ~1.3s (CRC64NVME).
   (2) On AWS, using a high-end instance (100 Gbps NIC), on standard S3, we are pushing almost 2 GB/s write for a 11.2 GB file. Results (in seconds, sorted by median)
   ```
   Checksum Type | Best    | Median | Worst
   --------------|---------|--------|-------
   unsigned      | 5.22    | 7.14   | 8.41
   crc64nvme     | 4.41    | 7.32   | 8.95
   sha256        | 5.35    | 7.83   | 9.57
   default       | 5.54    | 8.20   | 10.51
   ```
   (where defaults = signed + sha256 checksum, unsigned = not signed no checksum, sha256 = not signed but sha256 checksum, and crc64nvme = not signed but crc64nvme checksum).
   Note that the results on AWS have high variance, which is not unexpected given that this is in a shared production environment. The results are less pronounced because of IO, but keep in mind we keep optimizing the IO stack.
   
   


-- 
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: github-unsubscribe@arrow.apache.org

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


Re: [PR] Add CRC64NVME checksum support [arrow-rs-object-store]

Posted by "crepererum (via GitHub)" <gi...@apache.org>.
crepererum commented on PR #633:
URL: https://github.com/apache/arrow-rs-object-store/pull/633#issuecomment-3871859606

   Well, it was a suggestion, but it's not a hill I'm gonna die on though :wink: 


-- 
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: github-unsubscribe@arrow.apache.org

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


Re: [PR] Add CRC64NVME checksum support [arrow-rs-object-store]

Posted by "crepererum (via GitHub)" <gi...@apache.org>.
crepererum commented on code in PR #633:
URL: https://github.com/apache/arrow-rs-object-store/pull/633#discussion_r2769013746


##########
Cargo.toml:
##########
@@ -47,6 +47,7 @@ walkdir = { version = "2", optional = true }
 
 # Cloud storage support
 base64 = { version = "0.22", default-features = false, features = ["std"], optional = true }
+crc-fast = { version = "1.10" }

Review Comment:
   ```suggestion
   crc-fast = { version = "1.10", optional = true }
   ```



##########
src/aws/client.rs:
##########
@@ -708,30 +734,52 @@ impl S3Client {
         }
 
         let (parts, body) = request.send().await?.into_parts();
-        let (e_tag, checksum_sha256) = if is_copy {
+        let (e_tag, checksum_sha256, checksum_crc64nvme) = if is_copy {
             let response = body
                 .bytes()
                 .await
                 .map_err(|source| Error::CreateMultipartResponseBody { source })?;
             let response: CopyPartResult = quick_xml::de::from_reader(response.reader())
                 .map_err(|source| Error::InvalidMultipartResponse { source })?;
-            (response.e_tag, response.checksum_sha256)
+            (
+                response.e_tag,
+                response.checksum_sha256,
+                response.checksum_crc64nvme,
+            )
         } else {
             let e_tag = get_etag(&parts.headers).map_err(|source| Error::Metadata { source })?;
             let checksum_sha256 = parts
                 .headers
                 .get(SHA256_CHECKSUM)
                 .and_then(|v| v.to_str().ok())
                 .map(|v| v.to_string());
-            (e_tag, checksum_sha256)
+            let checksum_crc64nvme = parts
+                .headers
+                .get(CRC64NVME_CHECKSUM)
+                .and_then(|v| v.to_str().ok())
+                .map(|v| v.to_string());
+            (e_tag, checksum_sha256, checksum_crc64nvme)
         };
 
-        let content_id = if self.config.checksum == Some(Checksum::SHA256) {
-            let meta = PartMetadata {
-                e_tag,
-                checksum_sha256,
-            };
-            quick_xml::se::to_string(&meta).unwrap()
+        let content_id = if let Some(checksum) = self.config.checksum {

Review Comment:
   So `copy` can read both checksum but will only write/propagate one?



##########
Cargo.toml:
##########


Review Comment:
   ```suggestion
   aws = ["cloud", "crc-fast", "md-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: github-unsubscribe@arrow.apache.org

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


Re: [PR] Add CRC64NVME checksum support [arrow-rs-object-store]

Posted by "kdn36 (via GitHub)" <gi...@apache.org>.
kdn36 commented on code in PR #633:
URL: https://github.com/apache/arrow-rs-object-store/pull/633#discussion_r2784100082


##########
src/aws/checksum.rs:
##########
@@ -24,12 +24,15 @@ use std::str::FromStr;
 pub enum Checksum {

Review Comment:
   Great point. Changed to `#[non-exhaustive]`. If this goes through, adding more algorithm variants should be straightforward.



-- 
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: github-unsubscribe@arrow.apache.org

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


Re: [PR] Add CRC64NVME checksum support [arrow-rs-object-store]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #633:
URL: https://github.com/apache/arrow-rs-object-store/pull/633#issuecomment-4421092572

   @crepererum do you have time to review this PR?


-- 
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: github-unsubscribe@arrow.apache.org

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


Re: [PR] Add CRC64NVME checksum support [arrow-rs-object-store]

Posted by "kdn36 (via GitHub)" <gi...@apache.org>.
kdn36 commented on code in PR #633:
URL: https://github.com/apache/arrow-rs-object-store/pull/633#discussion_r2784040992


##########
Cargo.toml:
##########
@@ -47,6 +47,7 @@ walkdir = { version = "2", optional = true }
 
 # Cloud storage support
 base64 = { version = "0.22", default-features = false, features = ["std"], optional = true }
+crc-fast = { version = "1.10" }

Review Comment:
   Done. Note I had to choose a lower version (1.6.0) to ensure compatibility with the strict version control by `aws-sdk-s3` (outside of object_store).



-- 
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: github-unsubscribe@arrow.apache.org

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


Re: [PR] Add CRC64NVME checksum support [arrow-rs-object-store]

Posted by "orlp (via GitHub)" <gi...@apache.org>.
orlp commented on PR #633:
URL: https://github.com/apache/arrow-rs-object-store/pull/633#issuecomment-3854301124

   But to put some *paper napkin* numbers to this... Due to the way the code is currently architectured (this might be fundamental if the hash has to be in the header, I don't know about that), the hash must be known before the object is uploaded. This means hashing time is added to upload time.
   
   SHA256 with hardware acceleration on Intel seems to be around 2GB / sec (may vary a bit depending on machine, but let's assume this). So hashing 4GB takes 2 seconds. [`crc-fast-rust`](https://github.com/awesomized/crc-fast-rust) claims speeds of 100+ GB/s. So let's assume 100GB / s, in which case hashing 4GB takes 0.04 seconds.
   
   With a 10 Gbit / s connection uploading a 4GB object takes 3.2 seconds. So the total time taken:
   
    - SHA256: 5.2 seconds.
    - CRC64NVME: 3.24 seconds.


-- 
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: github-unsubscribe@arrow.apache.org

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


Re: [PR] Add CRC64NVME checksum support [arrow-rs-object-store]

Posted by "crepererum (via GitHub)" <gi...@apache.org>.
crepererum commented on PR #633:
URL: https://github.com/apache/arrow-rs-object-store/pull/633#issuecomment-4197958234

   I'm still confused about the copy behavior, see https://github.com/apache/arrow-rs-object-store/pull/633/changes#r3044086641


-- 
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: github-unsubscribe@arrow.apache.org

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


Re: [PR] Add CRC64NVME checksum support [arrow-rs-object-store]

Posted by "kdn36 (via GitHub)" <gi...@apache.org>.
kdn36 commented on PR #633:
URL: https://github.com/apache/arrow-rs-object-store/pull/633#issuecomment-4419495786

   Checking in - anything still needed from me for this PR?


-- 
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: github-unsubscribe@arrow.apache.org

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


Re: [PR] Add CRC64NVME checksum support [arrow-rs-object-store]

Posted by "kdn36 (via GitHub)" <gi...@apache.org>.
kdn36 commented on code in PR #633:
URL: https://github.com/apache/arrow-rs-object-store/pull/633#discussion_r3044762779


##########
src/aws/client.rs:
##########
@@ -708,30 +734,52 @@ impl S3Client {
         }
 
         let (parts, body) = request.send().await?.into_parts();
-        let (e_tag, checksum_sha256) = if is_copy {
+        let (e_tag, checksum_sha256, checksum_crc64nvme) = if is_copy {
             let response = body
                 .bytes()
                 .await
                 .map_err(|source| Error::CreateMultipartResponseBody { source })?;
             let response: CopyPartResult = quick_xml::de::from_reader(response.reader())
                 .map_err(|source| Error::InvalidMultipartResponse { source })?;
-            (response.e_tag, response.checksum_sha256)
+            (
+                response.e_tag,
+                response.checksum_sha256,
+                response.checksum_crc64nvme,
+            )
         } else {
             let e_tag = get_etag(&parts.headers).map_err(|source| Error::Metadata { source })?;
             let checksum_sha256 = parts
                 .headers
                 .get(SHA256_CHECKSUM)
                 .and_then(|v| v.to_str().ok())
                 .map(|v| v.to_string());
-            (e_tag, checksum_sha256)
+            let checksum_crc64nvme = parts
+                .headers
+                .get(CRC64NVME_CHECKSUM)
+                .and_then(|v| v.to_str().ok())
+                .map(|v| v.to_string());
+            (e_tag, checksum_sha256, checksum_crc64nvme)
         };
 
-        let content_id = if self.config.checksum == Some(Checksum::SHA256) {
-            let meta = PartMetadata {
-                e_tag,
-                checksum_sha256,
-            };
-            quick_xml::se::to_string(&meta).unwrap()
+        let content_id = if let Some(checksum) = self.config.checksum {

Review Comment:
   Updated. I was (falsely) assuming an unncessary level of strictness for the checkusm configuration setting.
   



-- 
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: github-unsubscribe@arrow.apache.org

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


Re: [PR] Add CRC64NVME checksum support [arrow-rs-object-store]

Posted by "kdn36 (via GitHub)" <gi...@apache.org>.
kdn36 commented on PR #633:
URL: https://github.com/apache/arrow-rs-object-store/pull/633#issuecomment-4197726312

   Is there an option to trigger a CI test run ourselves? If not, would someone mind triggering a test run? Thanks!


-- 
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: github-unsubscribe@arrow.apache.org

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


Re: [PR] Add CRC64NVME checksum support [arrow-rs-object-store]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #633:
URL: https://github.com/apache/arrow-rs-object-store/pull/633#discussion_r2769529134


##########
src/aws/checksum.rs:
##########
@@ -24,12 +24,15 @@ use std::str::FromStr;
 pub enum Checksum {
     /// SHA-256 algorithm.
     SHA256,
+    /// CRC64-NVME algorithm.
+    CRC64NVME,

Review Comment:
   Yeah, we would have to wait for the next breaking object store release. We could discuss making such a change and quickly release 0.14 (next breaking change) if needed



##########
src/aws/checksum.rs:
##########
@@ -24,12 +24,15 @@ use std::str::FromStr;
 pub enum Checksum {

Review Comment:
   I double checked and indeed CRC64NVME seems to be the default suggestion:
   
    https://docs.aws.amazon.com/AmazonS3/latest/userguide/checking-object-integrity.html
   
   Seems like it was added to the official SDK about a year ago:
   - https://github.com/awslabs/aws-sdk-rust/issues/1240



-- 
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: github-unsubscribe@arrow.apache.org

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


Re: [PR] Add CRC64NVME checksum support [arrow-rs-object-store]

Posted by "crepererum (via GitHub)" <gi...@apache.org>.
crepererum commented on PR #633:
URL: https://github.com/apache/arrow-rs-object-store/pull/633#issuecomment-3854952440

   Regarding the crate of choice: Since we -- I think -- have decided that this is a breaking change, I think we should merge this AFTER #585 and hook up the crc calculation into the crypto provider framework.


-- 
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: github-unsubscribe@arrow.apache.org

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


Re: [PR] Add CRC64NVME checksum support [arrow-rs-object-store]

Posted by "orlp (via GitHub)" <gi...@apache.org>.
orlp commented on code in PR #633:
URL: https://github.com/apache/arrow-rs-object-store/pull/633#discussion_r2795759681


##########
src/aws/client.rs:
##########
@@ -398,19 +400,40 @@ impl Request<'_> {
     }
 
     pub(crate) fn with_payload(mut self, payload: PutPayload) -> Self {
-        if (!self.config.skip_signature && self.config.sign_payload)
-            || self.config.checksum.is_some()
-        {
+        let needs_sha256_for_signing = !self.config.skip_signature && self.config.sign_payload;
+        let needs_sha256_for_checksum = matches!(self.config.checksum, Some(Checksum::SHA256));
+
+        let sha256_digest = if needs_sha256_for_signing || needs_sha256_for_checksum {

Review Comment:
   An idea but rather than doing this whole check beforehand with an `Option`, I think you can just do
   ```rust
   use std::cell::LazyCell;
   
   let sha256_digest = LazyCell::new(|| {
       let mut sha256 = Context::new(&digest::SHA256);
       for part in &payload {
           sha256.update(part);
       }
       sha256.finish()
   });
   
   
   if !self.config.skip_signature && self.config.sign_payload {
       self.payload_sha256 = *sha256_digest;
   }
   
   
   match self.config.checksum {
       Some(Checksum::SHA256) => {
           self.builder = self.builder.header(
               SHA256_CHECKSUM,
               BASE64_STANDARD.encode(*sha256_digest),
           );
       }
   ```



##########
src/aws/client.rs:
##########
@@ -43,6 +43,7 @@ use async_trait::async_trait;
 use base64::Engine;
 use base64::prelude::BASE64_STANDARD;
 use bytes::{Buf, Bytes};
+use crc_fast;

Review Comment:
   This `use` is... useless 😅 



-- 
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: github-unsubscribe@arrow.apache.org

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


Re: [PR] Add CRC64NVME checksum support [arrow-rs-object-store]

Posted by "kdn36 (via GitHub)" <gi...@apache.org>.
kdn36 commented on PR #633:
URL: https://github.com/apache/arrow-rs-object-store/pull/633#issuecomment-4022865414

   Do we have an eta for the release? Thanks!


-- 
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: github-unsubscribe@arrow.apache.org

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


Re: [PR] Add CRC64NVME checksum support [arrow-rs-object-store]

Posted by "orlp (via GitHub)" <gi...@apache.org>.
orlp commented on PR #633:
URL: https://github.com/apache/arrow-rs-object-store/pull/633#issuecomment-3854182244

   @alamb I don't have any publicly available benchmarks, but @kdn36 measured that for one of our workflows in Polars Cloud it saved 25% *end-to-end*.


-- 
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: github-unsubscribe@arrow.apache.org

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


Re: [PR] Add CRC64NVME checksum support [arrow-rs-object-store]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #633:
URL: https://github.com/apache/arrow-rs-object-store/pull/633#issuecomment-3854655305

   I did some research on this crc-fast crate: https://crates.io/crates/crc-fast
   
   It does look primarily the work of one individual which is always a little concerning from a maintainability perspective: https://github.com/awesomized/crc-fast-rust
   
   However it seems that the official aws sdk uses this crate (via [aws-smithy-checksums](https://crates.io/crates/aws-smithy-checksums)  which is a pretty good endorsement in my mind https://crates.io/crates/crc-fast/reverse_dependencies
   
   Thus I think it is ok to add it as a dependency


-- 
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: github-unsubscribe@arrow.apache.org

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


Re: [PR] Add CRC64NVME checksum support [arrow-rs-object-store]

Posted by "orlp (via GitHub)" <gi...@apache.org>.
orlp commented on code in PR #633:
URL: https://github.com/apache/arrow-rs-object-store/pull/633#discussion_r2770278559


##########
src/aws/checksum.rs:
##########
@@ -24,12 +24,15 @@ use std::str::FromStr;
 pub enum Checksum {

Review Comment:
   @alamb If the enum is marked as `#[non_exhaustive]` as I recommended above then adding new variants isn't a breaking change. I personally don't think it's a good idea to add variants which aren't actually supported.



-- 
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: github-unsubscribe@arrow.apache.org

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


Re: [PR] Add CRC64NVME checksum support [arrow-rs-object-store]

Posted by "orlp (via GitHub)" <gi...@apache.org>.
orlp commented on PR #633:
URL: https://github.com/apache/arrow-rs-object-store/pull/633#issuecomment-3855052387

   @crepererum I don't see why, CRC has nothing to do with cryptography.


-- 
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: github-unsubscribe@arrow.apache.org

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


Re: [PR] Add CRC64NVME checksum support [arrow-rs-object-store]

Posted by "kdn36 (via GitHub)" <gi...@apache.org>.
kdn36 commented on PR #633:
URL: https://github.com/apache/arrow-rs-object-store/pull/633#issuecomment-4198770085

   > I'm still confused about the copy behavior, see https://github.com/apache/arrow-rs-object-store/pull/633/changes#r3044086641
   
   Updated after re-review.
   
   Note and fwiw, I oberved different behavior between AWS and Localstack, in that AWS will add a Checksum header for the Copy path, but Localstack will not.
   
   With
   ```
   $ cargo test --features aws copy_multipart_file_with_signature -- --no-capture
   ```
   
   AWS:
   ```
   $ cat debug_aws.out
   running 2 tests
   [src/aws/client.rs:714:9] "start put_part" = "start put_part"
   [src/aws/client.rs:769:9] &checksum_sha256 = Some(
       "kZLCW3NPy62+MtrcKAicYNsOOfkMwgzi5XM/VyYazAw=",
   )
   [src/aws/client.rs:770:9] &checksum_crc64nvme = None
   [src/aws/client.rs:714:9] "start put_part" = "start put_part"
   [src/aws/client.rs:769:9] &checksum_sha256 = None
   [src/aws/client.rs:770:9] &checksum_crc64nvme = Some(
       "m0nypWpUsto=",
   )
   test aws::tests::copy_multipart_file_with_signature_change_checksum ... ok
   [src/aws/client.rs:714:9] "start put_part" = "start put_part"
   [src/aws/client.rs:769:9] &checksum_sha256 = None
   [src/aws/client.rs:770:9] &checksum_crc64nvme = Some(
       "m0nypWpUsto=",
   )
   test aws::tests::copy_multipart_file_with_signature ... ok
   ```
   Localstack:
   ```
   $ cat debug_localstack.out
   running 2 tests
   [src/aws/client.rs:714:9] "start put_part" = "start put_part"
   [src/aws/client.rs:769:9] &checksum_sha256 = None
   [src/aws/client.rs:770:9] &checksum_crc64nvme = None
   [src/aws/client.rs:714:9] "start put_part" = "start put_part"
   [src/aws/client.rs:769:9] &checksum_sha256 = None
   [src/aws/client.rs:770:9] &checksum_crc64nvme = None
   test aws::tests::copy_multipart_file_with_signature_change_checksum ... ok
   [src/aws/client.rs:714:9] "start put_part" = "start put_part"
   [src/aws/client.rs:769:9] &checksum_sha256 = None
   [src/aws/client.rs:770:9] &checksum_crc64nvme = None
   test aws::tests::copy_multipart_file_with_signature ... ok
   ```


-- 
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: github-unsubscribe@arrow.apache.org

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


Re: [PR] Add CRC64NVME checksum support [arrow-rs-object-store]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #633:
URL: https://github.com/apache/arrow-rs-object-store/pull/633#discussion_r2769997473


##########
src/aws/checksum.rs:
##########
@@ -24,12 +24,15 @@ use std::str::FromStr;
 pub enum Checksum {

Review Comment:
   If we are going to change the enum, perhaps we can add all the other supported checksums as well (we don't have to actually support them, but we can minimize API churn)
   
   
   I think that would mean adding the following variants (with comments that they aren't yet supported)
   
   CRC32
   CRC32C
   SHA1
   MD5



-- 
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: github-unsubscribe@arrow.apache.org

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


Re: [PR] Add CRC64NVME checksum support [arrow-rs-object-store]

Posted by "crepererum (via GitHub)" <gi...@apache.org>.
crepererum commented on PR #633:
URL: https://github.com/apache/arrow-rs-object-store/pull/633#issuecomment-3876806295

   OK, I think the impl. is good, the choice of the CRC crate is OK (I mean we can always change it, it's not part of the public API), and I do agree that for some users the perf win is a worth it. Now sadly this is a breaking change and hence I would like to wait until the next major release. Since we don't have a super strict release schedule: how urgent do you need this?


-- 
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: github-unsubscribe@arrow.apache.org

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


Re: [PR] Add CRC64NVME checksum support [arrow-rs-object-store]

Posted by "kdn36 (via GitHub)" <gi...@apache.org>.
kdn36 commented on PR #633:
URL: https://github.com/apache/arrow-rs-object-store/pull/633#issuecomment-3883046006

   Thank you for your support.
   
   We would like to see it as soon as we can reasonably get it; without taking on excessive risk or effort. For context, IO is critical for our distributed query performance and an area of active development.


-- 
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: github-unsubscribe@arrow.apache.org

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


Re: [PR] Add CRC64NVME checksum support [arrow-rs-object-store]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on PR #633:
URL: https://github.com/apache/arrow-rs-object-store/pull/633#issuecomment-4040729908

   > Do we have an eta for the release? Thanks!
   
   Since it adds an API change it looks to me like this PR will have to wait for the next major release . It seems like @crepererum  is tracking with
   - https://github.com/apache/arrow-rs-object-store/issues/657
   
   


-- 
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: github-unsubscribe@arrow.apache.org

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


Re: [PR] Add CRC64NVME checksum support [arrow-rs-object-store]

Posted by "crepererum (via GitHub)" <gi...@apache.org>.
crepererum merged PR #633:
URL: https://github.com/apache/arrow-rs-object-store/pull/633


-- 
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: github-unsubscribe@arrow.apache.org

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


Re: [PR] Add CRC64NVME checksum support [arrow-rs-object-store]

Posted by "alamb (via GitHub)" <gi...@apache.org>.
alamb commented on code in PR #633:
URL: https://github.com/apache/arrow-rs-object-store/pull/633#discussion_r2770496281


##########
src/aws/checksum.rs:
##########
@@ -24,12 +24,15 @@ use std::str::FromStr;
 pub enum Checksum {

Review Comment:
   Marking it as `#[non_exhaustive]` would also be fine
   
   (my rationale to add Variants that are not supported was to 🎣  for help supporting them)



-- 
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: github-unsubscribe@arrow.apache.org

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


Re: [PR] Add CRC64NVME checksum support [arrow-rs-object-store]

Posted by "orlp (via GitHub)" <gi...@apache.org>.
orlp commented on code in PR #633:
URL: https://github.com/apache/arrow-rs-object-store/pull/633#discussion_r2758457570


##########
src/aws/checksum.rs:
##########
@@ -24,12 +24,15 @@ use std::str::FromStr;
 pub enum Checksum {
     /// SHA-256 algorithm.
     SHA256,
+    /// CRC64-NVME algorithm.
+    CRC64NVME,

Review Comment:
   This is *technically* a breaking change because this enum was (erroneously IMO) not marked as `#[non_exhaustive]`. It's up to the maintainer - I personally don't believe anyone is matching on `Checksum`, it would only break code that currently does such a match.
   
   But @kdn36 you should definitely mark this enum as `#[non_exhaustive]`.



-- 
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: github-unsubscribe@arrow.apache.org

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


Re: [PR] Add CRC64NVME checksum support [arrow-rs-object-store]

Posted by "crepererum (via GitHub)" <gi...@apache.org>.
crepererum commented on PR #633:
URL: https://github.com/apache/arrow-rs-object-store/pull/633#issuecomment-3860201772

   > I don't see why, CRC has nothing to do with cryptography.
   
   If you look at the PR, the abstraction for algorithms that that is in there could be extended to cover CRC as well and may provide people an easier way to pick whatever crc lib they want. The discussion above makes it clear that there isn't such an obvious choice on that front anyways.


-- 
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: github-unsubscribe@arrow.apache.org

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


Re: [PR] Add CRC64NVME checksum support [arrow-rs-object-store]

Posted by "orlp (via GitHub)" <gi...@apache.org>.
orlp commented on PR #633:
URL: https://github.com/apache/arrow-rs-object-store/pull/633#issuecomment-3862435177

   @crepererum There are legitimate reasons for wanting to choose your crypto provider (you're already using provider X, you only trust provider X, you have security certification for provider X, etc). Especially the last one is important.
   
   For CRC only the first reason is applicable, and I don't think that's good enough of a reason by itself. Plus, again, CRC isn't a cryptographic algorithm and thus has no place in a crypto provider.


-- 
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: github-unsubscribe@arrow.apache.org

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


Re: [PR] Add CRC64NVME checksum support [arrow-rs-object-store]

Posted by "kdn36 (via GitHub)" <gi...@apache.org>.
kdn36 commented on code in PR #633:
URL: https://github.com/apache/arrow-rs-object-store/pull/633#discussion_r2784091778


##########
src/aws/client.rs:
##########
@@ -708,30 +734,52 @@ impl S3Client {
         }
 
         let (parts, body) = request.send().await?.into_parts();
-        let (e_tag, checksum_sha256) = if is_copy {
+        let (e_tag, checksum_sha256, checksum_crc64nvme) = if is_copy {
             let response = body
                 .bytes()
                 .await
                 .map_err(|source| Error::CreateMultipartResponseBody { source })?;
             let response: CopyPartResult = quick_xml::de::from_reader(response.reader())
                 .map_err(|source| Error::InvalidMultipartResponse { source })?;
-            (response.e_tag, response.checksum_sha256)
+            (
+                response.e_tag,
+                response.checksum_sha256,
+                response.checksum_crc64nvme,
+            )
         } else {
             let e_tag = get_etag(&parts.headers).map_err(|source| Error::Metadata { source })?;
             let checksum_sha256 = parts
                 .headers
                 .get(SHA256_CHECKSUM)
                 .and_then(|v| v.to_str().ok())
                 .map(|v| v.to_string());
-            (e_tag, checksum_sha256)
+            let checksum_crc64nvme = parts
+                .headers
+                .get(CRC64NVME_CHECKSUM)
+                .and_then(|v| v.to_str().ok())
+                .map(|v| v.to_string());
+            (e_tag, checksum_sha256, checksum_crc64nvme)
         };
 
-        let content_id = if self.config.checksum == Some(Checksum::SHA256) {
-            let meta = PartMetadata {
-                e_tag,
-                checksum_sha256,
-            };
-            quick_xml::se::to_string(&meta).unwrap()
+        let content_id = if let Some(checksum) = self.config.checksum {

Review Comment:
   I am no expert, but as I understand, we do not send a checksum on copy (write) since we do not have the bytes to calculate one. We do collect the response checksum(s), but only retain them if they match the configured checksum algorithm (we could also raise a warning or error, I think). The use case of specifying a checksum algorithm on copy is to change the checksum metadata as stored in S3.
   
   However, I failed to properly test this locally, as minio does not properly support checksums on multipart copy. Instead, it errors out (https://github.com/minio/minio/issues/17013).
   
   Testing in CI and directly on AWS works as expected.
   
   I added a test case where we modify the checksum algorithm as part of a copy. That works as expected. Unfortunately I could only verify this manually as I could not find an easy way to obtain the checksum metadata for programmatic verification (a simple `head()..meta` does not contain this metdata).
   
   Again, I am new to this, and will happily stand corrected.
   



-- 
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: github-unsubscribe@arrow.apache.org

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