[ 
https://issues.apache.org/jira/browse/HDFS-12063?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16070131#comment-16070131
 ] 

Yiqun Lin commented on HDFS-12063:
----------------------------------

Thanks for the review, [~vagarychen]!
bq. in getVolume() and getBucket(), there are calls 
OzoneUtils.verifyBucketName(volumeName); and 
OzoneUtils.verifyBucketName(bucketName); ...
Have used OzoneUtils.verifyBucketName to check volume/bucket name and rename 
this method name to {{verifyResourceName}}. Actually we don't need to check if 
volume or bucket is null first since it will do this checking inside 
{{verifyResourceName}}.

bq. do need to we check fis is null or not before calling it?
I have looked into the codes of {{IOUtils.closeStream(fis);}}. It will do the 
null checking, only when stream object is not null then do the clean-up 
operation.
{code:java}
  public static void closeStream(java.io.Closeable stream) {
    if (stream != null) {
      cleanup(null, stream);
    }
  }
{code}

bq. So could you please add unit test to see the behaviour of new put and get? 
e.g. try to put/get from non-existing volumes/buckets and see if it does throw 
exceptions as expected?
This is a good point! There is a chance that the exceptions will not thrown as 
we expected. Because in new method we can directly request get/put key and skip 
the bucket/volume checking. Maybe we using a invalid volume/bucket name, then 
we will get a error msg like "invalid key name". I add the additional tests in 
class {{TestKeys}}. Since {{TestKeys}} uses *local* handler type, so  I made 
the tests base on this type. I have tried to switch type to {{distributed}}, 
but some tests will be failed such as listKeys fails due to invalid key size 
passed. I‘d like to change type from {{local}} to {{distributed} and fixed 
related test failures in HDFS-12035. Also we can fix the exception message if 
the return exception is not we wanted.

Attach the updated patch. Thanks for the review.





> Ozone: Ozone shell: Multiple RPC calls for put/get key
> ------------------------------------------------------
>
>                 Key: HDFS-12063
>                 URL: https://issues.apache.org/jira/browse/HDFS-12063
>             Project: Hadoop HDFS
>          Issue Type: Sub-task
>            Reporter: Nandakumar
>            Assignee: Yiqun Lin
>         Attachments: HDFS-12063-HDFS-7240.001.patch, 
> HDFS-12063-HDFS-7240.002.patch
>
>
> With current implementation multiple RPC calls are made for each put/get key 
> ozone shell call
> {code:title=org.apache.hadoop.ozone.web.ozShell.keys.PutKeyHandler#execute}
>     OzoneVolume vol = client.getVolume(volumeName);
>     OzoneBucket bucket = vol.getBucket(bucketName);
>     bucket.putKey(keyName, dataFile);
> {code}
> {code:title=org.apache.hadoop.ozone.web.ozShell.keys.GetKeyHandler#execute}
>     OzoneVolume vol = client.getVolume(volumeName);
>     OzoneBucket bucket = vol.getBucket(bucketName);
>     bucket.getKey(keyName, dataFilePath);
> {code}
> This can be optimized.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscr...@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-h...@hadoop.apache.org

Reply via email to