Return-Path: X-Original-To: apmail-incubator-accumulo-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-accumulo-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4AA019843 for ; Fri, 17 Feb 2012 14:37:17 +0000 (UTC) Received: (qmail 45472 invoked by uid 500); 17 Feb 2012 14:37:17 -0000 Delivered-To: apmail-incubator-accumulo-commits-archive@incubator.apache.org Received: (qmail 45413 invoked by uid 500); 17 Feb 2012 14:37:16 -0000 Mailing-List: contact accumulo-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: accumulo-dev@incubator.apache.org Delivered-To: mailing list accumulo-commits@incubator.apache.org Received: (qmail 45387 invoked by uid 99); 17 Feb 2012 14:37:16 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Feb 2012 14:37:16 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 17 Feb 2012 14:37:15 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id B09E32388900; Fri, 17 Feb 2012 14:36:55 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: accumulo-commits@incubator.apache.org From: billie@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120217143655.B09E32388900@eris.apache.org> 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 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 K * @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 tm = new TreeMap(); + + 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); + + } }