Skip to content

Commit 8ceb5c3

Browse files
tanvipenumudyPenumudy Tanvi
andauthored
Revert "HDDS-11232. Spare InfoBucket RPC call for the FileSystem#getFileStatus calls for the general case. (apache#6988)" (apache#8358)
Co-authored-by: Penumudy Tanvi <tanvi.penumudy@Penumudys-MacBook-Pro.local>
1 parent 8ecf4a8 commit 8ceb5c3

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2161,8 +2161,6 @@ public OzoneMultipartUploadList listMultipartUploads(String volumeName,
21612161
@Override
21622162
public OzoneFileStatus getOzoneFileStatus(String volumeName,
21632163
String bucketName, String keyName) throws IOException {
2164-
verifyVolumeName(volumeName);
2165-
verifyBucketName(bucketName);
21662164
OmKeyArgs keyArgs = new OmKeyArgs.Builder()
21672165
.setVolumeName(volumeName)
21682166
.setBucketName(bucketName)

hadoop-ozone/dist/src/main/smoketest/ozonefs/ozonefs-obs.robot

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ Verify ls fails on OBS bucket
5151
Create key in OBS bucket
5252
Execute ozone sh key put /${volume}/${bucket}/testfile NOTICE.txt
5353

54+
Verify ls fails on OBS bucket key
55+
${url} = Format FS URL ${SCHEME} ${volume} ${bucket} testfile
56+
${result} = Execute and checkrc ozone fs -ls ${url} 255
57+
Should contain ${result} Bucket: ${bucket} has layout: OBJECT_STORE, which does not support file system semantics. Bucket Layout must be FILE_SYSTEM_OPTIMIZED or LEGACY.
58+
5459
Verify rm fails on OBS bucket
5560
${url} = Format FS URL ${SCHEME} ${volume} ${bucket} testfile
5661
${result} = Execute and checkrc ozone fs -rm ${url} 255

hadoop-ozone/ozonefs-common/src/main/java/org/apache/hadoop/fs/ozone/BasicRootedOzoneClientAdapterImpl.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -683,19 +683,20 @@ public FileStatusAdapter getFileStatus(String path, URI uri,
683683
* valid bucket path or valid snapshot path.
684684
* Throws exception in case of failure.
685685
*/
686-
private FileStatusAdapter getFileStatusForKeyOrSnapshot(OFSPath ofsPath, URI uri, Path qualifiedPath, String userName)
686+
private FileStatusAdapter getFileStatusForKeyOrSnapshot(
687+
OFSPath ofsPath, URI uri, Path qualifiedPath, String userName)
687688
throws IOException {
688-
String volumeName = ofsPath.getVolumeName();
689-
String bucketName = ofsPath.getBucketName();
690689
String key = ofsPath.getKeyName();
691690
try {
691+
OzoneBucket bucket = getBucket(ofsPath, false);
692692
if (ofsPath.isSnapshotPath()) {
693-
OzoneVolume volume = objectStore.getVolume(volumeName);
694-
OzoneBucket bucket = getBucket(volumeName, bucketName, false);
695-
return getFileStatusAdapterWithSnapshotIndicator(volume, bucket, uri);
693+
OzoneVolume volume = objectStore.getVolume(ofsPath.getVolumeName());
694+
return getFileStatusAdapterWithSnapshotIndicator(
695+
volume, bucket, uri);
696696
} else {
697-
OzoneFileStatus status = proxy.getOzoneFileStatus(volumeName, bucketName, key);
698-
return toFileStatusAdapter(status, userName, uri, qualifiedPath, ofsPath.getNonKeyPath());
697+
OzoneFileStatus status = bucket.getFileStatus(key);
698+
return toFileStatusAdapter(status, userName, uri, qualifiedPath,
699+
ofsPath.getNonKeyPath());
699700
}
700701
} catch (OMException e) {
701702
if (e.getResult() == OMException.ResultCodes.FILE_NOT_FOUND) {

0 commit comments

Comments
 (0)