xBis7 commented on code in PR #4134:
URL: https://github.com/apache/ozone/pull/4134#discussion_r1096003882
##########
hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneClientAdapterImpl.java:
##########
@@ -635,19 +637,36 @@ public FileStatusAdapter getFileStatus(String path, URI
uri,
Path qualifiedPath, String userName) throws IOException {
incrementCounter(Statistic.OBJECTS_QUERY, 1);
OFSPath ofsPath = new OFSPath(path, config);
- String key = ofsPath.getKeyName();
if (ofsPath.isRoot()) {
return getFileStatusAdapterForRoot(uri);
- }
- if (ofsPath.isVolume()) {
+ } else if (ofsPath.isVolume()) {
OzoneVolume volume = objectStore.getVolume(ofsPath.getVolumeName());
return getFileStatusAdapterForVolume(volume, uri);
+ } else {
+ return getFileStatusForKeyOrSnapshot(
+ ofsPath, uri, qualifiedPath, userName);
}
+ }
+
+ /**
+ * Check OFSPath to determine whether we are on a bucket path
+ * or a snapshot path and return FileStatusAdapter.
+ */
+ private FileStatusAdapter getFileStatusForKeyOrSnapshot(
+ OFSPath ofsPath, URI uri, Path qualifiedPath, String userName)
+ throws IOException {
+ String key = ofsPath.getKeyName();
try {
OzoneBucket bucket = getBucket(ofsPath, false);
- OzoneFileStatus status = bucket.getFileStatus(key);
- return toFileStatusAdapter(status, userName, uri, qualifiedPath,
- ofsPath.getNonKeyPath());
+ if (ofsPath.isSnapshotPath()) {
+ OzoneVolume volume = objectStore.getVolume(ofsPath.getVolumeName());
+ return getFileStatusAdapterWithSnapshotIndicator(
Review Comment:
@hemantk-12 Skipping this part, will lead to failure as it will consider the
snapshot indicator as a key.
--
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]