Skip to content

Commit

Permalink
Remove extra copy when decompressing data page with encryption on (ap…
Browse files Browse the repository at this point in the history
  • Loading branch information
sunchao authored and parthchandra committed May 11, 2022
1 parent 0a2c831 commit 9fbda8d
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,12 @@ public DataPage readPage() {
public DataPage visit(DataPageV1 dataPageV1) {
try {
BytesInput bytes = dataPageV1.getBytes();
ByteBuffer byteBuffer = bytes.toByteBuffer();
long compressedSize = bytes.size();

if (null != blockDecryptor) {
ByteBuffer byteBuffer;
if (blockDecryptor == null) {
byteBuffer = bytes.toByteBuffer();
} else {
byte[] decrypted = blockDecryptor.decrypt(bytes.toByteArray(), dataPageAAD);
compressedSize = decrypted.length;
byteBuffer = ByteBuffer.allocateDirect((int) compressedSize);
Expand Down

0 comments on commit 9fbda8d

Please sign in to comment.