HBSAE-3174 Add ability for Get operations to enable/disable use of block caching

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1029115 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Jonathan Gray 2010-10-30 16:51:30 +00:00
parent 93588c8cfc
commit 8f3c1a5bc4
4 changed files with 33 additions and 5 deletions

View File

@ -1063,6 +1063,8 @@ Release 0.21.0 - Unreleased
(Nicolas Spiegelberg via Stack) (Nicolas Spiegelberg via Stack)
HBASE-3169 NPE when master joins running cluster if a RIT references HBASE-3169 NPE when master joins running cluster if a RIT references
a RS no longer present a RS no longer present
HBASE-3174 Add ability for Get operations to enable/disable use of block
caching
NEW FEATURES NEW FEATURES
HBASE-1961 HBase EC2 scripts HBASE-1961 HBase EC2 scripts

View File

@ -66,6 +66,7 @@ public class Get implements Writable, Row, Comparable<Row> {
private byte [] row = null; private byte [] row = null;
private long lockId = -1L; private long lockId = -1L;
private int maxVersions = 1; private int maxVersions = 1;
private boolean cacheBlocks = true;
private Filter filter = null; private Filter filter = null;
private TimeRange tr = new TimeRange(); private TimeRange tr = new TimeRange();
private Map<byte [], NavigableSet<byte []>> familyMap = private Map<byte [], NavigableSet<byte []>> familyMap =
@ -203,6 +204,29 @@ public class Get implements Writable, Row, Comparable<Row> {
return this.filter; return this.filter;
} }
/**
* Set whether blocks should be cached for this Get.
* <p>
* This is true by default. When true, default settings of the table and
* family are used (this will never override caching blocks if the block
* cache is disabled for that family or entirely).
*
* @param cacheBlocks if false, default settings are overridden and blocks
* will not be cached
*/
public void setCacheBlocks(boolean cacheBlocks) {
this.cacheBlocks = cacheBlocks;
}
/**
* Get whether blocks should be cached for this Get.
* @return true if default caching should be used, false if blocks should not
* be cached
*/
public boolean getCacheBlocks() {
return cacheBlocks;
}
/** /**
* Method for retrieving the get's row * Method for retrieving the get's row
* @return row * @return row
@ -285,6 +309,8 @@ public class Get implements Writable, Row, Comparable<Row> {
sb.append(Bytes.toString(this.row)); sb.append(Bytes.toString(this.row));
sb.append(", maxVersions="); sb.append(", maxVersions=");
sb.append("").append(this.maxVersions); sb.append("").append(this.maxVersions);
sb.append(", cacheBlocks=");
sb.append(this.cacheBlocks);
sb.append(", timeRange="); sb.append(", timeRange=");
sb.append("[").append(this.tr.getMin()).append(","); sb.append("[").append(this.tr.getMin()).append(",");
sb.append(this.tr.getMax()).append(")"); sb.append(this.tr.getMax()).append(")");
@ -345,6 +371,7 @@ public class Get implements Writable, Row, Comparable<Row> {
this.filter = (Filter)createForName(Bytes.toString(Bytes.readByteArray(in))); this.filter = (Filter)createForName(Bytes.toString(Bytes.readByteArray(in)));
this.filter.readFields(in); this.filter.readFields(in);
} }
this.cacheBlocks = in.readBoolean();
this.tr = new TimeRange(); this.tr = new TimeRange();
tr.readFields(in); tr.readFields(in);
int numFamilies = in.readInt(); int numFamilies = in.readInt();
@ -379,6 +406,7 @@ public class Get implements Writable, Row, Comparable<Row> {
Bytes.writeByteArray(out, Bytes.toBytes(filter.getClass().getName())); Bytes.writeByteArray(out, Bytes.toBytes(filter.getClass().getName()));
filter.write(out); filter.write(out);
} }
out.writeBoolean(this.cacheBlocks);
tr.write(out); tr.write(out);
out.writeInt(familyMap.size()); out.writeInt(familyMap.size());
for(Map.Entry<byte [], NavigableSet<byte []>> entry : for(Map.Entry<byte [], NavigableSet<byte []>> entry :

View File

@ -163,6 +163,7 @@ public class Scan implements Writable {
this.startRow = get.getRow(); this.startRow = get.getRow();
this.stopRow = get.getRow(); this.stopRow = get.getRow();
this.filter = get.getFilter(); this.filter = get.getFilter();
this.cacheBlocks = get.getCacheBlocks();
this.maxVersions = get.getMaxVersions(); this.maxVersions = get.getMaxVersions();
this.tr = get.getTimeRange(); this.tr = get.getTimeRange();
this.familyMap = get.getFamilyMap(); this.familyMap = get.getFamilyMap();

View File

@ -77,11 +77,8 @@ public interface HBaseRPCProtocolVersion extends VersionedProtocol {
* <li>Version 23: HBASE-2066, multi-put.</li> * <li>Version 23: HBASE-2066, multi-put.</li>
* <li>Version 24: HBASE-2473, create table with regions.</li> * <li>Version 24: HBASE-2473, create table with regions.</li>
* <li>Version 25: Added openRegion and Stoppable/Abortable to API.</li> * <li>Version 25: Added openRegion and Stoppable/Abortable to API.</li>
* <li>Version 26: New master.</li> * <li>Version 26: New master and Increment, 0.90 version bump.</li>
* REVERTED TO 25 TEMPORARILY -- TESTTABLEMAPREDUCE IS FAILING WITH
* HBaseRPC$VersionMismatch: Protocol org.apache.hadoop.hbase.ipc.HRegionInterface version mismatch. (client = 26, server = 25)
* ON HUDSON.
* </ul> * </ul>
*/ */
public static final long versionID = 25L; public static final long versionID = 26L;
} }