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-1206 Scanner spins when there are concurrent inserts to column family
HBASE-1536 Controlled crash of regionserver not hosting meta/root leaves master HBASE-1536 Controlled crash of regionserver not hosting meta/root leaves master
in spinning state, regions not reassigned in spinning state, regions not reassigned
HBASE-1543 Unnecessary toString during scanning costs us some CPU
IMPROVEMENTS IMPROVEMENTS
HBASE-1089 Add count of regions on filesystem to master UI; add percentage 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; package org.apache.hadoop.hbase.regionserver;
import java.util.NavigableSet;
import org.apache.hadoop.hbase.KeyValue; import org.apache.hadoop.hbase.KeyValue;
import org.apache.hadoop.hbase.client.Scan; import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.filter.Filter; import org.apache.hadoop.hbase.filter.Filter;
import org.apache.hadoop.hbase.filter.RowFilterInterface; import org.apache.hadoop.hbase.filter.RowFilterInterface;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.hadoop.hbase.filter.Filter.ReturnCode; import org.apache.hadoop.hbase.filter.Filter.ReturnCode;
import org.apache.hadoop.hbase.util.Bytes;
import java.io.IOException;
import java.util.NavigableSet;
/** /**
* A query matcher that is specifically designed for the scan case. * A query matcher that is specifically designed for the scan case.
@ -94,11 +93,9 @@ public class ScanQueryMatcher extends QueryMatcher {
return MatchCode.DONE_SCAN; return MatchCode.DONE_SCAN;
} }
String kvStr = kv.toString();
byte [] bytes = kv.getBuffer(); byte [] bytes = kv.getBuffer();
int offset = kv.getOffset(); int offset = kv.getOffset();
int initialOffset = offset; int initialOffset = offset;
int kvLength = kv.getLength();
int keyLength = Bytes.toInt(bytes, offset, Bytes.SIZEOF_INT); int keyLength = Bytes.toInt(bytes, offset, Bytes.SIZEOF_INT);
offset += KeyValue.ROW_OFFSET; offset += KeyValue.ROW_OFFSET;
@ -171,13 +168,11 @@ public class ScanQueryMatcher extends QueryMatcher {
return MatchCode.SKIP; return MatchCode.SKIP;
} }
if (deletes.isDeleted(bytes, offset, if (deletes.isDeleted(bytes, offset, qualLength, timestamp)) {
qualLength, timestamp)) {
return MatchCode.SKIP; return MatchCode.SKIP;
} }
MatchCode colChecker = MatchCode colChecker = columns.checkColumn(bytes, offset, qualLength);
columns.checkColumn(bytes, offset, qualLength);
// if SKIP -> SEEK_NEXT_COL // if SKIP -> SEEK_NEXT_COL
// if (NEXT,DONE) -> SEEK_NEXT_ROW // if (NEXT,DONE) -> SEEK_NEXT_ROW
@ -202,8 +197,7 @@ public class ScanQueryMatcher extends QueryMatcher {
if (filterResponse == ReturnCode.SKIP) if (filterResponse == ReturnCode.SKIP)
return MatchCode.SKIP; return MatchCode.SKIP;
// else // else if (filterResponse == ReturnCode.NEXT_ROW)
//if (filterResponse == ReturnCode.NEXT_ROW)
stickyNextRow = true; stickyNextRow = true;
return MatchCode.SEEK_NEXT_ROW; return MatchCode.SEEK_NEXT_ROW;
} }
@ -215,9 +209,7 @@ public class ScanQueryMatcher extends QueryMatcher {
* @return <code>true</code> if the row should be filtered. * @return <code>true</code> if the row should be filtered.
*/ */
public boolean filterEntireRow() { public boolean filterEntireRow() {
if (filter == null) return filter == null? false: filter.filterRow();
return false;
return filter.filterRow();
} }
/** /**
@ -229,13 +221,12 @@ public class ScanQueryMatcher extends QueryMatcher {
this.row = row; this.row = row;
reset(); reset();
} }
@Override @Override
public void reset() { public void reset() {
super.reset(); super.reset();
stickyNextRow = false; stickyNextRow = false;
if (filter != null) if (filter != null)
filter.reset(); filter.reset();
} }
} }