You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by ap...@apache.org on 2018/08/07 21:53:28 UTC

[5/6] hbase git commit: HBASE-20845 Support set the consistency for Gets and Scans in thrift2

http://git-wip-us.apache.org/repos/asf/hbase/blob/85103316/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TResult.java
----------------------------------------------------------------------
diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TResult.java b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TResult.java
index ff8d5ff..ea93741 100644
--- a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TResult.java
+++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TResult.java
@@ -37,12 +37,13 @@ import org.slf4j.LoggerFactory;
 /**
  * if no Result is found, row and columnValues will not be set.
  */
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-05-27")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2018-08-07")
 public class TResult implements org.apache.thrift.TBase<TResult, TResult._Fields>, java.io.Serializable, Cloneable, Comparable<TResult> {
   private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TResult");
 
   private static final org.apache.thrift.protocol.TField ROW_FIELD_DESC = new org.apache.thrift.protocol.TField("row", org.apache.thrift.protocol.TType.STRING, (short)1);
   private static final org.apache.thrift.protocol.TField COLUMN_VALUES_FIELD_DESC = new org.apache.thrift.protocol.TField("columnValues", org.apache.thrift.protocol.TType.LIST, (short)2);
+  private static final org.apache.thrift.protocol.TField STALE_FIELD_DESC = new org.apache.thrift.protocol.TField("stale", org.apache.thrift.protocol.TType.BOOL, (short)3);
 
   private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
   static {
@@ -52,11 +53,13 @@ public class TResult implements org.apache.thrift.TBase<TResult, TResult._Fields
 
   public ByteBuffer row; // optional
   public List<TColumnValue> columnValues; // required
+  public boolean stale; // optional
 
   /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
   public enum _Fields implements org.apache.thrift.TFieldIdEnum {
     ROW((short)1, "row"),
-    COLUMN_VALUES((short)2, "columnValues");
+    COLUMN_VALUES((short)2, "columnValues"),
+    STALE((short)3, "stale");
 
     private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
 
@@ -75,6 +78,8 @@ public class TResult implements org.apache.thrift.TBase<TResult, TResult._Fields
           return ROW;
         case 2: // COLUMN_VALUES
           return COLUMN_VALUES;
+        case 3: // STALE
+          return STALE;
         default:
           return null;
       }
@@ -115,7 +120,9 @@ public class TResult implements org.apache.thrift.TBase<TResult, TResult._Fields
   }
 
   // isset id assignments
-  private static final _Fields optionals[] = {_Fields.ROW};
+  private static final int __STALE_ISSET_ID = 0;
+  private byte __isset_bitfield = 0;
+  private static final _Fields optionals[] = {_Fields.ROW,_Fields.STALE};
   public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
   static {
     Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
@@ -124,11 +131,15 @@ public class TResult implements org.apache.thrift.TBase<TResult, TResult._Fields
     tmpMap.put(_Fields.COLUMN_VALUES, new org.apache.thrift.meta_data.FieldMetaData("columnValues", org.apache.thrift.TFieldRequirementType.REQUIRED, 
         new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
             new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TColumnValue.class))));
+    tmpMap.put(_Fields.STALE, new org.apache.thrift.meta_data.FieldMetaData("stale", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
     metaDataMap = Collections.unmodifiableMap(tmpMap);
     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TResult.class, metaDataMap);
   }
 
   public TResult() {
+    this.stale = false;
+
   }
 
   public TResult(
@@ -142,6 +153,7 @@ public class TResult implements org.apache.thrift.TBase<TResult, TResult._Fields
    * Performs a deep copy on <i>other</i>.
    */
   public TResult(TResult other) {
+    __isset_bitfield = other.__isset_bitfield;
     if (other.isSetRow()) {
       this.row = org.apache.thrift.TBaseHelper.copyBinary(other.row);
     }
@@ -152,6 +164,7 @@ public class TResult implements org.apache.thrift.TBase<TResult, TResult._Fields
       }
       this.columnValues = __this__columnValues;
     }
+    this.stale = other.stale;
   }
 
   public TResult deepCopy() {
@@ -162,6 +175,8 @@ public class TResult implements org.apache.thrift.TBase<TResult, TResult._Fields
   public void clear() {
     this.row = null;
     this.columnValues = null;
+    this.stale = false;
+
   }
 
   public byte[] getRow() {
@@ -237,6 +252,29 @@ public class TResult implements org.apache.thrift.TBase<TResult, TResult._Fields
     }
   }
 
+  public boolean isStale() {
+    return this.stale;
+  }
+
+  public TResult setStale(boolean stale) {
+    this.stale = stale;
+    setStaleIsSet(true);
+    return this;
+  }
+
+  public void unsetStale() {
+    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __STALE_ISSET_ID);
+  }
+
+  /** Returns true if field stale is set (has been assigned a value) and false otherwise */
+  public boolean isSetStale() {
+    return EncodingUtils.testBit(__isset_bitfield, __STALE_ISSET_ID);
+  }
+
+  public void setStaleIsSet(boolean value) {
+    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __STALE_ISSET_ID, value);
+  }
+
   public void setFieldValue(_Fields field, Object value) {
     switch (field) {
     case ROW:
@@ -255,6 +293,14 @@ public class TResult implements org.apache.thrift.TBase<TResult, TResult._Fields
       }
       break;
 
+    case STALE:
+      if (value == null) {
+        unsetStale();
+      } else {
+        setStale((Boolean)value);
+      }
+      break;
+
     }
   }
 
@@ -266,6 +312,9 @@ public class TResult implements org.apache.thrift.TBase<TResult, TResult._Fields
     case COLUMN_VALUES:
       return getColumnValues();
 
+    case STALE:
+      return isStale();
+
     }
     throw new IllegalStateException();
   }
@@ -281,6 +330,8 @@ public class TResult implements org.apache.thrift.TBase<TResult, TResult._Fields
       return isSetRow();
     case COLUMN_VALUES:
       return isSetColumnValues();
+    case STALE:
+      return isSetStale();
     }
     throw new IllegalStateException();
   }
@@ -316,6 +367,15 @@ public class TResult implements org.apache.thrift.TBase<TResult, TResult._Fields
         return false;
     }
 
+    boolean this_present_stale = true && this.isSetStale();
+    boolean that_present_stale = true && that.isSetStale();
+    if (this_present_stale || that_present_stale) {
+      if (!(this_present_stale && that_present_stale))
+        return false;
+      if (this.stale != that.stale)
+        return false;
+    }
+
     return true;
   }
 
@@ -333,6 +393,11 @@ public class TResult implements org.apache.thrift.TBase<TResult, TResult._Fields
     if (present_columnValues)
       list.add(columnValues);
 
+    boolean present_stale = true && (isSetStale());
+    list.add(present_stale);
+    if (present_stale)
+      list.add(stale);
+
     return list.hashCode();
   }
 
@@ -364,6 +429,16 @@ public class TResult implements org.apache.thrift.TBase<TResult, TResult._Fields
         return lastComparison;
       }
     }
+    lastComparison = Boolean.valueOf(isSetStale()).compareTo(other.isSetStale());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetStale()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.stale, other.stale);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
     return 0;
   }
 
@@ -401,6 +476,12 @@ public class TResult implements org.apache.thrift.TBase<TResult, TResult._Fields
       sb.append(this.columnValues);
     }
     first = false;
+    if (isSetStale()) {
+      if (!first) sb.append(", ");
+      sb.append("stale:");
+      sb.append(this.stale);
+      first = false;
+    }
     sb.append(")");
     return sb.toString();
   }
@@ -423,6 +504,8 @@ public class TResult implements org.apache.thrift.TBase<TResult, TResult._Fields
 
   private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
     try {
+      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
+      __isset_bitfield = 0;
       read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
     } catch (org.apache.thrift.TException te) {
       throw new java.io.IOException(te);
@@ -474,6 +557,14 @@ public class TResult implements org.apache.thrift.TBase<TResult, TResult._Fields
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
+          case 3: // STALE
+            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
+              struct.stale = iprot.readBool();
+              struct.setStaleIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
           default:
             org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
         }
@@ -508,6 +599,11 @@ public class TResult implements org.apache.thrift.TBase<TResult, TResult._Fields
         }
         oprot.writeFieldEnd();
       }
+      if (struct.isSetStale()) {
+        oprot.writeFieldBegin(STALE_FIELD_DESC);
+        oprot.writeBool(struct.stale);
+        oprot.writeFieldEnd();
+      }
       oprot.writeFieldStop();
       oprot.writeStructEnd();
     }
@@ -536,10 +632,16 @@ public class TResult implements org.apache.thrift.TBase<TResult, TResult._Fields
       if (struct.isSetRow()) {
         optionals.set(0);
       }
-      oprot.writeBitSet(optionals, 1);
+      if (struct.isSetStale()) {
+        optionals.set(1);
+      }
+      oprot.writeBitSet(optionals, 2);
       if (struct.isSetRow()) {
         oprot.writeBinary(struct.row);
       }
+      if (struct.isSetStale()) {
+        oprot.writeBool(struct.stale);
+      }
     }
 
     @Override
@@ -557,11 +659,15 @@ public class TResult implements org.apache.thrift.TBase<TResult, TResult._Fields
         }
       }
       struct.setColumnValuesIsSet(true);
-      BitSet incoming = iprot.readBitSet(1);
+      BitSet incoming = iprot.readBitSet(2);
       if (incoming.get(0)) {
         struct.row = iprot.readBinary();
         struct.setRowIsSet(true);
       }
+      if (incoming.get(1)) {
+        struct.stale = iprot.readBool();
+        struct.setStaleIsSet(true);
+      }
     }
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/85103316/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TRowMutations.java
----------------------------------------------------------------------
diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TRowMutations.java b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TRowMutations.java
index 8a8a7b2..436ea3c 100644
--- a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TRowMutations.java
+++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TRowMutations.java
@@ -37,7 +37,7 @@ import org.slf4j.LoggerFactory;
 /**
  * A TRowMutations object is used to apply a number of Mutations to a single row.
  */
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2016-05-27")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2018-08-07")
 public class TRowMutations implements org.apache.thrift.TBase<TRowMutations, TRowMutations._Fields>, java.io.Serializable, Cloneable, Comparable<TRowMutations> {
   private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TRowMutations");
 
@@ -460,14 +460,14 @@ public class TRowMutations implements org.apache.thrift.TBase<TRowMutations, TRo
           case 2: // MUTATIONS
             if (schemeField.type == org.apache.thrift.protocol.TType.LIST) {
               {
-                org.apache.thrift.protocol.TList _list124 = iprot.readListBegin();
-                struct.mutations = new ArrayList<TMutation>(_list124.size);
-                TMutation _elem125;
-                for (int _i126 = 0; _i126 < _list124.size; ++_i126)
+                org.apache.thrift.protocol.TList _list134 = iprot.readListBegin();
+                struct.mutations = new ArrayList<TMutation>(_list134.size);
+                TMutation _elem135;
+                for (int _i136 = 0; _i136 < _list134.size; ++_i136)
                 {
-                  _elem125 = new TMutation();
-                  _elem125.read(iprot);
-                  struct.mutations.add(_elem125);
+                  _elem135 = new TMutation();
+                  _elem135.read(iprot);
+                  struct.mutations.add(_elem135);
                 }
                 iprot.readListEnd();
               }
@@ -500,9 +500,9 @@ public class TRowMutations implements org.apache.thrift.TBase<TRowMutations, TRo
         oprot.writeFieldBegin(MUTATIONS_FIELD_DESC);
         {
           oprot.writeListBegin(new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, struct.mutations.size()));
-          for (TMutation _iter127 : struct.mutations)
+          for (TMutation _iter137 : struct.mutations)
           {
-            _iter127.write(oprot);
+            _iter137.write(oprot);
           }
           oprot.writeListEnd();
         }
@@ -528,9 +528,9 @@ public class TRowMutations implements org.apache.thrift.TBase<TRowMutations, TRo
       oprot.writeBinary(struct.row);
       {
         oprot.writeI32(struct.mutations.size());
-        for (TMutation _iter128 : struct.mutations)
+        for (TMutation _iter138 : struct.mutations)
         {
-          _iter128.write(oprot);
+          _iter138.write(oprot);
         }
       }
     }
@@ -541,14 +541,14 @@ public class TRowMutations implements org.apache.thrift.TBase<TRowMutations, TRo
       struct.row = iprot.readBinary();
       struct.setRowIsSet(true);
       {
-        org.apache.thrift.protocol.TList _list129 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
-        struct.mutations = new ArrayList<TMutation>(_list129.size);
-        TMutation _elem130;
-        for (int _i131 = 0; _i131 < _list129.size; ++_i131)
+        org.apache.thrift.protocol.TList _list139 = new org.apache.thrift.protocol.TList(org.apache.thrift.protocol.TType.STRUCT, iprot.readI32());
+        struct.mutations = new ArrayList<TMutation>(_list139.size);
+        TMutation _elem140;
+        for (int _i141 = 0; _i141 < _list139.size; ++_i141)
         {
-          _elem130 = new TMutation();
-          _elem130.read(iprot);
-          struct.mutations.add(_elem130);
+          _elem140 = new TMutation();
+          _elem140.read(iprot);
+          struct.mutations.add(_elem140);
         }
       }
       struct.setMutationsIsSet(true);

http://git-wip-us.apache.org/repos/asf/hbase/blob/85103316/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TScan.java
----------------------------------------------------------------------
diff --git a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TScan.java b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TScan.java
index 50a8347..37bd325 100644
--- a/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TScan.java
+++ b/hbase-thrift/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TScan.java
@@ -38,7 +38,7 @@ import org.slf4j.LoggerFactory;
  * Any timestamps in the columns are ignored but the colFamTimeRangeMap included, use timeRange to select by timestamp.
  * Max versions defaults to 1.
  */
-@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2017-03-24")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2018-08-07")
 public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, java.io.Serializable, Cloneable, Comparable<TScan> {
   private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TScan");
 
@@ -56,6 +56,8 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
   private static final org.apache.thrift.protocol.TField CACHE_BLOCKS_FIELD_DESC = new org.apache.thrift.protocol.TField("cacheBlocks", org.apache.thrift.protocol.TType.BOOL, (short)12);
   private static final org.apache.thrift.protocol.TField COL_FAM_TIME_RANGE_MAP_FIELD_DESC = new org.apache.thrift.protocol.TField("colFamTimeRangeMap", org.apache.thrift.protocol.TType.MAP, (short)13);
   private static final org.apache.thrift.protocol.TField SMALL_FIELD_DESC = new org.apache.thrift.protocol.TField("small", org.apache.thrift.protocol.TType.BOOL, (short)14);
+  private static final org.apache.thrift.protocol.TField CONSISTENCY_FIELD_DESC = new org.apache.thrift.protocol.TField("consistency", org.apache.thrift.protocol.TType.I32, (short)16);
+  private static final org.apache.thrift.protocol.TField TARGET_REPLICA_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("targetReplicaId", org.apache.thrift.protocol.TType.I32, (short)17);
 
   private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
   static {
@@ -77,6 +79,12 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
   public boolean cacheBlocks; // optional
   public Map<ByteBuffer,TTimeRange> colFamTimeRangeMap; // optional
   public boolean small; // optional
+  /**
+   * 
+   * @see TConsistency
+   */
+  public TConsistency consistency; // optional
+  public int targetReplicaId; // optional
 
   /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
   public enum _Fields implements org.apache.thrift.TFieldIdEnum {
@@ -93,7 +101,13 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
     REVERSED((short)11, "reversed"),
     CACHE_BLOCKS((short)12, "cacheBlocks"),
     COL_FAM_TIME_RANGE_MAP((short)13, "colFamTimeRangeMap"),
-    SMALL((short)14, "small");
+    SMALL((short)14, "small"),
+    /**
+     * 
+     * @see TConsistency
+     */
+    CONSISTENCY((short)16, "consistency"),
+    TARGET_REPLICA_ID((short)17, "targetReplicaId");
 
     private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
 
@@ -136,6 +150,10 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
           return COL_FAM_TIME_RANGE_MAP;
         case 14: // SMALL
           return SMALL;
+        case 16: // CONSISTENCY
+          return CONSISTENCY;
+        case 17: // TARGET_REPLICA_ID
+          return TARGET_REPLICA_ID;
         default:
           return null;
       }
@@ -182,8 +200,9 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
   private static final int __REVERSED_ISSET_ID = 3;
   private static final int __CACHEBLOCKS_ISSET_ID = 4;
   private static final int __SMALL_ISSET_ID = 5;
+  private static final int __TARGETREPLICAID_ISSET_ID = 6;
   private byte __isset_bitfield = 0;
-  private static final _Fields optionals[] = {_Fields.START_ROW,_Fields.STOP_ROW,_Fields.COLUMNS,_Fields.CACHING,_Fields.MAX_VERSIONS,_Fields.TIME_RANGE,_Fields.FILTER_STRING,_Fields.BATCH_SIZE,_Fields.ATTRIBUTES,_Fields.AUTHORIZATIONS,_Fields.REVERSED,_Fields.CACHE_BLOCKS,_Fields.COL_FAM_TIME_RANGE_MAP,_Fields.SMALL};
+  private static final _Fields optionals[] = {_Fields.START_ROW,_Fields.STOP_ROW,_Fields.COLUMNS,_Fields.CACHING,_Fields.MAX_VERSIONS,_Fields.TIME_RANGE,_Fields.FILTER_STRING,_Fields.BATCH_SIZE,_Fields.ATTRIBUTES,_Fields.AUTHORIZATIONS,_Fields.REVERSED,_Fields.CACHE_BLOCKS,_Fields.COL_FAM_TIME_RANGE_MAP,_Fields.SMALL,_Fields.CONSISTENCY,_Fields.TARGET_REPLICA_ID};
   public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
   static {
     Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
@@ -220,6 +239,10 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
             new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TTimeRange.class))));
     tmpMap.put(_Fields.SMALL, new org.apache.thrift.meta_data.FieldMetaData("small", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
+    tmpMap.put(_Fields.CONSISTENCY, new org.apache.thrift.meta_data.FieldMetaData("consistency", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TConsistency.class)));
+    tmpMap.put(_Fields.TARGET_REPLICA_ID, new org.apache.thrift.meta_data.FieldMetaData("targetReplicaId", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
     metaDataMap = Collections.unmodifiableMap(tmpMap);
     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TScan.class, metaDataMap);
   }
@@ -281,6 +304,10 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
       this.colFamTimeRangeMap = __this__colFamTimeRangeMap;
     }
     this.small = other.small;
+    if (other.isSetConsistency()) {
+      this.consistency = other.consistency;
+    }
+    this.targetReplicaId = other.targetReplicaId;
   }
 
   public TScan deepCopy() {
@@ -309,6 +336,9 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
     this.colFamTimeRangeMap = null;
     setSmallIsSet(false);
     this.small = false;
+    this.consistency = null;
+    setTargetReplicaIdIsSet(false);
+    this.targetReplicaId = 0;
   }
 
   public byte[] getStartRow() {
@@ -708,6 +738,61 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
     __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __SMALL_ISSET_ID, value);
   }
 
+  /**
+   * 
+   * @see TConsistency
+   */
+  public TConsistency getConsistency() {
+    return this.consistency;
+  }
+
+  /**
+   * 
+   * @see TConsistency
+   */
+  public TScan setConsistency(TConsistency consistency) {
+    this.consistency = consistency;
+    return this;
+  }
+
+  public void unsetConsistency() {
+    this.consistency = null;
+  }
+
+  /** Returns true if field consistency is set (has been assigned a value) and false otherwise */
+  public boolean isSetConsistency() {
+    return this.consistency != null;
+  }
+
+  public void setConsistencyIsSet(boolean value) {
+    if (!value) {
+      this.consistency = null;
+    }
+  }
+
+  public int getTargetReplicaId() {
+    return this.targetReplicaId;
+  }
+
+  public TScan setTargetReplicaId(int targetReplicaId) {
+    this.targetReplicaId = targetReplicaId;
+    setTargetReplicaIdIsSet(true);
+    return this;
+  }
+
+  public void unsetTargetReplicaId() {
+    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __TARGETREPLICAID_ISSET_ID);
+  }
+
+  /** Returns true if field targetReplicaId is set (has been assigned a value) and false otherwise */
+  public boolean isSetTargetReplicaId() {
+    return EncodingUtils.testBit(__isset_bitfield, __TARGETREPLICAID_ISSET_ID);
+  }
+
+  public void setTargetReplicaIdIsSet(boolean value) {
+    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TARGETREPLICAID_ISSET_ID, value);
+  }
+
   public void setFieldValue(_Fields field, Object value) {
     switch (field) {
     case START_ROW:
@@ -822,6 +907,22 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
       }
       break;
 
+    case CONSISTENCY:
+      if (value == null) {
+        unsetConsistency();
+      } else {
+        setConsistency((TConsistency)value);
+      }
+      break;
+
+    case TARGET_REPLICA_ID:
+      if (value == null) {
+        unsetTargetReplicaId();
+      } else {
+        setTargetReplicaId((Integer)value);
+      }
+      break;
+
     }
   }
 
@@ -869,6 +970,12 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
     case SMALL:
       return isSmall();
 
+    case CONSISTENCY:
+      return getConsistency();
+
+    case TARGET_REPLICA_ID:
+      return getTargetReplicaId();
+
     }
     throw new IllegalStateException();
   }
@@ -908,6 +1015,10 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
       return isSetColFamTimeRangeMap();
     case SMALL:
       return isSetSmall();
+    case CONSISTENCY:
+      return isSetConsistency();
+    case TARGET_REPLICA_ID:
+      return isSetTargetReplicaId();
     }
     throw new IllegalStateException();
   }
@@ -1051,6 +1162,24 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
         return false;
     }
 
+    boolean this_present_consistency = true && this.isSetConsistency();
+    boolean that_present_consistency = true && that.isSetConsistency();
+    if (this_present_consistency || that_present_consistency) {
+      if (!(this_present_consistency && that_present_consistency))
+        return false;
+      if (!this.consistency.equals(that.consistency))
+        return false;
+    }
+
+    boolean this_present_targetReplicaId = true && this.isSetTargetReplicaId();
+    boolean that_present_targetReplicaId = true && that.isSetTargetReplicaId();
+    if (this_present_targetReplicaId || that_present_targetReplicaId) {
+      if (!(this_present_targetReplicaId && that_present_targetReplicaId))
+        return false;
+      if (this.targetReplicaId != that.targetReplicaId)
+        return false;
+    }
+
     return true;
   }
 
@@ -1128,6 +1257,16 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
     if (present_small)
       list.add(small);
 
+    boolean present_consistency = true && (isSetConsistency());
+    list.add(present_consistency);
+    if (present_consistency)
+      list.add(consistency.getValue());
+
+    boolean present_targetReplicaId = true && (isSetTargetReplicaId());
+    list.add(present_targetReplicaId);
+    if (present_targetReplicaId)
+      list.add(targetReplicaId);
+
     return list.hashCode();
   }
 
@@ -1279,6 +1418,26 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
         return lastComparison;
       }
     }
+    lastComparison = Boolean.valueOf(isSetConsistency()).compareTo(other.isSetConsistency());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetConsistency()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.consistency, other.consistency);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetTargetReplicaId()).compareTo(other.isSetTargetReplicaId());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetTargetReplicaId()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.targetReplicaId, other.targetReplicaId);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
     return 0;
   }
 
@@ -1414,6 +1573,22 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
       sb.append(this.small);
       first = false;
     }
+    if (isSetConsistency()) {
+      if (!first) sb.append(", ");
+      sb.append("consistency:");
+      if (this.consistency == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.consistency);
+      }
+      first = false;
+    }
+    if (isSetTargetReplicaId()) {
+      if (!first) sb.append(", ");
+      sb.append("targetReplicaId:");
+      sb.append(this.targetReplicaId);
+      first = false;
+    }
     sb.append(")");
     return sb.toString();
   }
@@ -1615,6 +1790,22 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
+          case 16: // CONSISTENCY
+            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+              struct.consistency = org.apache.hadoop.hbase.thrift2.generated.TConsistency.findByValue(iprot.readI32());
+              struct.setConsistencyIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 17: // TARGET_REPLICA_ID
+            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+              struct.targetReplicaId = iprot.readI32();
+              struct.setTargetReplicaIdIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
           default:
             org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
         }
@@ -1739,6 +1930,18 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
         oprot.writeBool(struct.small);
         oprot.writeFieldEnd();
       }
+      if (struct.consistency != null) {
+        if (struct.isSetConsistency()) {
+          oprot.writeFieldBegin(CONSISTENCY_FIELD_DESC);
+          oprot.writeI32(struct.consistency.getValue());
+          oprot.writeFieldEnd();
+        }
+      }
+      if (struct.isSetTargetReplicaId()) {
+        oprot.writeFieldBegin(TARGET_REPLICA_ID_FIELD_DESC);
+        oprot.writeI32(struct.targetReplicaId);
+        oprot.writeFieldEnd();
+      }
       oprot.writeFieldStop();
       oprot.writeStructEnd();
     }
@@ -1799,7 +2002,13 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
       if (struct.isSetSmall()) {
         optionals.set(13);
       }
-      oprot.writeBitSet(optionals, 14);
+      if (struct.isSetConsistency()) {
+        optionals.set(14);
+      }
+      if (struct.isSetTargetReplicaId()) {
+        optionals.set(15);
+      }
+      oprot.writeBitSet(optionals, 16);
       if (struct.isSetStartRow()) {
         oprot.writeBinary(struct.startRow);
       }
@@ -1862,12 +2071,18 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
       if (struct.isSetSmall()) {
         oprot.writeBool(struct.small);
       }
+      if (struct.isSetConsistency()) {
+        oprot.writeI32(struct.consistency.getValue());
+      }
+      if (struct.isSetTargetReplicaId()) {
+        oprot.writeI32(struct.targetReplicaId);
+      }
     }
 
     @Override
     public void read(org.apache.thrift.protocol.TProtocol prot, TScan struct) throws org.apache.thrift.TException {
       TTupleProtocol iprot = (TTupleProtocol) prot;
-      BitSet incoming = iprot.readBitSet(14);
+      BitSet incoming = iprot.readBitSet(16);
       if (incoming.get(0)) {
         struct.startRow = iprot.readBinary();
         struct.setStartRowIsSet(true);
@@ -1959,6 +2174,14 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
         struct.small = iprot.readBool();
         struct.setSmallIsSet(true);
       }
+      if (incoming.get(14)) {
+        struct.consistency = org.apache.hadoop.hbase.thrift2.generated.TConsistency.findByValue(iprot.readI32());
+        struct.setConsistencyIsSet(true);
+      }
+      if (incoming.get(15)) {
+        struct.targetReplicaId = iprot.readI32();
+        struct.setTargetReplicaIdIsSet(true);
+      }
     }
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/85103316/hbase-thrift/src/main/resources/org/apache/hadoop/hbase/thrift2/hbase.thrift
----------------------------------------------------------------------
diff --git a/hbase-thrift/src/main/resources/org/apache/hadoop/hbase/thrift2/hbase.thrift b/hbase-thrift/src/main/resources/org/apache/hadoop/hbase/thrift2/hbase.thrift
index eff92cb..af7ff96 100644
--- a/hbase-thrift/src/main/resources/org/apache/hadoop/hbase/thrift2/hbase.thrift
+++ b/hbase-thrift/src/main/resources/org/apache/hadoop/hbase/thrift2/hbase.thrift
@@ -65,7 +65,8 @@ struct TColumnIncrement {
  */
 struct TResult {
   1: optional binary row,
-  2: required list<TColumnValue> columnValues
+  2: required list<TColumnValue> columnValues,
+  3: optional bool stale = false
 }
 
 /**
@@ -99,6 +100,17 @@ struct TAuthorization {
 struct TCellVisibility {
  1: optional string expression
 }
+
+/**
+ * Specify Consistency:
+ *  - STRONG means reads only from primary region
+ *  - TIMELINE means reads might return values from secondary region replicas
+ */
+enum TConsistency {
+  STRONG = 1,
+  TIMELINE = 2
+}
+
 /**
  * Used to perform Get operations on a single row.
  *
@@ -123,6 +135,8 @@ struct TGet {
   6: optional binary filterString,
   7: optional map<binary, binary> attributes
   8: optional TAuthorization authorizations
+  9: optional TConsistency consistency
+  10: optional i32 targetReplicaId
 }
 
 /**
@@ -227,6 +241,8 @@ struct TScan {
   12: optional bool cacheBlocks
   13: optional map<binary,TTimeRange> colFamTimeRangeMap
   14: optional bool small
+  16: optional TConsistency consistency
+  17: optional i32 targetReplicaId
 }
 
 /**

http://git-wip-us.apache.org/repos/asf/hbase/blob/85103316/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandler.java
----------------------------------------------------------------------
diff --git a/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandler.java b/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandler.java
index 931f4e2..5bb77cd 100644
--- a/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandler.java
+++ b/hbase-thrift/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandler.java
@@ -31,6 +31,9 @@ import org.apache.hadoop.hbase.HColumnDescriptor;
 import org.apache.hadoop.hbase.HTableDescriptor;
 import org.apache.hadoop.hbase.TableName;
 import org.apache.hadoop.hbase.client.Admin;
+import org.apache.hadoop.hbase.client.Consistency;
+import org.apache.hadoop.hbase.client.Delete;
+import org.apache.hadoop.hbase.client.Durability;
 import org.apache.hadoop.hbase.client.Get;
 import org.apache.hadoop.hbase.client.HBaseAdmin;
 import org.apache.hadoop.hbase.client.Put;
@@ -54,6 +57,7 @@ import org.apache.hadoop.hbase.thrift2.generated.TColumn;
 import org.apache.hadoop.hbase.thrift2.generated.TColumnIncrement;
 import org.apache.hadoop.hbase.thrift2.generated.TColumnValue;
 import org.apache.hadoop.hbase.thrift2.generated.TCompareOp;
+import org.apache.hadoop.hbase.thrift2.generated.TConsistency;
 import org.apache.hadoop.hbase.thrift2.generated.TDelete;
 import org.apache.hadoop.hbase.thrift2.generated.TDeleteType;
 import org.apache.hadoop.hbase.thrift2.generated.TGet;
@@ -1461,6 +1465,37 @@ public class TestThriftHBaseServiceHandler {
     assertTColumnValueEqual(columnValueB, result.getColumnValues().get(1));
   }
 
+  @Test
+  public void testConsistency() throws Exception {
+    byte[] rowName = Bytes.toBytes("testConsistency");
+    TGet tGet = new TGet(wrap(rowName));
+    tGet.setConsistency(TConsistency.STRONG);
+    Get get = getFromThrift(tGet);
+    assertEquals(Consistency.STRONG, get.getConsistency());
+
+    tGet.setConsistency(TConsistency.TIMELINE);
+    tGet.setTargetReplicaId(1);
+    get = getFromThrift(tGet);
+    assertEquals(Consistency.TIMELINE, get.getConsistency());
+    assertEquals(1, get.getReplicaId());
+
+    TScan tScan = new TScan();
+    tScan.setConsistency(TConsistency.STRONG);
+    Scan scan = scanFromThrift(tScan);
+    assertEquals(Consistency.STRONG, scan.getConsistency());
+
+    tScan.setConsistency(TConsistency.TIMELINE);
+    tScan.setTargetReplicaId(1);
+    scan = scanFromThrift(tScan);
+    assertEquals(Consistency.TIMELINE, scan.getConsistency());
+    assertEquals(1, scan.getReplicaId());
+
+    TResult tResult = new TResult();
+    assertFalse(tResult.isSetStale());
+    tResult.setStale(true);
+    assertTrue(tResult.isSetStale());
+  }
+
   public static class DelayingRegionObserver extends BaseRegionObserver {
     private static final Log LOG = LogFactory.getLog(DelayingRegionObserver.class);
     // sleep time in msec