Author: jgray
Date: Sat Oct 30 16:51:30 2010
New Revision: 1029115

URL: http://svn.apache.org/viewvc?rev=1029115&view=rev
Log:
HBSAE-3174 Add ability for Get operations to enable/disable use of block caching

Modified:
    hbase/trunk/CHANGES.txt
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/Get.java
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/Scan.java
    
hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HBaseRPCProtocolVersion.java

Modified: hbase/trunk/CHANGES.txt
URL: 
http://svn.apache.org/viewvc/hbase/trunk/CHANGES.txt?rev=1029115&r1=1029114&r2=1029115&view=diff
==============================================================================
--- hbase/trunk/CHANGES.txt (original)
+++ hbase/trunk/CHANGES.txt Sat Oct 30 16:51:30 2010
@@ -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

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/Get.java
URL: 
http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/Get.java?rev=1029115&r1=1029114&r2=1029115&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/Get.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/Get.java Sat Oct 
30 16:51:30 2010
@@ -66,6 +66,7 @@ public class Get implements Writable, Ro
   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<byte [], NavigableSet<byte []>> familyMap =
@@ -204,6 +205,29 @@ public class Get implements Writable, Ro
   }
 
   /**
+   * 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
    * @return row
    */
@@ -285,6 +309,8 @@ public class Get implements Writable, Ro
     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, Ro
       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, Ro
       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<byte [], NavigableSet<byte []>> entry :

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/Scan.java
URL: 
http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/Scan.java?rev=1029115&r1=1029114&r2=1029115&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/Scan.java 
(original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/client/Scan.java Sat Oct 
30 16:51:30 2010
@@ -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();

Modified: 
hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HBaseRPCProtocolVersion.java
URL: 
http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HBaseRPCProtocolVersion.java?rev=1029115&r1=1029114&r2=1029115&view=diff
==============================================================================
--- 
hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HBaseRPCProtocolVersion.java
 (original)
+++ 
hbase/trunk/src/main/java/org/apache/hadoop/hbase/ipc/HBaseRPCProtocolVersion.java
 Sat Oct 30 16:51:30 2010
@@ -77,11 +77,8 @@ public interface HBaseRPCProtocolVersion
    * <li>Version 23: HBASE-2066, multi-put.</li>
    * <li>Version 24: HBASE-2473, create table with regions.</li>
    * <li>Version 25: Added openRegion and Stoppable/Abortable to API.</li>
-   * <li>Version 26: New master.</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.
+   * <li>Version 26: New master and Increment, 0.90 version bump.</li>
    * </ul>
    */
-  public static final long versionID = 25L;
+  public static final long versionID = 26L;
 }


Reply via email to