Github user joshelser commented on a diff in the pull request:

    https://github.com/apache/accumulo/pull/247#discussion_r111169081
  
    --- Diff: 
core/src/main/java/org/apache/accumulo/core/iterators/OrIterator.java ---
    @@ -80,59 +128,103 @@ public int compareTo(TermSource o) {
           // sorted after they have been determined to be valid.
           return 
this.iter.getTopKey().compareColumnQualifier(o.iter.getTopKey().getColumnQualifier());
         }
    +
    +    /**
    +     * Converts the given {@code Range} into the correct {@code Range} for 
this TermSource (per this expected table structure) and then seeks this 
TermSource's
    +     * SKVI.
    +     */
    +    public void seek(Range originalRange) throws IOException {
    +      // the infinite start key is equivalent to a null startKey on the 
Range.
    +      if (!originalRange.isInfiniteStartKey()) {
    +        Key originalStartKey = originalRange.getStartKey();
    +        // Pivot the provided range into the range for this term
    +        Key newKey = new Key(originalStartKey.getRow(), term, 
originalStartKey.getColumnQualifier(), originalStartKey.getTimestamp());
    +        // Construct the new range, preserving the other attributes on the 
provided range.
    +        currentRange = new Range(newKey, 
originalRange.isStartKeyInclusive(), originalRange.getEndKey(), 
originalRange.isEndKeyInclusive());
    --- End diff --
    
    If we blindly set inclusivity on the start key, we will infinite loop in 
the small scan max memory condition and a tablet with multiple rows (you could 
try this if you want with the one integration test included).
    
    On the re-seek, we'll get a range that looks like `(row 
term:prev_matched_docid, +inf)` (or whatever the end key is). But, if a user 
provides a specific row/range, we might get `[row term:docid, row 
term:docid\x00)`. Preserving the startKeyInclusivity handles both cases.


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to