Make unit test run faster, fix javadoc, fix scan merge error, and remove unused variable

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@944530 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Ryan Rawson 2010-05-15 00:19:58 +00:00
parent a026befba3
commit adbcfc3846
3 changed files with 7 additions and 12 deletions

View File

@ -251,7 +251,7 @@ public class HRegion implements HConstants, HeapSize { // , Writable{
/** /**
* HRegion constructor. his constructor should only be used for testing and * HRegion constructor. his constructor should only be used for testing and
* extensions. Instances of HRegion should be instantiated with the * extensions. Instances of HRegion should be instantiated with the
* {@link org.apache.hadoop.hbase.regionserver.HRegion#newHRegion( org.apache.hadoop.fs.Path, HLog, org.apache.hadoop.fs.FileSystem, org.apache.hadoop.hbase.HBaseConfiguration, org.apache.hadoop.hbase.HRegionInfo, FlushRequester)} method. * {@link HRegion#newHRegion(Path, HLog, FileSystem, Configuration, org.apache.hadoop.hbase.HRegionInfo, FlushRequester)} method.
* *
* *
* @param basedir qualified path of directory where region should be located, * @param basedir qualified path of directory where region should be located,
@ -271,7 +271,7 @@ public class HRegion implements HConstants, HeapSize { // , Writable{
* making progress to master -- otherwise master might think region deploy * making progress to master -- otherwise master might think region deploy
* failed. Can be null. * failed. Can be null.
* *
* @see org.apache.hadoop.hbase.regionserver.HRegion#newHRegion(org.apache.hadoop.fs.Path, HLog, org.apache.hadoop.fs.FileSystem, org.apache.hadoop.hbase.HBaseConfiguration, org.apache.hadoop.hbase.HRegionInfo, FlushRequester) * @see HRegion#newHRegion(Path, HLog, FileSystem, Configuration, org.apache.hadoop.hbase.HRegionInfo, FlushRequester)
*/ */
public HRegion(Path basedir, HLog log, FileSystem fs, Configuration conf, public HRegion(Path basedir, HLog log, FileSystem fs, Configuration conf,
@ -1231,7 +1231,6 @@ public class HRegion implements HConstants, HeapSize { // , Writable{
checkResources(); checkResources();
Integer lid = null; Integer lid = null;
splitsAndClosesLock.readLock().lock(); splitsAndClosesLock.readLock().lock();
Integer lid = null;
try { try {
byte [] row = delete.getRow(); byte [] row = delete.getRow();
// If we did not pass an existing row lock, obtain a new one // If we did not pass an existing row lock, obtain a new one
@ -1943,6 +1942,8 @@ public class HRegion implements HConstants, HeapSize { // , Writable{
} else { } else {
this.stopRow = scan.getStopRow(); this.stopRow = scan.getStopRow();
} }
// If we are doing a get, we want to be [startRow,endRow] normally
// it is [startRow,endRow) and if startRow=endRow we get nothing.
this.isScan = scan.isGetScan() ? -1 : 0; this.isScan = scan.isGetScan() ? -1 : 0;
List<KeyValueScanner> scanners = new ArrayList<KeyValueScanner>(); List<KeyValueScanner> scanners = new ArrayList<KeyValueScanner>();
@ -2035,8 +2036,8 @@ public class HRegion implements HConstants, HeapSize { // , Writable{
filterCurrentRow = false; filterCurrentRow = false;
// See if we passed stopRow // See if we passed stopRow
if (this.stopRow != null && if (this.stopRow != null &&
comparator.compareRows(this.stopRow, 0, this.stopRow.length, comparator.compareRows(this.stopRow, 0, this.stopRow.length,
currentRow, 0, currentRow.length) <= 0) { currentRow, 0, currentRow.length) <= this.isScan) {
return false; return false;
} }
if (hasResults()) return true; if (hasResults()) return true;

View File

@ -34,7 +34,6 @@ public class ScanQueryMatcher extends QueryMatcher {
// Optimization so we can skip lots of compares when we decide to skip // Optimization so we can skip lots of compares when we decide to skip
// to the next row. // to the next row.
private boolean stickyNextRow; private boolean stickyNextRow;
private KeyValue stopKey = null;
/** /**
* Constructs a QueryMatcher for a Scan. * Constructs a QueryMatcher for a Scan.
@ -52,11 +51,6 @@ public class ScanQueryMatcher extends QueryMatcher {
this.rowComparator = rowComparator; this.rowComparator = rowComparator;
this.deletes = new ScanDeleteTracker(); this.deletes = new ScanDeleteTracker();
this.startKey = KeyValue.createFirstOnRow(scan.getStartRow()); this.startKey = KeyValue.createFirstOnRow(scan.getStartRow());
if (scan.isGetScan()) {
this.stopKey = KeyValue.createLastOnRow(scan.getStopRow());
} else {
this.stopKey = KeyValue.createFirstOnRow(scan.getStopRow());
}
this.filter = scan.getFilter(); this.filter = scan.getFilter();
// Single branch to deal with two types of reads (columns vs all in family) // Single branch to deal with two types of reads (columns vs all in family)

View File

@ -2131,7 +2131,7 @@ public class TestHRegion extends HBaseTestCase {
public void testWritesWhileGetting() public void testWritesWhileGetting()
throws IOException, InterruptedException { throws IOException, InterruptedException {
byte[] tableName = Bytes.toBytes("testWritesWhileScanning"); byte[] tableName = Bytes.toBytes("testWritesWhileScanning");
int testCount = 200; int testCount = 100;
int numRows = 1; int numRows = 1;
int numFamilies = 10; int numFamilies = 10;
int numQualifiers = 100; int numQualifiers = 100;