incubator-accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bil...@apache.org
Subject svn commit: r1245574 - in /incubator/accumulo/branches/1.4/src/core/src: main/java/org/apache/accumulo/core/iterators/ test/java/org/apache/accumulo/core/iterators/user/
Date Fri, 17 Feb 2012 14:36:55 GMT
Author: billie
Date: Fri Feb 17 14:36:55 2012
New Revision: 1245574

URL: http://svn.apache.org/viewvc?rev=1245574&view=rev
Log:
ACCUMULO-414 expanded javadocs and added deletion handling to Filter

Modified:
    incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/Filter.java
    incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/SortedKeyValueIterator.java
    incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/user/FilterTest.java

Modified: incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/Filter.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/Filter.java?rev=1245574&r1=1245573&r2=1245574&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/Filter.java
(original)
+++ incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/Filter.java
Fri Feb 17 14:36:55 2012
@@ -69,7 +69,7 @@ public abstract class Filter extends Wra
    * Iterates over the source until an acceptable key/value pair is found.
    */
   protected void findTop() {
-    while (getSource().hasTop() && (negate == accept(getSource().getTopKey(), getSource().getTopValue())))
{
+    while (getSource().hasTop() && !getSource().getTopKey().isDeleted() &&
(negate == accept(getSource().getTopKey(), getSource().getTopValue()))) {
       try {
         getSource().next();
       } catch (IOException e) {

Modified: incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/SortedKeyValueIterator.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/SortedKeyValueIterator.java?rev=1245574&r1=1245573&r2=1245574&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/SortedKeyValueIterator.java
(original)
+++ incubator/accumulo/branches/1.4/src/core/src/main/java/org/apache/accumulo/core/iterators/SortedKeyValueIterator.java
Fri Feb 17 14:36:55 2012
@@ -59,7 +59,9 @@ public interface SortedKeyValueIterator<
   boolean hasTop();
   
   /**
-   * Advances to the next K,V pair.
+   * Advances to the next K,V pair. Note that in minor compaction scope and in non-full major
compaction scopes the iterator may see deletion entries. These
+   * entries should be preserved by all iterators except ones that are strictly scan-time
iterators that will never be configured for the minc or majc scopes.
+   * Deletion entries are only removed during full major compactions.
    * 
    * @throws IOException
    *           if an I/O error occurs.
@@ -88,7 +90,9 @@ public interface SortedKeyValueIterator<
   void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive)
throws IOException;
   
   /**
-   * Returns top key. Can be called 0 or more times without affecting behavior of next()
or hasTop().
+   * Returns top key. Can be called 0 or more times without affecting behavior of next()
or hasTop(). Note that in minor compaction scope and in non-full major
+   * compaction scopes the iterator may see deletion entries. These entries should be preserved
by all iterators except ones that are strictly scan-time
+   * iterators that will never be configured for the minc or majc scopes. Deletion entries
are only removed during full major compactions.
    * 
    * @return <tt>K</tt>
    * @exception IllegalStateException

Modified: incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/user/FilterTest.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/user/FilterTest.java?rev=1245574&r1=1245573&r2=1245574&view=diff
==============================================================================
--- incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/user/FilterTest.java
(original)
+++ incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/iterators/user/FilterTest.java
Fri Feb 17 14:36:55 2012
@@ -444,4 +444,31 @@ public class FilterTest {
     a.seek(new Range(), EMPTY_COL_FAMS, false);
     assertEquals(size(a), 31);
   }
+  
+  @Test
+  public void testDeletes() throws IOException {
+    Text colf = new Text("a");
+    Text colq = new Text("b");
+    Value dv = new Value();
+    TreeMap<Key,Value> tm = new TreeMap<Key,Value>();
+    
+    Key k = new Key(new Text("0"), colf, colq);
+    tm.put(k, dv);
+    k = new Key(new Text("1"), colf, colq, 10);
+    k.setDeleted(true);
+    tm.put(k, dv);
+    k = new Key(new Text("1"), colf, colq, 5);
+    tm.put(k, dv);
+    k = new Key(new Text("10"), colf, colq);
+    tm.put(k, dv);
+    
+    assertTrue(tm.size() == 4);
+    
+    Filter filter = new SimpleFilter();
+    filter.init(new SortedMapIterator(tm), EMPTY_OPTS, null);
+    filter.seek(new Range(), EMPTY_COL_FAMS, false);
+    int size = size(filter);
+    assertTrue("size = " + size, size == 3);
+    
+  }
 }



Mime
View raw message