You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by GitBox <gi...@apache.org> on 2022/11/01 06:04:24 UTC
[GitHub] [ozone] duongkame commented on a diff in pull request #3912: HDDS-7419. Integrate the GetKeyInfo API to OFS
duongkame commented on code in PR #3912:
URL: https://github.com/apache/ozone/pull/3912#discussion_r1010097491
##########
hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/rpc/RpcClient.java:
##########
@@ -1698,7 +1698,17 @@ public OzoneInputStream readFile(String volumeName, String bucketName,
.setSortDatanodesInPipeline(topologyAwareReadEnabled)
.setLatestVersionLocation(getLatestVersionLocation)
.build();
- OmKeyInfo keyInfo = ozoneManagerClient.lookupFile(keyArgs);
+ final OmKeyInfo keyInfo;
+ if (omVersion.compareTo(OzoneManagerVersion.OPTIMIZED_GET_KEY_INFO) >= 0) {
+ keyInfo = ozoneManagerClient.getKeyInfo(keyArgs, false)
+ .getKeyInfo();
+ if (!keyInfo.isFile()) {
Review Comment:
It's possible.
However, if we just reused `getKeyInfo`, then in turn it would call `lookupKey` for older OM and that would not result in either isFile attribute or `NOT_A_FILE` exception. (For older OM, clients have to call `lookupFile`).
Yet, to make things right, we can make `getKeyInfo` looks like the following to make it reusable across object storage and OFS use cases.
```
private OmKeyInfo getKeyInfo(String volumeName, String bucketName, String keyName,
boolean forceUpdateContainerCache, boolean lookupFile) {
if (newOM) { call getKeyInfo }
else if (lookupFile) { call lookupFile }
else { call lookupKey }
}
```
I feel that would just move complexity from one place to another.
--
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: issues-unsubscribe@ozone.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org