smengcl commented on code in PR #11348:
URL: https://github.com/apache/ozone/pull/11348#discussion_r4211575001


##########
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestOzoneAtRestEncryption.java:
##########
@@ -672,6 +673,19 @@ private void testMultipartUploadWithEncryption(OzoneBucket 
bucket,
     try (OzoneInputStream inputStream = bucket.readKey(keyName)) {
 
       assertInstanceOf(MultipartInputStream.class, 
inputStream.getInputStream());
+      if (numParts == 2) {
+        inputStream.seek(123);
+        PositionedReadTestHelper.runConcurrentPositionedReads(inputData, 
inputStream::readFully);

Review Comment:
   nit: We could mix byte-array reads into this helper and add an explicit read 
across a crypto-buffer boundary. This currently calls only the ByteBuffer 
overload, and none of the helper's generated ranges crosses the default 8 KiB 
boundary.
   
   ```diff
   --- 
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestOzoneAtRestEncryption.java
   +++ 
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/client/rpc/TestOzoneAtRestEncryption.java
   @@ -317,7 +317,19 @@
        try (OzoneInputStream inputStream = bucket.readKey(keyName)) {
          assertInstanceOf(CryptoInputStream.class, 
inputStream.getInputStream());
          inputStream.seek(123);
   -      PositionedReadTestHelper.runConcurrentPositionedReads(data, 
inputStream::readFully);
   +      PositionedReadTestHelper.runConcurrentPositionedReads(data, (offset, 
buffer) -> {
   +        if ((offset & 1) == 0) {
   +          inputStream.readFully(offset, buffer);
   +        } else {
   +          byte[] bytes = new byte[buffer.remaining()];
   +          inputStream.readFully(offset, bytes);
   +          buffer.put(bytes);
   +        }
   +      });
   +      int offset = DEFAULT_CRYPTO_BUFFER_SIZE - 17;
   +      byte[] actual = new byte[DEFAULT_CRYPTO_BUFFER_SIZE + 37];
   +      inputStream.readFully(offset, actual);
   +      assertArrayEquals(Arrays.copyOfRange(data, offset, offset + 
actual.length), actual);
          assertEquals(123, inputStream.getPos());
          assertEquals(Byte.toUnsignedInt(data[123]), inputStream.read());
        }
   ```



-- 
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