errose28 commented on code in PR #3953:
URL: https://github.com/apache/ozone/pull/3953#discussion_r1034106064


##########
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/request/key/OMKeyRenameRequestWithFSO.java:
##########
@@ -243,27 +244,56 @@ public OMClientResponse 
validateAndUpdateCache(OzoneManager ozoneManager,
   }
 
   @SuppressWarnings("parameternumber")
-  private OMClientResponse renameKey(long toKeyParentId,
-      long trxnLogIndex, OmKeyInfo fromKeyValue, boolean isRenameDirectory,
-      String toKeyName, long modificationTime, OMResponse.Builder omResponse,
-      OzoneManager ozoneManager) throws IOException {
-
+  private OMClientResponse renameKey(OmKeyInfo toKeyParent, String toKeyName,
+      OmKeyInfo fromKeyValue, String fromKeyName, boolean isRenameDirectory,
+      long modificationTime, OzoneManager ozoneManager,
+      OMResponse.Builder omResponse, long trxnLogIndex) throws IOException {
     final OMMetadataManager ommm = ozoneManager.getMetadataManager();
     final long volumeId = ommm.getVolumeId(fromKeyValue.getVolumeName());
     final long bucketId = ommm.getBucketId(fromKeyValue.getVolumeName(),
             fromKeyValue.getBucketName());
     final String dbFromKey = ommm.getOzonePathKey(volumeId, bucketId,
             fromKeyValue.getParentObjectID(), fromKeyValue.getFileName());
     String toKeyFileName = OzoneFSUtils.getFileName(toKeyName);
+    OmKeyInfo fromKeyParent = null;
+    OMMetadataManager metadataMgr = ozoneManager.getMetadataManager();
+    Table<String, OmDirectoryInfo> dirTable = metadataMgr.getDirectoryTable();
 
     fromKeyValue.setUpdateID(trxnLogIndex, ozoneManager.isRatisEnabled());
     // Set toFileName
     fromKeyValue.setKeyName(toKeyFileName);
     fromKeyValue.setFileName(toKeyFileName);
     // Set toKeyObjectId
-    fromKeyValue.setParentObjectID(toKeyParentId);
-    //Set modification time
-    fromKeyValue.setModificationTime(modificationTime);
+    if (toKeyParent != null) {
+      fromKeyValue.setParentObjectID(toKeyParent.getObjectID());
+    } else {
+      String bucketKey = metadataMgr.getBucketKey(
+          fromKeyValue.getVolumeName(), fromKeyValue.getBucketName());
+      OmBucketInfo omBucketInfo =
+          metadataMgr.getBucketTable().get(bucketKey);
+      fromKeyValue.setParentObjectID(omBucketInfo.getObjectID());

Review Comment:
   This is an interesting discussion 😄 
   It seems like we are leaning towards the following:
   - create bucket changes volume modification time regardless of bucket type.
   - create/rename/delete file or directory at the root of a bucket changes 
bucket modification time for FSO buckets.
   
   I wonder if we should also have object create/rename/delete in OBS buckets 
change the bucket modification time? I am kind of thinking no. Since OBS 
buckets do not have filesystem semantics the bucket is a separate entity. 
However I do not have a strong opinion as long as we have some justification 
for the approach we decide on.



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