xichen01 commented on code in PR #3953:
URL: https://github.com/apache/ozone/pull/3953#discussion_r1031727196
##########
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:
It depends on how we view the volume and bucket, based on the ACL process of
checking permissions, the volume and bucket can be treated as the upper-level
directory of the key.
We currently will modify the bucket's modification time in set a bucket
property, which lets us know when the bucket's properties were last modified,
which is easy to understand. Would it be strange if the bucket's modification
time was modified when the key was renamed?
If the modification time of the bucket is modified here, should we also
modify the modification time of the volume modification time when create a
bucket or delete a bucket
--
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]