[ https://issues.apache.org/jira/browse/HDFS-12205?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16171206#comment-16171206 ]
Yiqun Lin commented on HDFS-12205: ---------------------------------- Thanks [~ljain] for updating the patch! I noticed one detail change: {noformat} @@ -916,12 +920,7 @@ public void commitKey(KeyArgs args, OutputStream stream) ListKeys keyList; byte[] bucketListBytes = userDB.get(args.getParentName() .getBytes(encoding)); - if (bucketListBytes == null) { - keyList = new ListKeys(); - } else { - keyList = ListKeys.parse(new String(bucketListBytes, encoding)); - } - {noformat} I suppose you removed these lines because we can ensure {{bucketListBytes }} won't be null after the following change. {noformat} + // Update userDB with volume/bucket -> empty key list + userDB.put(args.getResourceName().getBytes(encoding), + new ListKeys().toDBString().getBytes(encoding)); {noformat} But I think we shouldn't remove these lines, it's a safe check here. Can you restore these lines? +1 once addressed. > Ozone: List Key on an empty ozone bucket fails with command failed error > ------------------------------------------------------------------------ > > Key: HDFS-12205 > URL: https://issues.apache.org/jira/browse/HDFS-12205 > Project: Hadoop HDFS > Issue Type: Sub-task > Components: ozone > Affects Versions: HDFS-7240 > Reporter: Mukul Kumar Singh > Assignee: Lokesh Jain > Labels: ozoneMerge > Fix For: HDFS-7240 > > Attachments: HDFS-12205-HDFS-7240.001.patch, > HDFS-12205-HDFS-7240.002.patch > > > Tried listing an empty bucket and it fails with > {code} > [root@88970a014980 opt]# hadoop-3.0.0-alpha4-SNAPSHOT/bin/hdfs oz -listKey > http://localhost:9864/vol1/bucket1 > Command Failed : > {"httpCode":400,"shortMessage":"invalidResourceName","resource":"vol1/bucket1","message":"Invalid > volume, bucket or key > name.","requestID":"a38471bb-3fbf-416f-b89d-758506185244","hostName":"88970a014980"} > {code} > However after adding one key the same command works. > {code} > [root@88970a014980 opt]# hadoop-3.0.0-alpha4-SNAPSHOT/bin/hdfs oz -listKey > http://localhost:9864/vol1/bucket1 > { > "version" : 0, > "md5hash" : "d41d8cd98f00b204e9800998ecf8427e", > "createdOn" : "Thu, 27 Jul 2017 11:43:55 +0000", > "size" : 0, > "keyName" : "key1" > } > {code} > I feel that for an empty bucket, an empty json should be returned. -- 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