Skip to content

Conversation

@ashishkumar50
Copy link
Contributor

What changes were proposed in this pull request?

Support ByteBufferPositionedReadable in OzoneFSInputStream.
This will benefit HBase read.

What is the link to the Apache JIRA

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

How was this patch tested?

New integration test

@ashishkumar50 ashishkumar50 added the hbase HBase on Ozone support label Mar 13, 2024
@ashishkumar50 ashishkumar50 marked this pull request as draft March 13, 2024 08:37
@ashishkumar50 ashishkumar50 marked this pull request as ready for review March 13, 2024 14:27
Copy link
Contributor

@jojochuang jojochuang left a comment

Choose a reason for hiding this comment

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

Looks functionally correct. Need a closer look to make sure it doesn't send extra readChunk requests and so on which degrades performance.

We should also update stream capability: add

case StreamCapabilities.PREADBYTEBUFFER:

here:
https://github.com/apache/ozone/blob/master/hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/CapableOzoneFSInputStream.java#L37

* @see #read(long, ByteBuffer)
*/
void readFully(long position, ByteBuffer buf) throws IOException;
}
Copy link
Contributor

@ChenSammi ChenSammi Mar 14, 2024

Choose a reason for hiding this comment

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

We will use the ByteBufferPositionedReadable interface defined in hadoop-common directly. This file can be removed. Is there dependency problem for this?

Copy link
Contributor

Choose a reason for hiding this comment

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

The problem is that some of the acceptance tests run with Hadoop 3.2 runtime which does not have this API.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This interface is added in Hadoop 3.3, so the older hadoop version client fails to load ozone fs jar. This file can be removed when we drop support for older hadoop version.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. Oh, there are comments explaining this.


// Buffer size more than actual data, still read should succeed
ByteBuffer buffer1 = ByteBuffer.allocate(30 * 1024 * 1024 * 2);
readBytes = inputStream.read(12, buffer1);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add readBytes check, to make sure the bytes read value is as expected?

Copy link
Contributor

@ChenSammi ChenSammi Mar 14, 2024

Choose a reason for hiding this comment

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

Also can you add

  1. file position check, make sure file position is not changed after read or readFully.
  2. boundary check, such as illegal position value.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

Copy link
Contributor

@ChenSammi ChenSammi left a comment

Choose a reason for hiding this comment

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

The last patch looks good to me. Thanks @ashishkumar50 .

@jojochuang jojochuang merged commit 825c340 into apache:HDDS-7593 Mar 15, 2024
@jojochuang
Copy link
Contributor

Thanks @ashishkumar50 @ChenSammi

@jojochuang
Copy link
Contributor

Confirmed it's being used by Apache HBase 2.5.0 and above.

chungen0126 pushed a commit to chungen0126/ozone that referenced this pull request May 3, 2024
chungen0126 pushed a commit to chungen0126/ozone that referenced this pull request May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hbase HBase on Ozone support

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants