taklwu commented on code in PR #11245:
URL: https://github.com/apache/ozone/pull/11245#discussion_r4066793227


##########
hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/OzoneFSInputStream.java:
##########
@@ -211,4 +225,101 @@ public void readFully(long position, ByteBuffer buf) 
throws IOException {
       }
     }
   }
+
+  /**
+   * Byte-array positioned read. Tries the native stateless {@link 
ExtendedInputStream#readFully}
+   * path first (via a zero-copy {@link ByteBuffer#wrap}). Falls back to a 
synchronized
+   * seek-read-restore using byte-array {@link #read(byte[], int, int)} so 
that the fallback
+   * works for any {@link Seekable} stream, not just those that also implement
+   * {@link org.apache.hadoop.fs.ByteBufferReadable}.
+   * <p>
+   * {@link FSInputStream} synchronizes its inherited implementation on {@code 
this}, a different
+   * monitor from {@code positionedReadLock}; without this override the two 
APIs can interleave.
+   */
+  @Override
+  public int read(long position, byte[] buffer, int offset, int length) throws 
IOException {

Review Comment:
   for GDPRSymmetricKey aka Non-encrypted GDPR inputstream in [RpcClient line 
2680](https://github.com/apache/ozone/blob/master/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java#L2680-L2682),
  `RpcClient.createInputStream` -> `new OzoneInputStream(
       new CipherInputStream(lengthInputStream, gk.getCipher()))` where 
`CipherInputStream` does not support `ByteBufferReadable`
   
   so, should we keep the `readAtPositionSeekRestoreByteArray`?
   
   



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to