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 2020/01/12 07:30:54 UTC

[GitHub] [hadoop-ozone] cxorm opened a new pull request #437: HDDS-2845. Fix listing keys for setting --start with last key

cxorm opened a new pull request #437: HDDS-2845. Fix listing keys for setting --start with last key
URL: https://github.com/apache/hadoop-ozone/pull/437
 
 
   ## What changes were proposed in this pull request?
   Cause listing keys with `--start` means that we would get keys after the `--start`, we should get empty result when we set `--start` with last key.
   
   But we get all keys 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/OzoneBucket.java#L592#L600).
   
   When we set `--start` with last key, [`getNextListOfKeys(prevKey)`](https://github.com/apache/hadoop-ozone/blob/master/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/OzoneBucket.java#L589) 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/OzoneBucket.java#L593#L600) would enter the `if-block` and `currentValue` is `null`.
   
   This situation results in calling `getNextListOfKeys(null)`, and [`currentIterator`](https://github.com/apache/hadoop-ozone/blob/master/hadoop-ozone/client/src/main/java/org/apache/hadoop/ozone/client/OzoneBucket.java#L595#L597) would be iterator of all keys, so we get all keys 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/OzoneBucket.java#L594#L598) 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/OzoneBucket.java#L593#L600) 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-2845
   
   ## How was this patch tested?
   [Github action passed](https://github.com/cxorm/hadoop-ozone/runs/376387142).

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] cxorm commented on issue #437: HDDS-2845. Fix listing keys for setting --start with last key

Posted by GitBox <gi...@apache.org>.
cxorm commented on issue #437: HDDS-2845. Fix listing keys for setting --start with last key
URL: https://github.com/apache/hadoop-ozone/pull/437#issuecomment-576012916
 
 
   Thanks @xiaoyuyao for reviewing this PR.
   
   I add a test in integration-test `TestOzoneShellHA` cause this issue aims to fix the behavior in shell command.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] cxorm commented on issue #437: HDDS-2845. Fix listing keys for setting --start with last key

Posted by GitBox <gi...@apache.org>.
cxorm commented on issue #437: HDDS-2845. Fix listing keys for setting --start with last key
URL: https://github.com/apache/hadoop-ozone/pull/437#issuecomment-583844956
 
 
   Thank you @xiaoyuyao for the review and merge.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] xiaoyuyao merged pull request #437: HDDS-2845. Fix listing keys for setting --start with last key

Posted by GitBox <gi...@apache.org>.
xiaoyuyao merged pull request #437: HDDS-2845. Fix listing keys for setting --start with last key
URL: https://github.com/apache/hadoop-ozone/pull/437
 
 
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] xiaoyuyao commented on issue #437: HDDS-2845. Fix listing keys for setting --start with last key

Posted by GitBox <gi...@apache.org>.
xiaoyuyao commented on issue #437: HDDS-2845. Fix listing keys for setting --start with last key
URL: https://github.com/apache/hadoop-ozone/pull/437#issuecomment-574444313
 
 
   The description and fix LGTM, can you add a unit test for the issue?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org


[GitHub] [hadoop-ozone] xiaoyuyao commented on issue #437: HDDS-2845. Fix listing keys for setting --start with last key

Posted by GitBox <gi...@apache.org>.
xiaoyuyao commented on issue #437: HDDS-2845. Fix listing keys for setting --start with last key
URL: https://github.com/apache/hadoop-ozone/pull/437#issuecomment-583751909
 
 
   LGTM, +1. 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-issues-help@hadoop.apache.org