accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bil...@apache.org
Subject svn commit: r1180175 - in /incubator/accumulo/trunk: ./ src/core/src/main/java/org/apache/accumulo/core/iterators/ src/core/src/main/java/org/apache/accumulo/core/iterators/system/ src/core/src/main/java/org/apache/accumulo/core/iterators/user/ src/cor...
Date Fri, 07 Oct 2011 19:28:04 GMT
Author: billie
Date: Fri Oct  7 19:28:04 2011
New Revision: 1180175

URL: http://svn.apache.org/viewvc?rev=1180175&view=rev
Log:
ACCUMULO-15 threw RuntimeExceptions in WrappingIterator when no source has been set or no
seek has occurred; fixed resulting unit test failures

Modified:
    incubator/accumulo/trunk/   (props changed)
    incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/Filter.java
    incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/FilteringIterator.java
    incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/SkippingIterator.java
    incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/VersioningIterator.java
    incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/WrappingIterator.java
    incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/system/DeletingIterator.java
    incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/user/AgeOffFilter.java
    incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/user/ColumnAgeOffFilter.java
    incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/user/NoVisFilter.java
    incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/user/RegExFilter.java
    incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/user/TimestampFilter.java
    incubator/accumulo/trunk/src/core/src/test/java/org/apache/accumulo/core/iterators/FilterTest.java

Propchange: incubator/accumulo/trunk/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Fri Oct  7 19:28:04 2011
@@ -1,2 +1,3 @@
 logs
 walogs
+target

Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/Filter.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/Filter.java?rev=1180175&r1=1180174&r2=1180175&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/Filter.java
(original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/Filter.java
Fri Oct  7 19:28:04 2011
@@ -30,14 +30,9 @@ public abstract class Filter extends Wra
 
 	public Filter() {}
 
-	/*
-	 * Note that subclasses should call findTop() in their constructors after
-	 * calling super(iterator) and initializing their own parameters
-	 */
 	public Filter(SortedKeyValueIterator<Key, Value> iterator) {
 		setSource(iterator);
 		negate = false;
-//		findTop();
 	}
 
 	@Override
@@ -48,7 +43,7 @@ public abstract class Filter extends Wra
 
 	@Override
 	public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive)
throws IOException {
-		getSource().seek(range, columnFamilies, inclusive);
+		super.seek(range, columnFamilies, inclusive);
 		findTop();
 	}
 

Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/FilteringIterator.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/FilteringIterator.java?rev=1180175&r1=1180174&r2=1180175&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/FilteringIterator.java
(original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/FilteringIterator.java
Fri Oct  7 19:28:04 2011
@@ -56,7 +56,7 @@ public class FilteringIterator extends W
 
 	@Override
 	public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive)
throws IOException {
-		getSource().seek(range, columnFamilies, inclusive);
+		super.seek(range, columnFamilies, inclusive);
 		findTop();
 	}
 	

Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/SkippingIterator.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/SkippingIterator.java?rev=1180175&r1=1180174&r2=1180175&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/SkippingIterator.java
(original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/SkippingIterator.java
Fri Oct  7 19:28:04 2011
@@ -19,7 +19,7 @@ public abstract class SkippingIterator e
 
 	@Override
 	public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive)
throws IOException {
-		getSource().seek(range, columnFamilies, inclusive);
+		super.seek(range, columnFamilies, inclusive);
 		consume();
 	}
 

Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/VersioningIterator.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/VersioningIterator.java?rev=1180175&r1=1180174&r2=1180175&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/VersioningIterator.java
(original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/VersioningIterator.java
Fri Oct  7 19:28:04 2011
@@ -70,7 +70,7 @@ public class VersioningIterator extends 
 		// do not want to seek to the middle of a row
 		Range seekRange = IteratorUtil.maximizeStartKeyTimeStamp(range);
 		
-		getSource().seek(seekRange, columnFamilies, inclusive);
+		super.seek(seekRange, columnFamilies, inclusive);
 		resetVersionCount();
 		
 		if(range.getStartKey() != null){

Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/WrappingIterator.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/WrappingIterator.java?rev=1180175&r1=1180174&r2=1180175&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/WrappingIterator.java
(original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/WrappingIterator.java
Fri Oct  7 19:28:04 2011
@@ -12,7 +12,8 @@ import org.apache.accumulo.core.data.Val
 
 public abstract class WrappingIterator implements SortedKeyValueIterator<Key, Value>
{
 
-	private SortedKeyValueIterator<Key, Value> source;
+	private SortedKeyValueIterator<Key, Value> source = null;
+	boolean seenSeek = false;
 	
 	protected void setSource(SortedKeyValueIterator<Key, Value> source) {
 		this.source = source;
@@ -29,16 +30,22 @@ public abstract class WrappingIterator i
 
 	@Override
 	public Key getTopKey() {
+		if (source==null) throw new RuntimeException("no source set");
+		if (seenSeek==false) throw new RuntimeException("never been seeked");
 		return getSource().getTopKey();
 	}
 
 	@Override
 	public Value getTopValue() {
+		if (source==null) throw new RuntimeException("no source set");
+		if (seenSeek==false) throw new RuntimeException("never been seeked");
 		return getSource().getTopValue();
 	}
 
 	@Override
 	public boolean hasTop() {
+		if (source==null) throw new RuntimeException("no source set");
+		if (seenSeek==false) throw new RuntimeException("never been seeked");
 		return getSource().hasTop();
 	}
 
@@ -50,12 +57,15 @@ public abstract class WrappingIterator i
 
 	@Override
 	public void next() throws IOException {
+		if (source==null) throw new RuntimeException("no source set");
+		if (seenSeek==false) throw new RuntimeException("never been seeked");
 		getSource().next();
 	}
 	
 	@Override
 	public void seek(Range range, Collection<ByteSequence> columnFamilies, boolean inclusive)
throws IOException {
 		getSource().seek(range, columnFamilies, inclusive);
+		seenSeek = true;
 	}
 
 	

Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/system/DeletingIterator.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/system/DeletingIterator.java?rev=1180175&r1=1180174&r2=1180175&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/system/DeletingIterator.java
(original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/system/DeletingIterator.java
Fri Oct  7 19:28:04 2011
@@ -54,7 +54,7 @@ public class DeletingIterator extends Wr
 		// do not want to seek to the middle of a row
 		Range seekRange = IteratorUtil.maximizeStartKeyTimeStamp(range);
 		
-		getSource().seek(seekRange, columnFamilies, inclusive);
+		super.seek(seekRange, columnFamilies, inclusive);
 		findTop();
 		
 		if(range.getStartKey() != null){

Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/user/AgeOffFilter.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/user/AgeOffFilter.java?rev=1180175&r1=1180174&r2=1180175&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/user/AgeOffFilter.java
(original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/user/AgeOffFilter.java
Fri Oct  7 19:28:04 2011
@@ -22,7 +22,6 @@ public class AgeOffFilter extends Filter
 		super(iterator);
 		this.threshold = threshold;
 		this.currentTime = currentTime;
-		findTop();
 	}
 
 	@Override

Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/user/ColumnAgeOffFilter.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/user/ColumnAgeOffFilter.java?rev=1180175&r1=1180174&r2=1180175&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/user/ColumnAgeOffFilter.java
(original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/user/ColumnAgeOffFilter.java
Fri Oct  7 19:28:04 2011
@@ -23,7 +23,6 @@ public class ColumnAgeOffFilter extends 
 		super(iterator);
 		this.ttls = ttls;
 		this.currentTime = currentTime;
-		findTop();
 	}
 
 	public static class TTLSet extends ColumnToClassMapping<Long> {

Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/user/NoVisFilter.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/user/NoVisFilter.java?rev=1180175&r1=1180174&r2=1180175&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/user/NoVisFilter.java
(original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/user/NoVisFilter.java
Fri Oct  7 19:28:04 2011
@@ -13,7 +13,6 @@ public class NoVisFilter extends Filter 
 
 	public NoVisFilter(SortedKeyValueIterator<Key, Value> iterator) {
 		super(iterator);
-		findTop();
 	}
 
 	@Override

Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/user/RegExFilter.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/user/RegExFilter.java?rev=1180175&r1=1180174&r2=1180175&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/user/RegExFilter.java
(original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/user/RegExFilter.java
Fri Oct  7 19:28:04 2011
@@ -32,7 +32,6 @@ public class RegExFilter extends Filter 
 
 	public RegExFilter(SortedKeyValueIterator<Key, Value> iterator) {
 		super(iterator);
-		findTop();
 	}
 
 	public static final String ROW_REGEX = "rowRegex";

Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/user/TimestampFilter.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/user/TimestampFilter.java?rev=1180175&r1=1180174&r2=1180175&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/user/TimestampFilter.java
(original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/iterators/user/TimestampFilter.java
Fri Oct  7 19:28:04 2011
@@ -32,7 +32,6 @@ public class TimestampFilter extends Fil
 		this.startInclusive = startInclusive;
 		this.end = end;
 		this.endInclusive = endInclusive;
-		findTop();
 	}
 
 	@Override

Modified: incubator/accumulo/trunk/src/core/src/test/java/org/apache/accumulo/core/iterators/FilterTest.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/test/java/org/apache/accumulo/core/iterators/FilterTest.java?rev=1180175&r1=1180174&r2=1180175&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/test/java/org/apache/accumulo/core/iterators/FilterTest.java
(original)
+++ incubator/accumulo/trunk/src/core/src/test/java/org/apache/accumulo/core/iterators/FilterTest.java
Fri Oct  7 19:28:04 2011
@@ -37,7 +37,6 @@ public class FilterTest extends TestCase
 	public class SimpleFilter extends Filter {
 		public SimpleFilter(SortedKeyValueIterator<Key, Value> iterator) {
 			super(iterator);
-			findTop();
 		}
 
 		public boolean accept(Key k, Value v) {
@@ -51,7 +50,6 @@ public class FilterTest extends TestCase
 	public class SimpleFilter2 extends Filter {
 		public SimpleFilter2(SortedKeyValueIterator<Key, Value> iterator) {
 			super(iterator);
-			findTop();
 		}
 
 		public boolean accept(Key k, Value v) {



Mime
View raw message