ivandika3 commented on code in PR #8848:
URL: https://github.com/apache/ozone/pull/8848#discussion_r2249516191
##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/s3/multipart/S3MultipartUploadCommitPartRequest.java:
##########
@@ -220,16 +224,45 @@ public OMClientResponse
validateAndUpdateCache(OzoneManager ozoneManager, Execut
omBucketInfo = getBucketInfo(omMetadataManager, volumeName, bucketName);
+ // This map should contain maximum of two entries
+ // 1. Overwritten part
+ // 2. Uncommitted pseudo part key
+ Map<String, RepeatedOmKeyInfo> keyVersionsToDeleteMap = null;
+
long correctedSpace = omKeyInfo.getReplicatedSize();
if (null != oldPartKeyInfo) {
OmKeyInfo partKeyToBeDeleted =
OmKeyInfo.getFromProtobuf(oldPartKeyInfo.getPartKeyInfo());
correctedSpace -= partKeyToBeDeleted.getReplicatedSize();
+ RepeatedOmKeyInfo oldVerKeyInfo =
getOldVersionsToCleanUp(partKeyToBeDeleted, trxnLogIndex);
+ // Unlike normal key commit, we can reuse the objectID for MPU part
key because MPU part key
+ // always use a new object ID regardless whether there is an existing
key.
+ String delKeyName = omMetadataManager.getOzoneDeletePathKey(
+ partKeyToBeDeleted.getObjectID(), multipartKey);
+
+ if (!oldVerKeyInfo.getOmKeyInfoList().isEmpty()) {
+ keyVersionsToDeleteMap = new HashMap<>();
+ keyVersionsToDeleteMap.put(delKeyName, oldVerKeyInfo);
+ }
}
checkBucketQuotaInBytes(omMetadataManager, omBucketInfo,
correctedSpace);
omBucketInfo.incrUsedBytes(correctedSpace);
+ // let the uncommitted blocks pretend as key's old version blocks
+ // which will be deleted as RepeatedOmKeyInfo
+ final OmKeyInfo pseudoKeyInfo =
wrapUncommittedBlocksAsPseudoKey(uncommitted, omKeyInfo);
+ if (pseudoKeyInfo != null) {
+ long pseudoObjId = ozoneManager.getObjectIdFromTxId(trxnLogIndex);
+ String delKeyName = omMetadataManager.getOzoneDeletePathKey(
+ pseudoObjId, ozoneKey);
+ if (null == keyVersionsToDeleteMap) {
+ keyVersionsToDeleteMap = new HashMap<>();
+ }
+ keyVersionsToDeleteMap.computeIfAbsent(delKeyName,
+ key -> new RepeatedOmKeyInfo()).addOmKeyInfo(pseudoKeyInfo);
+ }
Review Comment:
Thanks for the suggestion. Updated. PTAL.
--
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]