Huang Kuan Hao created HDDS-17926:
-------------------------------------

             Summary: Persist and return validated trailing checksums for S3 
PutObject
                 Key: HDDS-17926
                 URL: https://issues.apache.org/jira/browse/HDDS-17926
             Project: Apache Ozone
          Issue Type: Improvement
          Components: S3
            Reporter: Huang Kuan Hao


HDDS-16660 validates a trailing checksum against the decoded upload before 
commit. The value is unavailable to a client downloading the object later. 
HDDS-16053 added {{GetObjectAttributes}} and deferred its {{Checksum}} 
attribute. Persisting the verified value would let an S3 client check a full 
download. [Ozone checksum 
storage|https://ozone.apache.org/docs/next/system-internals/components/s3-gateway/chunked-uploads/#checksum-storage]

h3. Proposed design

For a single {{PutObject}}, pass the verified algorithm and digest bytes in the 
existing final {{CommitKey}} request. Store them in an optional S3-specific 
field of the committed {{KeyInfo}}, separate from user metadata. Cover signed 
and unsigned checksum trailers on regular and Ratis datastream writes, 
including zero-byte files. The supported algorithms are CRC32, CRC32C, 
CRC64NVME, SHA1 and SHA256.

Gate the new field on the finalized OM feature version. Until OM advertises 
support, S3 Gateway validates the trailer and omits the checksum from the PUT 
response.

h3. S3 responses

* On a successful {{PutObject}} with a verified trailer, return the matching 
{{x-amz-checksum-<algorithm>}} header in Base64 and {{x-amz-checksum-type: 
FULL_OBJECT}}. 
[PutObject|https://docs.aws.amazon.com/AmazonS3/latest/API/API_PutObject.html]
* On whole-object {{GetObject}} and {{HeadObject}}, return the same headers 
when {{x-amz-checksum-mode: ENABLED}} is requested. Omit them on {{Range}} and 
{{partNumber}} requests in this first change.
* When {{GetObjectAttributes}} requests {{Checksum}}, return the matching 
algorithm element and {{ChecksumType}} inside {{Checksum}}, including when 
{{ObjectParts}} is also requested. Use the existing key lookups for GET, HEAD 
and attributes. Omit checksum fields when the object has no stored value or the 
read does not request one. 
[GetObjectAttributes|https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObjectAttributes.html]

h3. Acceptance

* In OBS and FSO, a rejected overwrite leaves the previous object and checksum 
readable. A successful replacement uses the new write's checksum, if present. 
Keys published by native {{hsync}}, lease recovery or multipart completion 
carry no S3 checksum in this change. Metadata-only updates retain it.
* Upload the nine ASCII bytes {{123456789}} with a CRC32C trailer. After an OM 
restart, check that HEAD, attributes and a full SDK GET return {{4waSgw==}}. 
Read the GET to EOF and independently calculate CRC32C from the downloaded 
bytes.

Scope this change to file objects created by a trailer PUT. FSO directory 
creation and copy destinations omit the checksum. Multipart checksum 
composition, checksum inheritance on copy, and checksums supplied as ordinary 
upload headers are follow-up work.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to