Skip to content

HDDS-12918. OM support byte range GET#10166

Open
ivandika3 wants to merge 8 commits intoapache:masterfrom
ivandika3:HDDS-12918
Open

HDDS-12918. OM support byte range GET#10166
ivandika3 wants to merge 8 commits intoapache:masterfrom
ivandika3:HDDS-12918

Conversation

@ivandika3
Copy link
Copy Markdown
Contributor

@ivandika3 ivandika3 commented May 1, 2026

What changes were proposed in this pull request?

Similar to HDDS-11699, we can move the byte range GET filter from S3G to the OM so that the network and serialization cost can be reduced for objects with a lot of blocks.

Applications like JuiceFS on S3 uses quite a bit of byte range fetch.

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-12918

How was this patch tested?

UT, IT.

@ivandika3 ivandika3 self-assigned this May 1, 2026
@ivandika3 ivandika3 changed the title HDDS-12918. HDDS-12918. OM support byte range GET May 1, 2026
@peterxcli peterxcli self-requested a review May 1, 2026 13:08
@ivandika3 ivandika3 marked this pull request as ready for review May 2, 2026 12:56
@ivandika3 ivandika3 requested a review from Gargi-jais11 May 2, 2026 13:20
Copy link
Copy Markdown
Contributor

@Gargi-jais11 Gargi-jais11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ivandika3 for the patch.
Please find inlined review comments

Comment on lines +1885 to +1886
int partNumber, long startOffset,
long endOffset) throws IOException {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Please use 4 indent space

Comment on lines +686 to +688
if (!filteredLocations.isEmpty()) {
keyInfo.setByteRangeStartOffset(byteRangeStart - firstBlockStart);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should also set keyInfo.setDataSize (byteRangeEnd - byteRangeStart + 1) as OzoneKeyDetails uses itRpcClient.getOzoneKeyDetails(...) does something like new OzoneKeyDetails(..., keyInfo.getDataSize(), ...).
If you don’t update dataSize after filtering, getDataSize() still looks like the whole object / whole part, while getContent() only covers some blocks — confusing and wrong for anything that uses getDataSize() for buffers, metrics etc.

Suggested change
if (!filteredLocations.isEmpty()) {
keyInfo.setByteRangeStartOffset(byteRangeStart - firstBlockStart);
}
if (!filteredLocations.isEmpty()) {
keyInfo.setByteRangeStartOffset(byteRangeStart - firstBlockStart);
}
keyInfo.setDataSize (byteRangeEnd - byteRangeStart + 1)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can also add test assert for dataSize in TestKeyManagerImpl to check if it is set correctly or not.

Copy link
Copy Markdown
Member

@peterxcli peterxcli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @ivandika3 for the patch, I'm looking if we could remove the setByteRangeStartOffset, calculate the start offset at s3g side, it take the first block of block list and use the range info from header to calculate the offset, then use the result as input stream's seek offset

* @return {@link OzoneKey}
* @throws IOException
*/
default OzoneKeyDetails getS3KeyDetails(String bucketName, String keyName,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why there is a implementation?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should sit in ClientProtocolStub.

Comment on lines +1105 to +1108
// Byte range requested by S3 GET. OM uses it to return only the
// key locations needed to satisfy the read.
optional uint64 byteRangeStart = 25;
optional uint64 byteRangeEnd = 26;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about introducing a common msg, I remember few DN-SCM pb messages have range concept, maybe we could reuse theirs?

message ByteRange {
  // Inclusive start and end offsets: [start, end].
  optional uint64 start = 1;
  optional uint64 end   = 2;
}

message KeyArgs {
  // ...
  optional ByteRange byteRange = 25;
}

keyArgs.getForceUpdateContainerCacheFromSCM())
.setMultipartUploadPartNumber(keyArgs.getMultipartNumber())
.build();
if (keyArgs.hasByteRangeStart() && keyArgs.hasByteRangeEnd()) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could become

Suggested change
if (keyArgs.hasByteRangeStart() && keyArgs.hasByteRangeEnd()) {
if (keyArgs.hasByteRange()) {

if we introduce new range message.
https://github.com/apache/ozone/pull/10166/changes#r3180692841

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants