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:26 UTC

[3/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/1cb72aed/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 8c16012..317f9b5 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-25")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2018-07-04")
 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/1cb72aed/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 1839207..b5ece00 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-27")
+@Generated(value = "Autogenerated by Thrift Compiler (0.9.3)", date = "2018-07-03")
 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");
 
@@ -57,6 +57,8 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
   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 READ_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("readType", org.apache.thrift.protocol.TType.I32, (short)14);
   private static final org.apache.thrift.protocol.TField LIMIT_FIELD_DESC = new org.apache.thrift.protocol.TField("limit", org.apache.thrift.protocol.TType.I32, (short)15);
+  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 {
@@ -83,6 +85,12 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
    */
   public TReadType readType; // optional
   public int limit; // 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 {
@@ -104,7 +112,13 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
      * @see TReadType
      */
     READ_TYPE((short)14, "readType"),
-    LIMIT((short)15, "limit");
+    LIMIT((short)15, "limit"),
+    /**
+     * 
+     * @see TConsistency
+     */
+    CONSISTENCY((short)16, "consistency"),
+    TARGET_REPLICA_ID((short)17, "targetReplicaId");
 
     private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
 
@@ -149,6 +163,10 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
           return READ_TYPE;
         case 15: // LIMIT
           return LIMIT;
+        case 16: // CONSISTENCY
+          return CONSISTENCY;
+        case 17: // TARGET_REPLICA_ID
+          return TARGET_REPLICA_ID;
         default:
           return null;
       }
@@ -195,8 +213,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 __LIMIT_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.READ_TYPE,_Fields.LIMIT};
+  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.READ_TYPE,_Fields.LIMIT,_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);
@@ -235,6 +254,10 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
         new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TReadType.class)));
     tmpMap.put(_Fields.LIMIT, new org.apache.thrift.meta_data.FieldMetaData("limit", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
+    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);
   }
@@ -299,6 +322,10 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
       this.readType = other.readType;
     }
     this.limit = other.limit;
+    if (other.isSetConsistency()) {
+      this.consistency = other.consistency;
+    }
+    this.targetReplicaId = other.targetReplicaId;
   }
 
   public TScan deepCopy() {
@@ -328,6 +355,9 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
     this.readType = null;
     setLimitIsSet(false);
     this.limit = 0;
+    this.consistency = null;
+    setTargetReplicaIdIsSet(false);
+    this.targetReplicaId = 0;
   }
 
   public byte[] getStartRow() {
@@ -759,6 +789,61 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
     __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __LIMIT_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:
@@ -881,6 +966,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;
+
     }
   }
 
@@ -931,6 +1032,12 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
     case LIMIT:
       return getLimit();
 
+    case CONSISTENCY:
+      return getConsistency();
+
+    case TARGET_REPLICA_ID:
+      return getTargetReplicaId();
+
     }
     throw new IllegalStateException();
   }
@@ -972,6 +1079,10 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
       return isSetReadType();
     case LIMIT:
       return isSetLimit();
+    case CONSISTENCY:
+      return isSetConsistency();
+    case TARGET_REPLICA_ID:
+      return isSetTargetReplicaId();
     }
     throw new IllegalStateException();
   }
@@ -1124,6 +1235,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;
   }
 
@@ -1206,6 +1335,16 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
     if (present_limit)
       list.add(limit);
 
+    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();
   }
 
@@ -1367,6 +1506,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;
   }
 
@@ -1512,6 +1671,22 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
       sb.append(this.limit);
       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();
   }
@@ -1721,6 +1896,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);
         }
@@ -1852,6 +2043,18 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
         oprot.writeI32(struct.limit);
         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();
     }
@@ -1915,7 +2118,13 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
       if (struct.isSetLimit()) {
         optionals.set(14);
       }
-      oprot.writeBitSet(optionals, 15);
+      if (struct.isSetConsistency()) {
+        optionals.set(15);
+      }
+      if (struct.isSetTargetReplicaId()) {
+        optionals.set(16);
+      }
+      oprot.writeBitSet(optionals, 17);
       if (struct.isSetStartRow()) {
         oprot.writeBinary(struct.startRow);
       }
@@ -1981,12 +2190,18 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
       if (struct.isSetLimit()) {
         oprot.writeI32(struct.limit);
       }
+      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(15);
+      BitSet incoming = iprot.readBitSet(17);
       if (incoming.get(0)) {
         struct.startRow = iprot.readBinary();
         struct.setStartRowIsSet(true);
@@ -2082,6 +2297,14 @@ public class TScan implements org.apache.thrift.TBase<TScan, TScan._Fields>, jav
         struct.limit = iprot.readI32();
         struct.setLimitIsSet(true);
       }
+      if (incoming.get(15)) {
+        struct.consistency = org.apache.hadoop.hbase.thrift2.generated.TConsistency.findByValue(iprot.readI32());
+        struct.setConsistencyIsSet(true);
+      }
+      if (incoming.get(16)) {
+        struct.targetReplicaId = iprot.readI32();
+        struct.setTargetReplicaIdIsSet(true);
+      }
     }
   }
 

http://git-wip-us.apache.org/repos/asf/hbase/blob/1cb72aed/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 8c5ef59..79196f4 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
 }
 
 /**
@@ -101,6 +102,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.
  *
@@ -125,6 +137,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
 }
 
 /**
@@ -236,6 +250,8 @@ struct TScan {
   13: optional map<binary,TTimeRange> colFamTimeRangeMap
   14: optional TReadType readType
   15: optional i32 limit
+  16: optional TConsistency consistency
+  17: optional i32 targetReplicaId
 }
 
 /**

http://git-wip-us.apache.org/repos/asf/hbase/blob/1cb72aed/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 e2651cd..6da712f 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
@@ -52,6 +52,7 @@ 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;
@@ -75,6 +76,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.TDurability;
@@ -1555,6 +1557,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 implements RegionCoprocessor, RegionObserver {
     private static final Logger LOG = LoggerFactory.getLogger(DelayingRegionObserver.class);
     // sleep time in msec