cxorm opened a new pull request #432: HDDS-2832. Fix listing buckets for setting --start with last bucket URL: https://github.com/apache/hadoop-ozone/pull/432 ## What changes were proposed in this pull request? Cause listing buckets with `--start` means that we would get buckets after the `--start`, we should get empty result when we set `--start` with last bucket. But we get all buckets for now, this is caused by this [method](https://github.com/apache/hadoop-ozone/blob/master/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/OzoneVolume.java#L298#L305). When we set `--start` with last bucket, [`getNextListOfBuckets(prevBucket)`](https://github.com/apache/hadoop-ozone/blob/master/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/OzoneVolume.java#L294) would be empty list, so the first call of [`hasNext()`](https://github.com/apache/hadoop-ozone/blob/master/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/OzoneVolume.java#L298#L305) would enter the `if-block` and `currentValue` is `null`. This situation results in calling `getNextListOfBuckets(null)`, and [`currentIterator`](https://github.com/apache/hadoop-ozone/blob/master/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/OzoneVolume.java#L300#L302) would be iterator of all buckets with this length size, so we get all buckets for now. #### Proposed fix. The `currentValue` in [`if-block`](https://github.com/apache/hadoop-ozone/blob/master/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/OzoneVolume.java#L299#L303) would be `null` if and only if first call [`hasNext()`](https://github.com/apache/hadoop-ozone/blob/master/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/OzoneVolume.java#L298#L305) of empty list, so`currentValue` is tested ahead by this fix. ## What is the link to the Apache JIRA https://issues.apache.org/jira/browse/HDDS-2832 ## How was this patch tested? [Github action passed](https://github.com/cxorm/hadoop-ozone/runs/376330188).
---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: [email protected] With regards, Apache Git Services --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
