You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ns...@apache.org on 2011/10/11 19:45:03 UTC
svn commit: r1181973 - in /hbase/branches/0.89/src:
main/java/org/apache/hadoop/hbase/thrift/ThriftServer.java
test/java/org/apache/hadoop/hbase/filter/TestColumnPrefixFilter.java
Author: nspiegelberg
Date: Tue Oct 11 17:45:03 2011
New Revision: 1181973
URL: http://svn.apache.org/viewvc?rev=1181973&view=rev
Log:
thrift scannerstopwithfilter not honoring stop row
Summary:
should be a straightforward change.
will upload another diff for 90
Test Plan:
not tested
added a test case which doesn't really test this change. The test case was to
help me understand the scanner-state machine
Reviewers: liyintang, jgray, dhruba
Reviewed By: liyintang
CC: hbase-hdfs@lists, liyintang
Differential Revision: 323183
Modified:
hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServer.java
hbase/branches/0.89/src/test/java/org/apache/hadoop/hbase/filter/TestColumnPrefixFilter.java
Modified: hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServer.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServer.java?rev=1181973&r1=1181972&r2=1181973&view=diff
==============================================================================
--- hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServer.java (original)
+++ hbase/branches/0.89/src/main/java/org/apache/hadoop/hbase/thrift/ThriftServer.java Tue Oct 11 17:45:03 2011
@@ -948,8 +948,7 @@ public class ThriftServer {
byte [] startRow, byte [] stopRow,
byte [] filterString)
throws IOError, TException {
- return scannerOpenWithStopAndFilterStringTs(tableName, startRow,
- HConstants.EMPTY_END_ROW,
+ return scannerOpenWithStopAndFilterStringTs(tableName, startRow, stopRow,
filterString, Long.MAX_VALUE);
}
Modified: hbase/branches/0.89/src/test/java/org/apache/hadoop/hbase/filter/TestColumnPrefixFilter.java
URL: http://svn.apache.org/viewvc/hbase/branches/0.89/src/test/java/org/apache/hadoop/hbase/filter/TestColumnPrefixFilter.java?rev=1181973&r1=1181972&r2=1181973&view=diff
==============================================================================
--- hbase/branches/0.89/src/test/java/org/apache/hadoop/hbase/filter/TestColumnPrefixFilter.java (original)
+++ hbase/branches/0.89/src/test/java/org/apache/hadoop/hbase/filter/TestColumnPrefixFilter.java Tue Oct 11 17:45:03 2011
@@ -22,13 +22,52 @@ import org.apache.hadoop.hbase.regionser
import org.apache.hadoop.hbase.regionserver.InternalScanner;
import org.apache.hadoop.hbase.util.Bytes;
import org.junit.Test;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
public class TestColumnPrefixFilter {
+ static final Log LOG = LogFactory.getLog(TestColumnPrefixFilter.class);
+
private final static HBaseTestingUtility TEST_UTIL = new
HBaseTestingUtility();
@Test
+ public void testColumnPrefixFastForwarding() throws IOException {
+ String family = "Family";
+ HTableDescriptor htd = new HTableDescriptor("TestColumnPrefixFilter");
+ htd.addFamily(new HColumnDescriptor(family));
+ HRegionInfo info = new HRegionInfo(htd, null, null, false);
+ HRegion region = HRegion.createHRegion(info, HBaseTestingUtility.
+ getTestDir(), TEST_UTIL.getConfiguration());
+ String row;
+ Put p;
+ row = "001";
+ p = new Put(Bytes.toBytes(row));
+ p.add(KeyValueTestUtil.create(row, family, "abc", 1, "value001"));
+ region.put(p);
+ row = "2";
+ p = new Put(Bytes.toBytes(row));
+ p.add(KeyValueTestUtil.create(row, family, "xyz", 1, "value009"));
+ region.put(p);
+
+ ColumnPrefixFilter filter;
+ Scan scan = new Scan(Bytes.toBytes("001"), Bytes.toBytes("0011"));
+ scan.setMaxVersions();
+ filter = new ColumnPrefixFilter(Bytes.toBytes("xyz"));
+ scan.setFilter(filter);
+ InternalScanner scanner = region.getScanner(scan);
+ List<KeyValue> results = new ArrayList<KeyValue>();
+ int i = 0;
+ while(scanner.next(results)) { LOG.info("scan iter " + i++); }
+ if (results.size() > 0) {
+ LOG.info("results[0] = " + results.get(0).toString());
+ }
+ assertEquals(0, results.size());
+ }
+
+
+ //@Test
public void testColumnPrefixFilter() throws IOException {
String family = "Family";
HTableDescriptor htd = new HTableDescriptor("TestColumnPrefixFilter");