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

Nanda kumar commented on HDDS-271:
----------------------------------

As this is an iterator we can throw NoSuchElementException if the iteration has 
no more element instead of returning null.

If {{hasNext}} returns true we should be able to return the next block on 
{{nextBlock}} call.
Consider a case where we have two blocks [key1:block1, #deleting#key2:block2]. 
For the first {{hasNext}} call we will return {{true}} and the {{nextBlock}} 
call will return key1:block1. For the second {{hasNext}} call we will return 
{{true}} but the {{nextBlock}} call will return {{null}}. This will create 
inconsistent behavior in code wherever the iterator is used. We cannot fully 
rely on {{hasNext}} call anymore.

> Create a block iterator to iterate blocks in a container
> --------------------------------------------------------
>
>                 Key: HDDS-271
>                 URL: https://issues.apache.org/jira/browse/HDDS-271
>             Project: Hadoop Distributed Data Store
>          Issue Type: Improvement
>            Reporter: Bharat Viswanadham
>            Assignee: Bharat Viswanadham
>            Priority: Major
>             Fix For: 0.2.1
>
>         Attachments: HDDS-271.00.patch, HDDS-271.01.patch, HDDS-271.02.patch, 
> HDDS-271.03.patch
>
>
> Create a block iterator to scan all blocks in a container.
> This one will be useful during implementation of container scanner.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
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