diff --git a/CHANGES.txt b/CHANGES.txt index 9a3d197da3b..c80828cfe5d 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -1063,6 +1063,8 @@ Release 0.21.0 - Unreleased (Nicolas Spiegelberg via Stack) HBASE-3169 NPE when master joins running cluster if a RIT references a RS no longer present + HBASE-3174 Add ability for Get operations to enable/disable use of block + caching NEW FEATURES HBASE-1961 HBase EC2 scripts diff --git a/src/main/java/org/apache/hadoop/hbase/client/Get.java b/src/main/java/org/apache/hadoop/hbase/client/Get.java index 50647a1be79..05479337a78 100644 --- a/src/main/java/org/apache/hadoop/hbase/client/Get.java +++ b/src/main/java/org/apache/hadoop/hbase/client/Get.java @@ -66,6 +66,7 @@ public class Get implements Writable, Row, Comparable { private byte [] row = null; private long lockId = -1L; private int maxVersions = 1; + private boolean cacheBlocks = true; private Filter filter = null; private TimeRange tr = new TimeRange(); private Map> familyMap = @@ -203,6 +204,29 @@ public class Get implements Writable, Row, Comparable { return this.filter; } + /** + * Set whether blocks should be cached for this Get. + *

+ * 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 * @return row @@ -285,6 +309,8 @@ public class Get implements Writable, Row, Comparable { sb.append(Bytes.toString(this.row)); sb.append(", maxVersions="); sb.append("").append(this.maxVersions); + sb.append(", cacheBlocks="); + sb.append(this.cacheBlocks); sb.append(", timeRange="); sb.append("[").append(this.tr.getMin()).append(","); sb.append(this.tr.getMax()).append(")"); @@ -345,6 +371,7 @@ public class Get implements Writable, Row, Comparable { this.filter = (Filter)createForName(Bytes.toString(Bytes.readByteArray(in))); this.filter.readFields(in); } + this.cacheBlocks = in.readBoolean(); this.tr = new TimeRange(); tr.readFields(in); int numFamilies = in.readInt(); @@ -379,6 +406,7 @@ public class Get implements Writable, Row, Comparable { Bytes.writeByteArray(out, Bytes.toBytes(filter.getClass().getName())); filter.write(out); } + out.writeBoolean(this.cacheBlocks); tr.write(out); out.writeInt(familyMap.size()); for(Map.Entry> entry : diff --git a/src/main/java/org/apache/hadoop/hbase/client/Scan.java b/src/main/java/org/apache/hadoop/hbase/client/Scan.java index d402ad6ed90..97e01f90ed1 100644 --- a/src/main/java/org/apache/hadoop/hbase/client/Scan.java +++ b/src/main/java/org/apache/hadoop/hbase/client/Scan.java @@ -163,6 +163,7 @@ public class Scan implements Writable { this.startRow = get.getRow(); this.stopRow = get.getRow(); this.filter = get.getFilter(); + this.cacheBlocks = get.getCacheBlocks(); this.maxVersions = get.getMaxVersions(); this.tr = get.getTimeRange(); this.familyMap = get.getFamilyMap(); diff --git a/src/main/java/org/apache/hadoop/hbase/ipc/HBaseRPCProtocolVersion.java b/src/main/java/org/apache/hadoop/hbase/ipc/HBaseRPCProtocolVersion.java index 90aefe7d632..fcdc113e277 100644 --- a/src/main/java/org/apache/hadoop/hbase/ipc/HBaseRPCProtocolVersion.java +++ b/src/main/java/org/apache/hadoop/hbase/ipc/HBaseRPCProtocolVersion.java @@ -77,11 +77,8 @@ public interface HBaseRPCProtocolVersion extends VersionedProtocol { *

  • Version 23: HBASE-2066, multi-put.
  • *
  • Version 24: HBASE-2473, create table with regions.
  • *
  • Version 25: Added openRegion and Stoppable/Abortable to API.
  • - *
  • Version 26: New master.
  • - * 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. + *
  • Version 26: New master and Increment, 0.90 version bump.
  • * */ - public static final long versionID = 25L; + public static final long versionID = 26L; }