adoroszlai commented on code in PR #10347:
URL: https://github.com/apache/ozone/pull/10347#discussion_r3320207764


##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmMultipartPartKey.java:
##########
@@ -178,18 +182,21 @@ private OmMultipartPartKey fromByteBuffer(ByteBuffer 
rawData)
 
       int separatorIndex = start + length - suffixLength - 1;
       if (separatorIndex < start) {
-        throw new IllegalArgumentException(
+        throw new CodecException(
             "Invalid multipart part key: invalid separator position");
       }
       final ByteBuffer uploadIdBuffer = input.duplicate();
       uploadIdBuffer.limit(separatorIndex);
       uploadIdBuffer.position(start);
-      String uploadId = 
StandardCharsets.UTF_8.decode(uploadIdBuffer).toString();
+      byte[] uploadIdBytes = new byte[uploadIdBuffer.remaining()];
+      uploadIdBuffer.get(uploadIdBytes);
+      String uploadId = StringCodec.getCodecNoFallback()
+          .fromPersistedFormat(uploadIdBytes);

Review Comment:
   @szetszwo Can we use `StringCodecBase.decodeNoFallback(ByteBuffer)` 
directly, to avoid buffer copy?
   
   
https://github.com/apache/ozone/blob/cfb8adea488da08a56f75acf46011574325482aa/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/utils/db/StringCodecBase.java#L199-L200
   
   
https://github.com/apache/ozone/blob/cfb8adea488da08a56f75acf46011574325482aa/hadoop-hdds/common/src/main/java/org/apache/hadoop/hdds/utils/db/StringCodecBase.java#L115-L117



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