szetszwo commented on code in PR #4572:
URL: https://github.com/apache/ozone/pull/4572#discussion_r1194729245
##########
hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/helpers/OmMultipartKeyInfo.java:
##########
@@ -257,10 +340,10 @@ public int hashCode() {
}
public OmMultipartKeyInfo copyObject() {
- // For partKeyInfoList we can do shallow copy here, as the PartKeyInfo is
- // immutable here.
+ // When PartKeyInfoMap is modified, a shallow copy will be created first,
+ // so here we can directly pass in partKeyInfoMap
Review Comment:
We should just mention that `PartKeyInfoMap` is immutable in the comment.
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/s3/multipart/S3MultipartUploadCompleteRequest.java:
##########
@@ -175,8 +175,10 @@ public OMClientResponse
validateAndUpdateCache(OzoneManager ozoneManager,
failureMessage(requestedVolume, requestedBucket, keyName),
OMException.ResultCodes.NO_SUCH_MULTIPART_UPLOAD_ERROR);
}
- TreeMap<Integer, PartKeyInfo> partKeyInfoMap =
- multipartKeyInfo.getPartKeyInfoMap();
+
+ TreeMap<Integer, PartKeyInfo> partKeyInfoMap = new TreeMap<>();
+ multipartKeyInfo.getPartKeyInfoMap().forEach(partKeyInfo ->
+ partKeyInfoMap.put(partKeyInfo.getPartNumber(), partKeyInfo));
Review Comment:
Please don't copy to a TreeMap for read only accesses. We should keep
passing `PartKeyInfoMap`.
--
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]