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: [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]