HBASE-1543 Unnecessary toString during scanning costs us some CPU

git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@786338 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Stack 2009-06-19 00:02:07 +00:00
parent 4cd468ff51
commit eb68e5c053
2 changed files with 11 additions and 19 deletions

View File

@ -198,6 +198,7 @@ Release 0.20.0 - Unreleased
HBASE-1206 Scanner spins when there are concurrent inserts to column family
HBASE-1536 Controlled crash of regionserver not hosting meta/root leaves master
in spinning state, regions not reassigned
HBASE-1543 Unnecessary toString during scanning costs us some CPU
IMPROVEMENTS
HBASE-1089 Add count of regions on filesystem to master UI; add percentage

View File

@ -20,15 +20,14 @@
package org.apache.hadoop.hbase.regionserver;
import java.util.NavigableSet;
import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.filter.Filter;
import org.apache.hadoop.hbase.filter.RowFilterInterface;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.filter.Filter.ReturnCode;
import java.io.IOException;
import java.util.NavigableSet;
import org.apache.hadoop.hbase.util.Bytes;
/**
* A query matcher that is specifically designed for the scan case.
@ -94,11 +93,9 @@ public class ScanQueryMatcher extends QueryMatcher {
return MatchCode.DONE_SCAN;
}
String kvStr = kv.toString();
byte [] bytes = kv.getBuffer();
int offset = kv.getOffset();
int initialOffset = offset;
int kvLength = kv.getLength();
int keyLength = Bytes.toInt(bytes, offset, Bytes.SIZEOF_INT);
offset += KeyValue.ROW_OFFSET;
@ -171,13 +168,11 @@ public class ScanQueryMatcher extends QueryMatcher {
return MatchCode.SKIP;
}
if (deletes.isDeleted(bytes, offset,
qualLength, timestamp)) {
if (deletes.isDeleted(bytes, offset, qualLength, timestamp)) {
return MatchCode.SKIP;
}
MatchCode colChecker =
columns.checkColumn(bytes, offset, qualLength);
MatchCode colChecker = columns.checkColumn(bytes, offset, qualLength);
// if SKIP -> SEEK_NEXT_COL
// if (NEXT,DONE) -> SEEK_NEXT_ROW
@ -202,8 +197,7 @@ public class ScanQueryMatcher extends QueryMatcher {
if (filterResponse == ReturnCode.SKIP)
return MatchCode.SKIP;
// else
//if (filterResponse == ReturnCode.NEXT_ROW)
// else if (filterResponse == ReturnCode.NEXT_ROW)
stickyNextRow = true;
return MatchCode.SEEK_NEXT_ROW;
}
@ -215,9 +209,7 @@ public class ScanQueryMatcher extends QueryMatcher {
* @return <code>true</code> if the row should be filtered.
*/
public boolean filterEntireRow() {
if (filter == null)
return false;
return filter.filterRow();
return filter == null? false: filter.filterRow();
}
/**
@ -233,7 +225,6 @@ public class ScanQueryMatcher extends QueryMatcher {
@Override
public void reset() {
super.reset();
stickyNextRow = false;
if (filter != null)
filter.reset();