You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2013/07/25 21:28:39 UTC
svn commit: r1507099 - in /hbase/trunk/hbase-server/src:
main/java/org/apache/hadoop/hbase/thrift2/
main/java/org/apache/hadoop/hbase/thrift2/generated/
main/resources/org/apache/hadoop/hbase/thrift2/
test/java/org/apache/hadoop/hbase/thrift2/
Author: stack
Date: Thu Jul 25 19:28:39 2013
New Revision: 1507099
URL: http://svn.apache.org/r1507099
Log:
HBASE-8947 Thrift 2 : Replace "bool writeToWAL" with "TDurability durability"
Modified:
hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftUtilities.java
hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TDelete.java
hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TIncrement.java
hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TPut.java
hbase/trunk/hbase-server/src/main/resources/org/apache/hadoop/hbase/thrift2/hbase.thrift
hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandler.java
Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftUtilities.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftUtilities.java?rev=1507099&r1=1507098&r2=1507099&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftUtilities.java (original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/ThriftUtilities.java Thu Jul 25 19:28:39 2013
@@ -167,9 +167,7 @@ public class ThriftUtilities {
out = new Put(in.getRow());
}
- if (in.isSetDurability()) {
- out.setDurability(durabilityFromThrift(in.getDurability()));
- }
+ out.setDurability(in.isWriteToWal() ? Durability.SYNC_WAL : Durability.SKIP_WAL);
for (TColumnValue columnValue : in.getColumnValues()) {
if (columnValue.isSetTimestamp()) {
@@ -252,10 +250,7 @@ public class ThriftUtilities {
addAttributes(out,in.getAttributes());
}
- if (in.isSetDurability()) {
- out.setDurability(durabilityFromThrift(in.getDurability()));
- }
-
+ out.setDurability(in.isWriteToWal() ? Durability.SYNC_WAL : Durability.SKIP_WAL);
return out;
}
@@ -388,10 +383,7 @@ public class ThriftUtilities {
addAttributes(out,in.getAttributes());
}
- if (in.isSetDurability()) {
- out.setDurability(durabilityFromThrift(in.getDurability()));
- }
-
+ out.setDurability(in.isWriteToWal() ? Durability.SYNC_WAL : Durability.SKIP_WAL);
return out;
}
@@ -409,14 +401,4 @@ public class ThriftUtilities {
op.setAttribute(name, value);
}
}
-
- private static Durability durabilityFromThrift(TDurability tDurability) {
- switch (tDurability.getValue()) {
- case 1: return Durability.SKIP_WAL;
- case 2: return Durability.ASYNC_WAL;
- case 3: return Durability.SYNC_WAL;
- case 4: return Durability.FSYNC_WAL;
- default: return null;
- }
- }
}
Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TDelete.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TDelete.java?rev=1507099&r1=1507098&r2=1507099&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TDelete.java (original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TDelete.java Thu Jul 25 19:28:39 2013
@@ -52,9 +52,6 @@ import org.slf4j.LoggerFactory;
* as if you had added a TColumn for every column family and this timestamp
* (i.e. all versions older than or equal in all column families will be deleted)
*
- * You can specify how this Delete should be written to the write-ahead Log (WAL)
- * by changing the durability. If you don't provide durability, it defaults to
- * column family's default setting for durability.
*/
public class TDelete implements org.apache.thrift.TBase<TDelete, TDelete._Fields>, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TDelete");
@@ -63,8 +60,8 @@ public class TDelete implements org.apac
private static final org.apache.thrift.protocol.TField COLUMNS_FIELD_DESC = new org.apache.thrift.protocol.TField("columns", org.apache.thrift.protocol.TType.LIST, (short)2);
private static final org.apache.thrift.protocol.TField TIMESTAMP_FIELD_DESC = new org.apache.thrift.protocol.TField("timestamp", org.apache.thrift.protocol.TType.I64, (short)3);
private static final org.apache.thrift.protocol.TField DELETE_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("deleteType", org.apache.thrift.protocol.TType.I32, (short)4);
+ private static final org.apache.thrift.protocol.TField WRITE_TO_WAL_FIELD_DESC = new org.apache.thrift.protocol.TField("writeToWal", org.apache.thrift.protocol.TType.BOOL, (short)5);
private static final org.apache.thrift.protocol.TField ATTRIBUTES_FIELD_DESC = new org.apache.thrift.protocol.TField("attributes", org.apache.thrift.protocol.TType.MAP, (short)6);
- private static final org.apache.thrift.protocol.TField DURABILITY_FIELD_DESC = new org.apache.thrift.protocol.TField("durability", org.apache.thrift.protocol.TType.I32, (short)7);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
@@ -80,12 +77,8 @@ public class TDelete implements org.apac
* @see TDeleteType
*/
public TDeleteType deleteType; // optional
+ public boolean writeToWal; // optional
public Map<ByteBuffer,ByteBuffer> attributes; // optional
- /**
- *
- * @see TDurability
- */
- public TDurability durability; // 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 {
@@ -97,12 +90,8 @@ public class TDelete implements org.apac
* @see TDeleteType
*/
DELETE_TYPE((short)4, "deleteType"),
- ATTRIBUTES((short)6, "attributes"),
- /**
- *
- * @see TDurability
- */
- DURABILITY((short)7, "durability");
+ WRITE_TO_WAL((short)5, "writeToWal"),
+ ATTRIBUTES((short)6, "attributes");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
@@ -125,10 +114,10 @@ public class TDelete implements org.apac
return TIMESTAMP;
case 4: // DELETE_TYPE
return DELETE_TYPE;
+ case 5: // WRITE_TO_WAL
+ return WRITE_TO_WAL;
case 6: // ATTRIBUTES
return ATTRIBUTES;
- case 7: // DURABILITY
- return DURABILITY;
default:
return null;
}
@@ -170,8 +159,9 @@ public class TDelete implements org.apac
// isset id assignments
private static final int __TIMESTAMP_ISSET_ID = 0;
+ private static final int __WRITETOWAL_ISSET_ID = 1;
private byte __isset_bitfield = 0;
- private _Fields optionals[] = {_Fields.COLUMNS,_Fields.TIMESTAMP,_Fields.DELETE_TYPE,_Fields.ATTRIBUTES,_Fields.DURABILITY};
+ private _Fields optionals[] = {_Fields.COLUMNS,_Fields.TIMESTAMP,_Fields.DELETE_TYPE,_Fields.WRITE_TO_WAL,_Fields.ATTRIBUTES};
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);
@@ -184,12 +174,12 @@ public class TDelete implements org.apac
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
tmpMap.put(_Fields.DELETE_TYPE, new org.apache.thrift.meta_data.FieldMetaData("deleteType", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TDeleteType.class)));
+ tmpMap.put(_Fields.WRITE_TO_WAL, new org.apache.thrift.meta_data.FieldMetaData("writeToWal", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
tmpMap.put(_Fields.ATTRIBUTES, new org.apache.thrift.meta_data.FieldMetaData("attributes", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true),
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true))));
- tmpMap.put(_Fields.DURABILITY, new org.apache.thrift.meta_data.FieldMetaData("durability", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TDurability.class)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TDelete.class, metaDataMap);
}
@@ -197,6 +187,8 @@ public class TDelete implements org.apac
public TDelete() {
this.deleteType = org.apache.hadoop.hbase.thrift2.generated.TDeleteType.DELETE_COLUMNS;
+ this.writeToWal = true;
+
}
public TDelete(
@@ -226,6 +218,7 @@ public class TDelete implements org.apac
if (other.isSetDeleteType()) {
this.deleteType = other.deleteType;
}
+ this.writeToWal = other.writeToWal;
if (other.isSetAttributes()) {
Map<ByteBuffer,ByteBuffer> __this__attributes = new HashMap<ByteBuffer,ByteBuffer>();
for (Map.Entry<ByteBuffer, ByteBuffer> other_element : other.attributes.entrySet()) {
@@ -243,9 +236,6 @@ public class TDelete implements org.apac
}
this.attributes = __this__attributes;
}
- if (other.isSetDurability()) {
- this.durability = other.durability;
- }
}
public TDelete deepCopy() {
@@ -260,8 +250,9 @@ public class TDelete implements org.apac
this.timestamp = 0;
this.deleteType = org.apache.hadoop.hbase.thrift2.generated.TDeleteType.DELETE_COLUMNS;
+ this.writeToWal = true;
+
this.attributes = null;
- this.durability = null;
}
public byte[] getRow() {
@@ -392,6 +383,29 @@ public class TDelete implements org.apac
}
}
+ public boolean isWriteToWal() {
+ return this.writeToWal;
+ }
+
+ public TDelete setWriteToWal(boolean writeToWal) {
+ this.writeToWal = writeToWal;
+ setWriteToWalIsSet(true);
+ return this;
+ }
+
+ public void unsetWriteToWal() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __WRITETOWAL_ISSET_ID);
+ }
+
+ /** Returns true if field writeToWal is set (has been assigned a value) and false otherwise */
+ public boolean isSetWriteToWal() {
+ return EncodingUtils.testBit(__isset_bitfield, __WRITETOWAL_ISSET_ID);
+ }
+
+ public void setWriteToWalIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __WRITETOWAL_ISSET_ID, value);
+ }
+
public int getAttributesSize() {
return (this.attributes == null) ? 0 : this.attributes.size();
}
@@ -427,38 +441,6 @@ public class TDelete implements org.apac
}
}
- /**
- *
- * @see TDurability
- */
- public TDurability getDurability() {
- return this.durability;
- }
-
- /**
- *
- * @see TDurability
- */
- public TDelete setDurability(TDurability durability) {
- this.durability = durability;
- return this;
- }
-
- public void unsetDurability() {
- this.durability = null;
- }
-
- /** Returns true if field durability is set (has been assigned a value) and false otherwise */
- public boolean isSetDurability() {
- return this.durability != null;
- }
-
- public void setDurabilityIsSet(boolean value) {
- if (!value) {
- this.durability = null;
- }
- }
-
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case ROW:
@@ -493,19 +475,19 @@ public class TDelete implements org.apac
}
break;
- case ATTRIBUTES:
+ case WRITE_TO_WAL:
if (value == null) {
- unsetAttributes();
+ unsetWriteToWal();
} else {
- setAttributes((Map<ByteBuffer,ByteBuffer>)value);
+ setWriteToWal((Boolean)value);
}
break;
- case DURABILITY:
+ case ATTRIBUTES:
if (value == null) {
- unsetDurability();
+ unsetAttributes();
} else {
- setDurability((TDurability)value);
+ setAttributes((Map<ByteBuffer,ByteBuffer>)value);
}
break;
@@ -526,12 +508,12 @@ public class TDelete implements org.apac
case DELETE_TYPE:
return getDeleteType();
+ case WRITE_TO_WAL:
+ return Boolean.valueOf(isWriteToWal());
+
case ATTRIBUTES:
return getAttributes();
- case DURABILITY:
- return getDurability();
-
}
throw new IllegalStateException();
}
@@ -551,10 +533,10 @@ public class TDelete implements org.apac
return isSetTimestamp();
case DELETE_TYPE:
return isSetDeleteType();
+ case WRITE_TO_WAL:
+ return isSetWriteToWal();
case ATTRIBUTES:
return isSetAttributes();
- case DURABILITY:
- return isSetDurability();
}
throw new IllegalStateException();
}
@@ -608,6 +590,15 @@ public class TDelete implements org.apac
return false;
}
+ boolean this_present_writeToWal = true && this.isSetWriteToWal();
+ boolean that_present_writeToWal = true && that.isSetWriteToWal();
+ if (this_present_writeToWal || that_present_writeToWal) {
+ if (!(this_present_writeToWal && that_present_writeToWal))
+ return false;
+ if (this.writeToWal != that.writeToWal)
+ return false;
+ }
+
boolean this_present_attributes = true && this.isSetAttributes();
boolean that_present_attributes = true && that.isSetAttributes();
if (this_present_attributes || that_present_attributes) {
@@ -617,15 +608,6 @@ public class TDelete implements org.apac
return false;
}
- boolean this_present_durability = true && this.isSetDurability();
- boolean that_present_durability = true && that.isSetDurability();
- if (this_present_durability || that_present_durability) {
- if (!(this_present_durability && that_present_durability))
- return false;
- if (!this.durability.equals(that.durability))
- return false;
- }
-
return true;
}
@@ -682,22 +664,22 @@ public class TDelete implements org.apac
return lastComparison;
}
}
- lastComparison = Boolean.valueOf(isSetAttributes()).compareTo(typedOther.isSetAttributes());
+ lastComparison = Boolean.valueOf(isSetWriteToWal()).compareTo(typedOther.isSetWriteToWal());
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetAttributes()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.attributes, typedOther.attributes);
+ if (isSetWriteToWal()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.writeToWal, typedOther.writeToWal);
if (lastComparison != 0) {
return lastComparison;
}
}
- lastComparison = Boolean.valueOf(isSetDurability()).compareTo(typedOther.isSetDurability());
+ lastComparison = Boolean.valueOf(isSetAttributes()).compareTo(typedOther.isSetAttributes());
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetDurability()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.durability, typedOther.durability);
+ if (isSetAttributes()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.attributes, typedOther.attributes);
if (lastComparison != 0) {
return lastComparison;
}
@@ -755,6 +737,12 @@ public class TDelete implements org.apac
}
first = false;
}
+ if (isSetWriteToWal()) {
+ if (!first) sb.append(", ");
+ sb.append("writeToWal:");
+ sb.append(this.writeToWal);
+ first = false;
+ }
if (isSetAttributes()) {
if (!first) sb.append(", ");
sb.append("attributes:");
@@ -765,16 +753,6 @@ public class TDelete implements org.apac
}
first = false;
}
- if (isSetDurability()) {
- if (!first) sb.append(", ");
- sb.append("durability:");
- if (this.durability == null) {
- sb.append("null");
- } else {
- sb.append(this.durability);
- }
- first = false;
- }
sb.append(")");
return sb.toString();
}
@@ -838,7 +816,7 @@ public class TDelete implements org.apac
struct.columns = new ArrayList<TColumn>(_list44.size);
for (int _i45 = 0; _i45 < _list44.size; ++_i45)
{
- TColumn _elem46; // optional
+ TColumn _elem46; // required
_elem46 = new TColumn();
_elem46.read(iprot);
struct.columns.add(_elem46);
@@ -866,6 +844,14 @@ public class TDelete implements org.apac
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
+ case 5: // WRITE_TO_WAL
+ if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
+ struct.writeToWal = iprot.readBool();
+ struct.setWriteToWalIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
case 6: // ATTRIBUTES
if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
{
@@ -886,14 +872,6 @@ public class TDelete implements org.apac
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
- case 7: // DURABILITY
- if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
- struct.durability = TDurability.findByValue(iprot.readI32());
- struct.setDurabilityIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
@@ -940,6 +918,11 @@ public class TDelete implements org.apac
oprot.writeFieldEnd();
}
}
+ if (struct.isSetWriteToWal()) {
+ oprot.writeFieldBegin(WRITE_TO_WAL_FIELD_DESC);
+ oprot.writeBool(struct.writeToWal);
+ oprot.writeFieldEnd();
+ }
if (struct.attributes != null) {
if (struct.isSetAttributes()) {
oprot.writeFieldBegin(ATTRIBUTES_FIELD_DESC);
@@ -955,13 +938,6 @@ public class TDelete implements org.apac
oprot.writeFieldEnd();
}
}
- if (struct.durability != null) {
- if (struct.isSetDurability()) {
- oprot.writeFieldBegin(DURABILITY_FIELD_DESC);
- oprot.writeI32(struct.durability.getValue());
- oprot.writeFieldEnd();
- }
- }
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@@ -990,10 +966,10 @@ public class TDelete implements org.apac
if (struct.isSetDeleteType()) {
optionals.set(2);
}
- if (struct.isSetAttributes()) {
+ if (struct.isSetWriteToWal()) {
optionals.set(3);
}
- if (struct.isSetDurability()) {
+ if (struct.isSetAttributes()) {
optionals.set(4);
}
oprot.writeBitSet(optionals, 5);
@@ -1012,6 +988,9 @@ public class TDelete implements org.apac
if (struct.isSetDeleteType()) {
oprot.writeI32(struct.deleteType.getValue());
}
+ if (struct.isSetWriteToWal()) {
+ oprot.writeBool(struct.writeToWal);
+ }
if (struct.isSetAttributes()) {
{
oprot.writeI32(struct.attributes.size());
@@ -1022,9 +1001,6 @@ public class TDelete implements org.apac
}
}
}
- if (struct.isSetDurability()) {
- oprot.writeI32(struct.durability.getValue());
- }
}
@Override
@@ -1039,7 +1015,7 @@ public class TDelete implements org.apac
struct.columns = new ArrayList<TColumn>(_list55.size);
for (int _i56 = 0; _i56 < _list55.size; ++_i56)
{
- TColumn _elem57; // optional
+ TColumn _elem57; // required
_elem57 = new TColumn();
_elem57.read(iprot);
struct.columns.add(_elem57);
@@ -1056,6 +1032,10 @@ public class TDelete implements org.apac
struct.setDeleteTypeIsSet(true);
}
if (incoming.get(3)) {
+ struct.writeToWal = iprot.readBool();
+ struct.setWriteToWalIsSet(true);
+ }
+ if (incoming.get(4)) {
{
org.apache.thrift.protocol.TMap _map58 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32());
struct.attributes = new HashMap<ByteBuffer,ByteBuffer>(2*_map58.size);
@@ -1070,10 +1050,6 @@ public class TDelete implements org.apac
}
struct.setAttributesIsSet(true);
}
- if (incoming.get(4)) {
- struct.durability = TDurability.findByValue(iprot.readI32());
- struct.setDurabilityIsSet(true);
- }
}
}
Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TIncrement.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TIncrement.java?rev=1507099&r1=1507098&r2=1507099&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TIncrement.java (original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TIncrement.java Thu Jul 25 19:28:39 2013
@@ -33,17 +33,16 @@ import org.slf4j.LoggerFactory;
/**
* Used to perform Increment operations for a single row.
*
- * You can specify how this Increment should be written to the write-ahead Log (WAL)
- * by changing the durability. If you don't provide durability, it defaults to
- * column family's default setting for durability.
+ * You can specify if this Increment should be written
+ * to the write-ahead Log (WAL) or not. It defaults to true.
*/
public class TIncrement implements org.apache.thrift.TBase<TIncrement, TIncrement._Fields>, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TIncrement");
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 COLUMNS_FIELD_DESC = new org.apache.thrift.protocol.TField("columns", org.apache.thrift.protocol.TType.LIST, (short)2);
+ private static final org.apache.thrift.protocol.TField WRITE_TO_WAL_FIELD_DESC = new org.apache.thrift.protocol.TField("writeToWal", org.apache.thrift.protocol.TType.BOOL, (short)3);
private static final org.apache.thrift.protocol.TField ATTRIBUTES_FIELD_DESC = new org.apache.thrift.protocol.TField("attributes", org.apache.thrift.protocol.TType.MAP, (short)4);
- private static final org.apache.thrift.protocol.TField DURABILITY_FIELD_DESC = new org.apache.thrift.protocol.TField("durability", org.apache.thrift.protocol.TType.I32, (short)5);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
@@ -53,23 +52,15 @@ public class TIncrement implements org.a
public ByteBuffer row; // required
public List<TColumnIncrement> columns; // required
+ public boolean writeToWal; // optional
public Map<ByteBuffer,ByteBuffer> attributes; // optional
- /**
- *
- * @see TDurability
- */
- public TDurability durability; // 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"),
COLUMNS((short)2, "columns"),
- ATTRIBUTES((short)4, "attributes"),
- /**
- *
- * @see TDurability
- */
- DURABILITY((short)5, "durability");
+ WRITE_TO_WAL((short)3, "writeToWal"),
+ ATTRIBUTES((short)4, "attributes");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
@@ -88,10 +79,10 @@ public class TIncrement implements org.a
return ROW;
case 2: // COLUMNS
return COLUMNS;
+ case 3: // WRITE_TO_WAL
+ return WRITE_TO_WAL;
case 4: // ATTRIBUTES
return ATTRIBUTES;
- case 5: // DURABILITY
- return DURABILITY;
default:
return null;
}
@@ -132,7 +123,9 @@ public class TIncrement implements org.a
}
// isset id assignments
- private _Fields optionals[] = {_Fields.ATTRIBUTES,_Fields.DURABILITY};
+ private static final int __WRITETOWAL_ISSET_ID = 0;
+ private byte __isset_bitfield = 0;
+ private _Fields optionals[] = {_Fields.WRITE_TO_WAL,_Fields.ATTRIBUTES};
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);
@@ -141,17 +134,19 @@ public class TIncrement implements org.a
tmpMap.put(_Fields.COLUMNS, new org.apache.thrift.meta_data.FieldMetaData("columns", 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, TColumnIncrement.class))));
+ tmpMap.put(_Fields.WRITE_TO_WAL, new org.apache.thrift.meta_data.FieldMetaData("writeToWal", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
tmpMap.put(_Fields.ATTRIBUTES, new org.apache.thrift.meta_data.FieldMetaData("attributes", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true),
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true))));
- tmpMap.put(_Fields.DURABILITY, new org.apache.thrift.meta_data.FieldMetaData("durability", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TDurability.class)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TIncrement.class, metaDataMap);
}
public TIncrement() {
+ this.writeToWal = true;
+
}
public TIncrement(
@@ -167,6 +162,7 @@ public class TIncrement implements org.a
* Performs a deep copy on <i>other</i>.
*/
public TIncrement(TIncrement other) {
+ __isset_bitfield = other.__isset_bitfield;
if (other.isSetRow()) {
this.row = org.apache.thrift.TBaseHelper.copyBinary(other.row);
;
@@ -178,6 +174,7 @@ public class TIncrement implements org.a
}
this.columns = __this__columns;
}
+ this.writeToWal = other.writeToWal;
if (other.isSetAttributes()) {
Map<ByteBuffer,ByteBuffer> __this__attributes = new HashMap<ByteBuffer,ByteBuffer>();
for (Map.Entry<ByteBuffer, ByteBuffer> other_element : other.attributes.entrySet()) {
@@ -195,9 +192,6 @@ public class TIncrement implements org.a
}
this.attributes = __this__attributes;
}
- if (other.isSetDurability()) {
- this.durability = other.durability;
- }
}
public TIncrement deepCopy() {
@@ -208,8 +202,9 @@ public class TIncrement implements org.a
public void clear() {
this.row = null;
this.columns = null;
+ this.writeToWal = true;
+
this.attributes = null;
- this.durability = null;
}
public byte[] getRow() {
@@ -285,6 +280,29 @@ public class TIncrement implements org.a
}
}
+ public boolean isWriteToWal() {
+ return this.writeToWal;
+ }
+
+ public TIncrement setWriteToWal(boolean writeToWal) {
+ this.writeToWal = writeToWal;
+ setWriteToWalIsSet(true);
+ return this;
+ }
+
+ public void unsetWriteToWal() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __WRITETOWAL_ISSET_ID);
+ }
+
+ /** Returns true if field writeToWal is set (has been assigned a value) and false otherwise */
+ public boolean isSetWriteToWal() {
+ return EncodingUtils.testBit(__isset_bitfield, __WRITETOWAL_ISSET_ID);
+ }
+
+ public void setWriteToWalIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __WRITETOWAL_ISSET_ID, value);
+ }
+
public int getAttributesSize() {
return (this.attributes == null) ? 0 : this.attributes.size();
}
@@ -320,38 +338,6 @@ public class TIncrement implements org.a
}
}
- /**
- *
- * @see TDurability
- */
- public TDurability getDurability() {
- return this.durability;
- }
-
- /**
- *
- * @see TDurability
- */
- public TIncrement setDurability(TDurability durability) {
- this.durability = durability;
- return this;
- }
-
- public void unsetDurability() {
- this.durability = null;
- }
-
- /** Returns true if field durability is set (has been assigned a value) and false otherwise */
- public boolean isSetDurability() {
- return this.durability != null;
- }
-
- public void setDurabilityIsSet(boolean value) {
- if (!value) {
- this.durability = null;
- }
- }
-
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case ROW:
@@ -370,19 +356,19 @@ public class TIncrement implements org.a
}
break;
- case ATTRIBUTES:
+ case WRITE_TO_WAL:
if (value == null) {
- unsetAttributes();
+ unsetWriteToWal();
} else {
- setAttributes((Map<ByteBuffer,ByteBuffer>)value);
+ setWriteToWal((Boolean)value);
}
break;
- case DURABILITY:
+ case ATTRIBUTES:
if (value == null) {
- unsetDurability();
+ unsetAttributes();
} else {
- setDurability((TDurability)value);
+ setAttributes((Map<ByteBuffer,ByteBuffer>)value);
}
break;
@@ -397,12 +383,12 @@ public class TIncrement implements org.a
case COLUMNS:
return getColumns();
+ case WRITE_TO_WAL:
+ return Boolean.valueOf(isWriteToWal());
+
case ATTRIBUTES:
return getAttributes();
- case DURABILITY:
- return getDurability();
-
}
throw new IllegalStateException();
}
@@ -418,10 +404,10 @@ public class TIncrement implements org.a
return isSetRow();
case COLUMNS:
return isSetColumns();
+ case WRITE_TO_WAL:
+ return isSetWriteToWal();
case ATTRIBUTES:
return isSetAttributes();
- case DURABILITY:
- return isSetDurability();
}
throw new IllegalStateException();
}
@@ -457,6 +443,15 @@ public class TIncrement implements org.a
return false;
}
+ boolean this_present_writeToWal = true && this.isSetWriteToWal();
+ boolean that_present_writeToWal = true && that.isSetWriteToWal();
+ if (this_present_writeToWal || that_present_writeToWal) {
+ if (!(this_present_writeToWal && that_present_writeToWal))
+ return false;
+ if (this.writeToWal != that.writeToWal)
+ return false;
+ }
+
boolean this_present_attributes = true && this.isSetAttributes();
boolean that_present_attributes = true && that.isSetAttributes();
if (this_present_attributes || that_present_attributes) {
@@ -466,15 +461,6 @@ public class TIncrement implements org.a
return false;
}
- boolean this_present_durability = true && this.isSetDurability();
- boolean that_present_durability = true && that.isSetDurability();
- if (this_present_durability || that_present_durability) {
- if (!(this_present_durability && that_present_durability))
- return false;
- if (!this.durability.equals(that.durability))
- return false;
- }
-
return true;
}
@@ -511,22 +497,22 @@ public class TIncrement implements org.a
return lastComparison;
}
}
- lastComparison = Boolean.valueOf(isSetAttributes()).compareTo(typedOther.isSetAttributes());
+ lastComparison = Boolean.valueOf(isSetWriteToWal()).compareTo(typedOther.isSetWriteToWal());
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetAttributes()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.attributes, typedOther.attributes);
+ if (isSetWriteToWal()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.writeToWal, typedOther.writeToWal);
if (lastComparison != 0) {
return lastComparison;
}
}
- lastComparison = Boolean.valueOf(isSetDurability()).compareTo(typedOther.isSetDurability());
+ lastComparison = Boolean.valueOf(isSetAttributes()).compareTo(typedOther.isSetAttributes());
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetDurability()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.durability, typedOther.durability);
+ if (isSetAttributes()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.attributes, typedOther.attributes);
if (lastComparison != 0) {
return lastComparison;
}
@@ -566,6 +552,12 @@ public class TIncrement implements org.a
sb.append(this.columns);
}
first = false;
+ if (isSetWriteToWal()) {
+ if (!first) sb.append(", ");
+ sb.append("writeToWal:");
+ sb.append(this.writeToWal);
+ first = false;
+ }
if (isSetAttributes()) {
if (!first) sb.append(", ");
sb.append("attributes:");
@@ -576,16 +568,6 @@ public class TIncrement implements org.a
}
first = false;
}
- if (isSetDurability()) {
- if (!first) sb.append(", ");
- sb.append("durability:");
- if (this.durability == null) {
- sb.append("null");
- } else {
- sb.append(this.durability);
- }
- first = false;
- }
sb.append(")");
return sb.toString();
}
@@ -611,6 +593,8 @@ public class TIncrement implements org.a
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);
@@ -650,7 +634,7 @@ public class TIncrement implements org.a
struct.columns = new ArrayList<TColumnIncrement>(_list62.size);
for (int _i63 = 0; _i63 < _list62.size; ++_i63)
{
- TColumnIncrement _elem64; // optional
+ TColumnIncrement _elem64; // required
_elem64 = new TColumnIncrement();
_elem64.read(iprot);
struct.columns.add(_elem64);
@@ -662,6 +646,14 @@ public class TIncrement implements org.a
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
+ case 3: // WRITE_TO_WAL
+ if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
+ struct.writeToWal = iprot.readBool();
+ struct.setWriteToWalIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
case 4: // ATTRIBUTES
if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
{
@@ -682,14 +674,6 @@ public class TIncrement implements org.a
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
- case 5: // DURABILITY
- if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
- struct.durability = TDurability.findByValue(iprot.readI32());
- struct.setDurabilityIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
@@ -722,6 +706,11 @@ public class TIncrement implements org.a
}
oprot.writeFieldEnd();
}
+ if (struct.isSetWriteToWal()) {
+ oprot.writeFieldBegin(WRITE_TO_WAL_FIELD_DESC);
+ oprot.writeBool(struct.writeToWal);
+ oprot.writeFieldEnd();
+ }
if (struct.attributes != null) {
if (struct.isSetAttributes()) {
oprot.writeFieldBegin(ATTRIBUTES_FIELD_DESC);
@@ -737,13 +726,6 @@ public class TIncrement implements org.a
oprot.writeFieldEnd();
}
}
- if (struct.durability != null) {
- if (struct.isSetDurability()) {
- oprot.writeFieldBegin(DURABILITY_FIELD_DESC);
- oprot.writeI32(struct.durability.getValue());
- oprot.writeFieldEnd();
- }
- }
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@@ -770,13 +752,16 @@ public class TIncrement implements org.a
}
}
BitSet optionals = new BitSet();
- if (struct.isSetAttributes()) {
+ if (struct.isSetWriteToWal()) {
optionals.set(0);
}
- if (struct.isSetDurability()) {
+ if (struct.isSetAttributes()) {
optionals.set(1);
}
oprot.writeBitSet(optionals, 2);
+ if (struct.isSetWriteToWal()) {
+ oprot.writeBool(struct.writeToWal);
+ }
if (struct.isSetAttributes()) {
{
oprot.writeI32(struct.attributes.size());
@@ -787,9 +772,6 @@ public class TIncrement implements org.a
}
}
}
- if (struct.isSetDurability()) {
- oprot.writeI32(struct.durability.getValue());
- }
}
@Override
@@ -802,7 +784,7 @@ public class TIncrement implements org.a
struct.columns = new ArrayList<TColumnIncrement>(_list73.size);
for (int _i74 = 0; _i74 < _list73.size; ++_i74)
{
- TColumnIncrement _elem75; // optional
+ TColumnIncrement _elem75; // required
_elem75 = new TColumnIncrement();
_elem75.read(iprot);
struct.columns.add(_elem75);
@@ -811,6 +793,10 @@ public class TIncrement implements org.a
struct.setColumnsIsSet(true);
BitSet incoming = iprot.readBitSet(2);
if (incoming.get(0)) {
+ struct.writeToWal = iprot.readBool();
+ struct.setWriteToWalIsSet(true);
+ }
+ if (incoming.get(1)) {
{
org.apache.thrift.protocol.TMap _map76 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32());
struct.attributes = new HashMap<ByteBuffer,ByteBuffer>(2*_map76.size);
@@ -825,10 +811,6 @@ public class TIncrement implements org.a
}
struct.setAttributesIsSet(true);
}
- if (incoming.get(1)) {
- struct.durability = TDurability.findByValue(iprot.readI32());
- struct.setDurabilityIsSet(true);
- }
}
}
Modified: hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TPut.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TPut.java?rev=1507099&r1=1507098&r2=1507099&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TPut.java (original)
+++ hbase/trunk/hbase-server/src/main/java/org/apache/hadoop/hbase/thrift2/generated/TPut.java Thu Jul 25 19:28:39 2013
@@ -38,9 +38,8 @@ import org.slf4j.LoggerFactory;
* don't have one. If you don't provide a default timestamp
* the current time is inserted.
*
- * You can specify how this Put should be written to the write-ahead Log (WAL)
- * by changing the durability. If you don't provide durability, it defaults to
- * column family's default setting for durability.
+ * You can also specify if this Put should be written
+ * to the write-ahead Log (WAL) or not. It defaults to true.
*/
public class TPut implements org.apache.thrift.TBase<TPut, TPut._Fields>, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TPut");
@@ -48,8 +47,8 @@ public class TPut implements org.apache.
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 TIMESTAMP_FIELD_DESC = new org.apache.thrift.protocol.TField("timestamp", org.apache.thrift.protocol.TType.I64, (short)3);
+ private static final org.apache.thrift.protocol.TField WRITE_TO_WAL_FIELD_DESC = new org.apache.thrift.protocol.TField("writeToWal", org.apache.thrift.protocol.TType.BOOL, (short)4);
private static final org.apache.thrift.protocol.TField ATTRIBUTES_FIELD_DESC = new org.apache.thrift.protocol.TField("attributes", org.apache.thrift.protocol.TType.MAP, (short)5);
- private static final org.apache.thrift.protocol.TField DURABILITY_FIELD_DESC = new org.apache.thrift.protocol.TField("durability", org.apache.thrift.protocol.TType.I32, (short)6);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
@@ -60,24 +59,16 @@ public class TPut implements org.apache.
public ByteBuffer row; // required
public List<TColumnValue> columnValues; // required
public long timestamp; // optional
+ public boolean writeToWal; // optional
public Map<ByteBuffer,ByteBuffer> attributes; // optional
- /**
- *
- * @see TDurability
- */
- public TDurability durability; // 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"),
TIMESTAMP((short)3, "timestamp"),
- ATTRIBUTES((short)5, "attributes"),
- /**
- *
- * @see TDurability
- */
- DURABILITY((short)6, "durability");
+ WRITE_TO_WAL((short)4, "writeToWal"),
+ ATTRIBUTES((short)5, "attributes");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
@@ -98,10 +89,10 @@ public class TPut implements org.apache.
return COLUMN_VALUES;
case 3: // TIMESTAMP
return TIMESTAMP;
+ case 4: // WRITE_TO_WAL
+ return WRITE_TO_WAL;
case 5: // ATTRIBUTES
return ATTRIBUTES;
- case 6: // DURABILITY
- return DURABILITY;
default:
return null;
}
@@ -143,8 +134,9 @@ public class TPut implements org.apache.
// isset id assignments
private static final int __TIMESTAMP_ISSET_ID = 0;
+ private static final int __WRITETOWAL_ISSET_ID = 1;
private byte __isset_bitfield = 0;
- private _Fields optionals[] = {_Fields.TIMESTAMP,_Fields.ATTRIBUTES,_Fields.DURABILITY};
+ private _Fields optionals[] = {_Fields.TIMESTAMP,_Fields.WRITE_TO_WAL,_Fields.ATTRIBUTES};
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);
@@ -155,17 +147,19 @@ public class TPut implements org.apache.
new org.apache.thrift.meta_data.StructMetaData(org.apache.thrift.protocol.TType.STRUCT, TColumnValue.class))));
tmpMap.put(_Fields.TIMESTAMP, new org.apache.thrift.meta_data.FieldMetaData("timestamp", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
+ tmpMap.put(_Fields.WRITE_TO_WAL, new org.apache.thrift.meta_data.FieldMetaData("writeToWal", org.apache.thrift.TFieldRequirementType.OPTIONAL,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
tmpMap.put(_Fields.ATTRIBUTES, new org.apache.thrift.meta_data.FieldMetaData("attributes", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.MapMetaData(org.apache.thrift.protocol.TType.MAP,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true),
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING , true))));
- tmpMap.put(_Fields.DURABILITY, new org.apache.thrift.meta_data.FieldMetaData("durability", org.apache.thrift.TFieldRequirementType.OPTIONAL,
- new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, TDurability.class)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(TPut.class, metaDataMap);
}
public TPut() {
+ this.writeToWal = true;
+
}
public TPut(
@@ -194,6 +188,7 @@ public class TPut implements org.apache.
this.columnValues = __this__columnValues;
}
this.timestamp = other.timestamp;
+ this.writeToWal = other.writeToWal;
if (other.isSetAttributes()) {
Map<ByteBuffer,ByteBuffer> __this__attributes = new HashMap<ByteBuffer,ByteBuffer>();
for (Map.Entry<ByteBuffer, ByteBuffer> other_element : other.attributes.entrySet()) {
@@ -211,9 +206,6 @@ public class TPut implements org.apache.
}
this.attributes = __this__attributes;
}
- if (other.isSetDurability()) {
- this.durability = other.durability;
- }
}
public TPut deepCopy() {
@@ -226,8 +218,9 @@ public class TPut implements org.apache.
this.columnValues = null;
setTimestampIsSet(false);
this.timestamp = 0;
+ this.writeToWal = true;
+
this.attributes = null;
- this.durability = null;
}
public byte[] getRow() {
@@ -326,6 +319,29 @@ public class TPut implements org.apache.
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TIMESTAMP_ISSET_ID, value);
}
+ public boolean isWriteToWal() {
+ return this.writeToWal;
+ }
+
+ public TPut setWriteToWal(boolean writeToWal) {
+ this.writeToWal = writeToWal;
+ setWriteToWalIsSet(true);
+ return this;
+ }
+
+ public void unsetWriteToWal() {
+ __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __WRITETOWAL_ISSET_ID);
+ }
+
+ /** Returns true if field writeToWal is set (has been assigned a value) and false otherwise */
+ public boolean isSetWriteToWal() {
+ return EncodingUtils.testBit(__isset_bitfield, __WRITETOWAL_ISSET_ID);
+ }
+
+ public void setWriteToWalIsSet(boolean value) {
+ __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __WRITETOWAL_ISSET_ID, value);
+ }
+
public int getAttributesSize() {
return (this.attributes == null) ? 0 : this.attributes.size();
}
@@ -361,38 +377,6 @@ public class TPut implements org.apache.
}
}
- /**
- *
- * @see TDurability
- */
- public TDurability getDurability() {
- return this.durability;
- }
-
- /**
- *
- * @see TDurability
- */
- public TPut setDurability(TDurability durability) {
- this.durability = durability;
- return this;
- }
-
- public void unsetDurability() {
- this.durability = null;
- }
-
- /** Returns true if field durability is set (has been assigned a value) and false otherwise */
- public boolean isSetDurability() {
- return this.durability != null;
- }
-
- public void setDurabilityIsSet(boolean value) {
- if (!value) {
- this.durability = null;
- }
- }
-
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case ROW:
@@ -419,19 +403,19 @@ public class TPut implements org.apache.
}
break;
- case ATTRIBUTES:
+ case WRITE_TO_WAL:
if (value == null) {
- unsetAttributes();
+ unsetWriteToWal();
} else {
- setAttributes((Map<ByteBuffer,ByteBuffer>)value);
+ setWriteToWal((Boolean)value);
}
break;
- case DURABILITY:
+ case ATTRIBUTES:
if (value == null) {
- unsetDurability();
+ unsetAttributes();
} else {
- setDurability((TDurability)value);
+ setAttributes((Map<ByteBuffer,ByteBuffer>)value);
}
break;
@@ -449,12 +433,12 @@ public class TPut implements org.apache.
case TIMESTAMP:
return Long.valueOf(getTimestamp());
+ case WRITE_TO_WAL:
+ return Boolean.valueOf(isWriteToWal());
+
case ATTRIBUTES:
return getAttributes();
- case DURABILITY:
- return getDurability();
-
}
throw new IllegalStateException();
}
@@ -472,10 +456,10 @@ public class TPut implements org.apache.
return isSetColumnValues();
case TIMESTAMP:
return isSetTimestamp();
+ case WRITE_TO_WAL:
+ return isSetWriteToWal();
case ATTRIBUTES:
return isSetAttributes();
- case DURABILITY:
- return isSetDurability();
}
throw new IllegalStateException();
}
@@ -520,6 +504,15 @@ public class TPut implements org.apache.
return false;
}
+ boolean this_present_writeToWal = true && this.isSetWriteToWal();
+ boolean that_present_writeToWal = true && that.isSetWriteToWal();
+ if (this_present_writeToWal || that_present_writeToWal) {
+ if (!(this_present_writeToWal && that_present_writeToWal))
+ return false;
+ if (this.writeToWal != that.writeToWal)
+ return false;
+ }
+
boolean this_present_attributes = true && this.isSetAttributes();
boolean that_present_attributes = true && that.isSetAttributes();
if (this_present_attributes || that_present_attributes) {
@@ -529,15 +522,6 @@ public class TPut implements org.apache.
return false;
}
- boolean this_present_durability = true && this.isSetDurability();
- boolean that_present_durability = true && that.isSetDurability();
- if (this_present_durability || that_present_durability) {
- if (!(this_present_durability && that_present_durability))
- return false;
- if (!this.durability.equals(that.durability))
- return false;
- }
-
return true;
}
@@ -584,22 +568,22 @@ public class TPut implements org.apache.
return lastComparison;
}
}
- lastComparison = Boolean.valueOf(isSetAttributes()).compareTo(typedOther.isSetAttributes());
+ lastComparison = Boolean.valueOf(isSetWriteToWal()).compareTo(typedOther.isSetWriteToWal());
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetAttributes()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.attributes, typedOther.attributes);
+ if (isSetWriteToWal()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.writeToWal, typedOther.writeToWal);
if (lastComparison != 0) {
return lastComparison;
}
}
- lastComparison = Boolean.valueOf(isSetDurability()).compareTo(typedOther.isSetDurability());
+ lastComparison = Boolean.valueOf(isSetAttributes()).compareTo(typedOther.isSetAttributes());
if (lastComparison != 0) {
return lastComparison;
}
- if (isSetDurability()) {
- lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.durability, typedOther.durability);
+ if (isSetAttributes()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.attributes, typedOther.attributes);
if (lastComparison != 0) {
return lastComparison;
}
@@ -645,6 +629,12 @@ public class TPut implements org.apache.
sb.append(this.timestamp);
first = false;
}
+ if (isSetWriteToWal()) {
+ if (!first) sb.append(", ");
+ sb.append("writeToWal:");
+ sb.append(this.writeToWal);
+ first = false;
+ }
if (isSetAttributes()) {
if (!first) sb.append(", ");
sb.append("attributes:");
@@ -655,16 +645,6 @@ public class TPut implements org.apache.
}
first = false;
}
- if (isSetDurability()) {
- if (!first) sb.append(", ");
- sb.append("durability:");
- if (this.durability == null) {
- sb.append("null");
- } else {
- sb.append(this.durability);
- }
- first = false;
- }
sb.append(")");
return sb.toString();
}
@@ -731,7 +711,7 @@ public class TPut implements org.apache.
struct.columnValues = new ArrayList<TColumnValue>(_list26.size);
for (int _i27 = 0; _i27 < _list26.size; ++_i27)
{
- TColumnValue _elem28; // optional
+ TColumnValue _elem28; // required
_elem28 = new TColumnValue();
_elem28.read(iprot);
struct.columnValues.add(_elem28);
@@ -751,6 +731,14 @@ public class TPut implements org.apache.
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
+ case 4: // WRITE_TO_WAL
+ if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
+ struct.writeToWal = iprot.readBool();
+ struct.setWriteToWalIsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
case 5: // ATTRIBUTES
if (schemeField.type == org.apache.thrift.protocol.TType.MAP) {
{
@@ -771,14 +759,6 @@ public class TPut implements org.apache.
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
- case 6: // DURABILITY
- if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
- struct.durability = TDurability.findByValue(iprot.readI32());
- struct.setDurabilityIsSet(true);
- } else {
- org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
- }
- break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
@@ -816,6 +796,11 @@ public class TPut implements org.apache.
oprot.writeI64(struct.timestamp);
oprot.writeFieldEnd();
}
+ if (struct.isSetWriteToWal()) {
+ oprot.writeFieldBegin(WRITE_TO_WAL_FIELD_DESC);
+ oprot.writeBool(struct.writeToWal);
+ oprot.writeFieldEnd();
+ }
if (struct.attributes != null) {
if (struct.isSetAttributes()) {
oprot.writeFieldBegin(ATTRIBUTES_FIELD_DESC);
@@ -831,13 +816,6 @@ public class TPut implements org.apache.
oprot.writeFieldEnd();
}
}
- if (struct.durability != null) {
- if (struct.isSetDurability()) {
- oprot.writeFieldBegin(DURABILITY_FIELD_DESC);
- oprot.writeI32(struct.durability.getValue());
- oprot.writeFieldEnd();
- }
- }
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@@ -867,16 +845,19 @@ public class TPut implements org.apache.
if (struct.isSetTimestamp()) {
optionals.set(0);
}
- if (struct.isSetAttributes()) {
+ if (struct.isSetWriteToWal()) {
optionals.set(1);
}
- if (struct.isSetDurability()) {
+ if (struct.isSetAttributes()) {
optionals.set(2);
}
oprot.writeBitSet(optionals, 3);
if (struct.isSetTimestamp()) {
oprot.writeI64(struct.timestamp);
}
+ if (struct.isSetWriteToWal()) {
+ oprot.writeBool(struct.writeToWal);
+ }
if (struct.isSetAttributes()) {
{
oprot.writeI32(struct.attributes.size());
@@ -887,9 +868,6 @@ public class TPut implements org.apache.
}
}
}
- if (struct.isSetDurability()) {
- oprot.writeI32(struct.durability.getValue());
- }
}
@Override
@@ -902,7 +880,7 @@ public class TPut implements org.apache.
struct.columnValues = new ArrayList<TColumnValue>(_list37.size);
for (int _i38 = 0; _i38 < _list37.size; ++_i38)
{
- TColumnValue _elem39; // optional
+ TColumnValue _elem39; // required
_elem39 = new TColumnValue();
_elem39.read(iprot);
struct.columnValues.add(_elem39);
@@ -915,6 +893,10 @@ public class TPut implements org.apache.
struct.setTimestampIsSet(true);
}
if (incoming.get(1)) {
+ struct.writeToWal = iprot.readBool();
+ struct.setWriteToWalIsSet(true);
+ }
+ if (incoming.get(2)) {
{
org.apache.thrift.protocol.TMap _map40 = new org.apache.thrift.protocol.TMap(org.apache.thrift.protocol.TType.STRING, org.apache.thrift.protocol.TType.STRING, iprot.readI32());
struct.attributes = new HashMap<ByteBuffer,ByteBuffer>(2*_map40.size);
@@ -929,10 +911,6 @@ public class TPut implements org.apache.
}
struct.setAttributesIsSet(true);
}
- if (incoming.get(2)) {
- struct.durability = TDurability.findByValue(iprot.readI32());
- struct.setDurabilityIsSet(true);
- }
}
}
Modified: hbase/trunk/hbase-server/src/main/resources/org/apache/hadoop/hbase/thrift2/hbase.thrift
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/main/resources/org/apache/hadoop/hbase/thrift2/hbase.thrift?rev=1507099&r1=1507098&r2=1507099&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/main/resources/org/apache/hadoop/hbase/thrift2/hbase.thrift (original)
+++ hbase/trunk/hbase-server/src/main/resources/org/apache/hadoop/hbase/thrift2/hbase.thrift Thu Jul 25 19:28:39 2013
@@ -78,21 +78,6 @@ enum TDeleteType {
}
/**
- * Specify Durability:
- * - SKIP_WAL means do not write the Mutation to the WAL.
- * - ASYNC_WAL means write the Mutation to the WAL asynchronously,
- * - SYNC_WAL means write the Mutation to the WAL synchronously,
- * - FSYNC_WAL means Write the Mutation to the WAL synchronously and force the entries to disk.
- */
-
-enum TDurability {
- SKIP_WAL = 1,
- ASYNC_WAL = 2,
- SYNC_WAL = 3,
- FSYNC_WAL = 4
-}
-
-/**
* Used to perform Get operations on a single row.
*
* The scope can be further narrowed down by specifying a list of
@@ -125,16 +110,15 @@ struct TGet {
* don't have one. If you don't provide a default timestamp
* the current time is inserted.
*
- * You can specify how this Put should be written to the write-ahead Log (WAL)
- * by changing the durability. If you don't provide durability, it defaults to
- * column family's default setting for durability.
+ * You can also specify if this Put should be written
+ * to the write-ahead Log (WAL) or not. It defaults to true.
*/
struct TPut {
1: required binary row,
2: required list<TColumnValue> columnValues
3: optional i64 timestamp,
- 5: optional map<binary, binary> attributes,
- 6: optional TDurability durability
+ 4: optional bool writeToWal = 1,
+ 5: optional map<binary, binary> attributes
}
/**
@@ -159,32 +143,27 @@ struct TPut {
* as if you had added a TColumn for every column family and this timestamp
* (i.e. all versions older than or equal in all column families will be deleted)
*
- * You can specify how this Delete should be written to the write-ahead Log (WAL)
- * by changing the durability. If you don't provide durability, it defaults to
- * column family's default setting for durability.
*/
struct TDelete {
1: required binary row,
2: optional list<TColumn> columns,
3: optional i64 timestamp,
4: optional TDeleteType deleteType = 1,
- 6: optional map<binary, binary> attributes,
- 7: optional TDurability durability
-
+ 5: optional bool writeToWal = 1,
+ 6: optional map<binary, binary> attributes
}
/**
* Used to perform Increment operations for a single row.
*
- * You can specify how this Increment should be written to the write-ahead Log (WAL)
- * by changing the durability. If you don't provide durability, it defaults to
- * column family's default setting for durability.
+ * You can specify if this Increment should be written
+ * to the write-ahead Log (WAL) or not. It defaults to true.
*/
struct TIncrement {
1: required binary row,
2: required list<TColumnIncrement> columns,
- 4: optional map<binary, binary> attributes,
- 5: optional TDurability durability
+ 3: optional bool writeToWal = 1,
+ 4: optional map<binary, binary> attributes
}
/**
Modified: hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandler.java
URL: http://svn.apache.org/viewvc/hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandler.java?rev=1507099&r1=1507098&r2=1507099&view=diff
==============================================================================
--- hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandler.java (original)
+++ hbase/trunk/hbase-server/src/test/java/org/apache/hadoop/hbase/thrift2/TestThriftHBaseServiceHandler.java Thu Jul 25 19:28:39 2013
@@ -32,7 +32,6 @@ import org.apache.hadoop.hbase.client.Pu
import org.apache.hadoop.hbase.client.Scan;
import org.apache.hadoop.hbase.client.Increment;
import org.apache.hadoop.hbase.client.Delete;
-import org.apache.hadoop.hbase.client.Durability;
import org.apache.hadoop.hbase.filter.ParseFilter;
import org.apache.hadoop.hbase.test.MetricsAssertHelper;
import org.apache.hadoop.hbase.thrift.ThriftMetrics;
@@ -51,7 +50,6 @@ import org.apache.hadoop.hbase.thrift2.g
import org.apache.hadoop.hbase.thrift2.generated.TScan;
import org.apache.hadoop.hbase.thrift2.generated.TMutation;
import org.apache.hadoop.hbase.thrift2.generated.TRowMutations;
-import org.apache.hadoop.hbase.thrift2.generated.TDurability;
import org.apache.hadoop.hbase.util.Bytes;
import org.apache.thrift.TException;
import org.junit.AfterClass;
@@ -866,74 +864,5 @@ public class TestThriftHBaseServiceHandl
expectedColumnValues.add(columnValueB);
assertTColumnValuesEqual(expectedColumnValues, returnedColumnValues);
}
-
- /**
- * Create TPut, TDelete , TIncrement objects, set durability then call ThriftUtility
- * functions to get Put , Delete and Increment respectively. Use getDurability to make sure
- * the returned objects have the appropriate durability setting.
- *
- * @throws Exception
- */
- @Test
- public void testDurability() throws Exception {
- byte[] rowName = "testDurability".getBytes();
- List<TColumnValue> columnValues = new ArrayList<TColumnValue>();
- columnValues.add(new TColumnValue(wrap(familyAname), wrap(qualifierAname), wrap(valueAname)));
-
- List<TColumnIncrement> incrementColumns = new ArrayList<TColumnIncrement>();
- incrementColumns.add(new TColumnIncrement(wrap(familyAname), wrap(qualifierAname)));
-
- TDelete tDelete = new TDelete(wrap(rowName));
- tDelete.setDurability(TDurability.SKIP_WAL);
- Delete delete = deleteFromThrift(tDelete);
- assertEquals(delete.getDurability(), Durability.SKIP_WAL);
-
- tDelete.setDurability(TDurability.ASYNC_WAL);
- delete = deleteFromThrift(tDelete);
- assertEquals(delete.getDurability(), Durability.ASYNC_WAL);
-
- tDelete.setDurability(TDurability.SYNC_WAL);
- delete = deleteFromThrift(tDelete);
- assertEquals(delete.getDurability(), Durability.SYNC_WAL);
-
- tDelete.setDurability(TDurability.FSYNC_WAL);
- delete = deleteFromThrift(tDelete);
- assertEquals(delete.getDurability(), Durability.FSYNC_WAL);
-
- TPut tPut = new TPut(wrap(rowName), columnValues);
- tPut.setDurability(TDurability.SKIP_WAL);
- Put put = putFromThrift(tPut);
- assertEquals(put.getDurability(), Durability.SKIP_WAL);
-
- tPut.setDurability(TDurability.ASYNC_WAL);
- put = putFromThrift(tPut);
- assertEquals(put.getDurability(), Durability.ASYNC_WAL);
-
- tPut.setDurability(TDurability.SYNC_WAL);
- put = putFromThrift(tPut);
- assertEquals(put.getDurability(), Durability.SYNC_WAL);
-
- tPut.setDurability(TDurability.FSYNC_WAL);
- put = putFromThrift(tPut);
- assertEquals(put.getDurability(), Durability.FSYNC_WAL);
-
- TIncrement tIncrement = new TIncrement(wrap(rowName), incrementColumns);
-
- tIncrement.setDurability(TDurability.SKIP_WAL);
- Increment increment = incrementFromThrift(tIncrement);
- assertEquals(increment.getDurability(), Durability.SKIP_WAL);
-
- tIncrement.setDurability(TDurability.ASYNC_WAL);
- increment = incrementFromThrift(tIncrement);
- assertEquals(increment.getDurability(), Durability.ASYNC_WAL);
-
- tIncrement.setDurability(TDurability.SYNC_WAL);
- increment = incrementFromThrift(tIncrement);
- assertEquals(increment.getDurability(), Durability.SYNC_WAL);
-
- tIncrement.setDurability(TDurability.FSYNC_WAL);
- increment = incrementFromThrift(tIncrement);
- assertEquals(increment.getDurability(), Durability.FSYNC_WAL);
- }
}