bharatviswa504 commented on a change in pull request #428: HDDS-2868. Add 
ObjectID and UpdateID to OMKeyInfo.
URL: https://github.com/apache/hadoop-ozone/pull/428#discussion_r366091719
 
 

 ##########
 File path: 
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/s3/multipart/S3MultipartUploadCompleteRequest.java
 ##########
 @@ -229,17 +229,33 @@ public OMClientResponse 
validateAndUpdateCache(OzoneManager ozoneManager,
           // This is a newly added key, it does not have any versions.
           OmKeyLocationInfoGroup keyLocationInfoGroup = new
               OmKeyLocationInfoGroup(0, partLocationInfos);
+
+          // Get the objectID of the key from OpenKeyTable
+          OmKeyInfo dbOpenKeyInfo = omMetadataManager.getOpenKeyTable()
+              .get(multipartKey);
+
           // A newly created key, this is the first version.
-          omKeyInfo = new OmKeyInfo.Builder().setVolumeName(volumeName)
+          OmKeyInfo.Builder builder =
+              new OmKeyInfo.Builder().setVolumeName(volumeName)
               .setBucketName(bucketName).setKeyName(keyName)
               .setReplicationFactor(factor).setReplicationType(type)
               .setCreationTime(keyArgs.getModificationTime())
               .setModificationTime(keyArgs.getModificationTime())
               .setDataSize(dataSize)
               .setOmKeyLocationInfos(
                   Collections.singletonList(keyLocationInfoGroup))
-              .setAcls(OzoneAclUtil.fromProtobuf(keyArgs.getAclsList()))
-              .build();
+              .setAcls(OzoneAclUtil.fromProtobuf(keyArgs.getAclsList()));
+          // Check if db entry has ObjectID. This check is required because
+          // it is possible that between multipart key uploads and complete,
+          // we had an upgrade.
+          // TODO: If on upgrades we do not consider the non-completed 
multipart
+          //  uploads, then this check can be removed.
+          if (dbOpenKeyInfo.getObjectID() != 0) {
 
 Review comment:
   As discussed offline, for this we can set ObjectID, which we have in the 
dbOpenKeyInfo.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to