HBASE-2270 Improve how we handle recursive calls in ExplicitColumnTracker

and WildcardColumnTracker



git-svn-id: https://svn.apache.org/repos/asf/hadoop/hbase/trunk@929332 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jean-Daniel Cryans 2010-03-30 22:56:21 +00:00
parent 843bfd31b7
commit 7784ad0762
3 changed files with 15 additions and 23 deletions

View File

@ -472,6 +472,8 @@ Release 0.21.0 - Unreleased
HBASE-2374 TableInputFormat - Configurable parameter to add column families HBASE-2374 TableInputFormat - Configurable parameter to add column families
(Kay Kay via Stack) (Kay Kay via Stack)
HBASE-2388 Give a very explicit message when we figure a big GC pause HBASE-2388 Give a very explicit message when we figure a big GC pause
HBASE-2270 Improve how we handle recursive calls in ExplicitColumnTracker
and WildcardColumnTracker
NEW FEATURES NEW FEATURES
HBASE-1961 HBase EC2 scripts HBASE-1961 HBase EC2 scripts

View File

@ -83,7 +83,6 @@ public class ExplicitColumnTracker implements ColumnTracker {
* @return MatchCode telling QueryMatcher what action to take * @return MatchCode telling QueryMatcher what action to take
*/ */
public MatchCode checkColumn(byte [] bytes, int offset, int length) { public MatchCode checkColumn(byte [] bytes, int offset, int length) {
boolean recursive = false;
do { do {
// No more columns left, we are done with this query // No more columns left, we are done with this query
if(this.columns.size() == 0) { if(this.columns.size() == 0) {
@ -114,6 +113,12 @@ public class ExplicitColumnTracker implements ColumnTracker {
return MatchCode.INCLUDE; return MatchCode.INCLUDE;
} }
if (ret > 0) {
// Specified column is smaller than the current, skip to next column.
return MatchCode.SKIP;
}
// Specified column is bigger than current column // Specified column is bigger than current column
// Move down current column and check again // Move down current column and check again
if(ret <= -1) { if(ret <= -1) {
@ -121,15 +126,10 @@ public class ExplicitColumnTracker implements ColumnTracker {
// No more to match, do not include, done with storefile // No more to match, do not include, done with storefile
return MatchCode.NEXT; // done_row return MatchCode.NEXT; // done_row
} }
// This is the recursive case.
this.column = this.columns.get(this.index); this.column = this.columns.get(this.index);
recursive = true;
continue;
} }
} while(recursive); } while(true);
// Specified column is smaller than current column
// Skip
return MatchCode.SKIP; // skip to next column, with hint?
} }
/** /**

View File

@ -89,9 +89,7 @@ public class WildcardColumnTracker implements ColumnTracker {
* @return MatchCode telling QueryMatcher what action to take * @return MatchCode telling QueryMatcher what action to take
*/ */
public MatchCode checkColumn(byte [] bytes, int offset, int length) { public MatchCode checkColumn(byte [] bytes, int offset, int length) {
boolean recursive = false;
do { do {
// Nothing to match against, add to new and include // Nothing to match against, add to new and include
if(this.column == null && this.newColumn == null) { if(this.column == null && this.newColumn == null) {
newColumns.add(new ColumnCount(bytes, offset, length, 1)); newColumns.add(new ColumnCount(bytes, offset, length, 1));
@ -121,9 +119,8 @@ public class WildcardColumnTracker implements ColumnTracker {
this.newColumn = newColumns.get(newIndex); this.newColumn = newColumns.get(newIndex);
return MatchCode.INCLUDE; return MatchCode.INCLUDE;
} }
// recursive case
this.newColumn = newColumns.get(newIndex); this.newColumn = newColumns.get(newIndex);
//return checkColumn(bytes, offset, length);
recursive = true;
continue; continue;
} }
@ -158,9 +155,8 @@ public class WildcardColumnTracker implements ColumnTracker {
this.column = null; this.column = null;
return MatchCode.INCLUDE; return MatchCode.INCLUDE;
} }
// recursive case
this.column = columns.get(index); this.column = columns.get(index);
//return checkColumn(bytes, offset, length);
recursive = true;
continue; continue;
} }
@ -199,8 +195,7 @@ public class WildcardColumnTracker implements ColumnTracker {
} else { } else {
this.column = columns.get(index); this.column = columns.get(index);
} }
//return checkColumn(bytes, offset, length); // Recursive case
recursive = true;
continue; continue;
} }
@ -234,8 +229,7 @@ public class WildcardColumnTracker implements ColumnTracker {
} else { } else {
this.newColumn = newColumns.get(newIndex); this.newColumn = newColumns.get(newIndex);
} }
//return checkColumn(bytes, offset, length); // Recursive case
recursive = true;
continue; continue;
} }
@ -245,11 +239,7 @@ public class WildcardColumnTracker implements ColumnTracker {
newColumns.add(new ColumnCount(bytes, offset, length, 1)); newColumns.add(new ColumnCount(bytes, offset, length, 1));
return MatchCode.INCLUDE; return MatchCode.INCLUDE;
} }
} while(recursive); } while(true);
// No match happened, add to new and include
newColumns.add(new ColumnCount(bytes, offset, length, 1));
return MatchCode.INCLUDE;
} }
/** /**