accumulo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From denine99 <...@git.apache.org>
Subject [GitHub] accumulo pull request: ACCUMULO-3646 Update iterator doc on entrie...
Date Mon, 27 Apr 2015 17:31:45 GMT
Github user denine99 commented on a diff in the pull request:

    https://github.com/apache/accumulo/pull/33#discussion_r29169461
  
    --- Diff: docs/src/main/asciidoc/chapters/iterator_design.txt ---
    @@ -145,8 +146,16 @@ alter the internal state of the Iterator.
     
     These methods simply return the current Key-Value pair for this iterator. If `hasTop`
returns true,
     both of these methods should return non-null objects. If `hasTop` returns false, it is
undefined
    -what these methods should return. Multiple calls to these methods should not alter the
state
    -of the Iterator like `hasTop`.
    +what these methods should return. Like `hasTop`, multiple calls to these methods should
not alter 
    +the state of the Iterator.
    +
    +When saving a Key or Value from a source iterator's `getTopKey` or `getTopValue` methods
    +for use after calling `next` on the source iterator (e.g., when cacheing keys or values
    +from the source iterator), it is important to copy the Key or Value into a new object

    +because the source iterator may reuse the Key or Value objects for performance reasons.
    --- End diff --
    
    The statement 
    
    > "An iterator which doesn't modify the Key from its source doesn't need to copy it"

    
    does not sound safe because the base iterators may change the data that the Key object
points to in order to reuse the same underlying char[] and the same object.  
    
    How about this: "An iterator that does not use a Key obtained from `getTopKey()` after
calling `next()` on its source iterator (and does not use the underlying char[] of the Key),
does not need to copy the data from the Key and may use the original object reference. Ditto
for Value."   
    
    It's a wordy statement but we need all the clauses ~.~


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message