Merge pull request #1133 from Xylus/feature/issue-1069

Remove version field from TTransaction Thrift object
This commit is contained in:
HyunGil Jeong
2015-10-29 18:59:11 +09:00
7 changed files with 16 additions and 142 deletions
@@ -90,7 +90,6 @@ public class HbaseAgentStatDao implements AgentStatDao {
// Transaction
if (agentStat.isSetTransaction()) {
TTransaction transaction = agentStat.getTransaction();
put.addColumn(AGENT_STAT_CF_STATISTICS, AGENT_STAT_COL_TRANSACTION_VERSION, Bytes.toBytes(transaction.getVersion()));
put.addColumn(AGENT_STAT_CF_STATISTICS, AGENT_STAT_COL_TRANSACTION_SAMPLED_NEW, Bytes.toBytes(transaction.getSampledNewCount()));
put.addColumn(AGENT_STAT_CF_STATISTICS, AGENT_STAT_COL_TRANSACTION_SAMPLED_CONTINUATION, Bytes.toBytes(transaction.getSampledContinuationCount()));
put.addColumn(AGENT_STAT_CF_STATISTICS, AGENT_STAT_COL_TRANSACTION_UNSAMPLED_NEW, Bytes.toBytes(transaction.getUnsampledNewCount()));
@@ -50,7 +50,6 @@ public final class HBaseTables {
public static final byte[] AGENT_STAT_COL_NON_HEAP_MAX = Bytes.toBytes("nHpM"); // qualifier for non-heap max
public static final byte[] AGENT_STAT_COL_JVM_CPU = Bytes.toBytes("jvmCpu"); // qualifier for JVM CPU usage
public static final byte[] AGENT_STAT_COL_SYS_CPU = Bytes.toBytes("sysCpu"); // qualifier for system CPU usage
public static final byte[] AGENT_STAT_COL_TRANSACTION_VERSION = Bytes.toBytes("tV"); // qualifier for transaction version
public static final byte[] AGENT_STAT_COL_TRANSACTION_SAMPLED_NEW = Bytes.toBytes("tSN"); // qualifier for sampled new count
public static final byte[] AGENT_STAT_COL_TRANSACTION_SAMPLED_CONTINUATION = Bytes.toBytes("tSC"); // qualifier for sampled continuation count
public static final byte[] AGENT_STAT_COL_TRANSACTION_UNSAMPLED_NEW = Bytes.toBytes("tUnSN"); // qualifier for unsampled new count
@@ -34,11 +34,10 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"cast", "rawtypes", "serial", "unchecked"})
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-10-27")
@Generated(value = "Autogenerated by Thrift Compiler (0.9.2)", date = "2015-10-29")
public class TTransaction implements org.apache.thrift.TBase<TTransaction, TTransaction._Fields>, java.io.Serializable, Cloneable, Comparable<TTransaction> {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("TTransaction");
private static final org.apache.thrift.protocol.TField VERSION_FIELD_DESC = new org.apache.thrift.protocol.TField("version", org.apache.thrift.protocol.TType.I16, (short)1);
private static final org.apache.thrift.protocol.TField SAMPLED_NEW_COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("sampledNewCount", org.apache.thrift.protocol.TType.I64, (short)2);
private static final org.apache.thrift.protocol.TField SAMPLED_CONTINUATION_COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("sampledContinuationCount", org.apache.thrift.protocol.TType.I64, (short)3);
private static final org.apache.thrift.protocol.TField UNSAMPLED_NEW_COUNT_FIELD_DESC = new org.apache.thrift.protocol.TField("unsampledNewCount", org.apache.thrift.protocol.TType.I64, (short)4);
@@ -50,7 +49,6 @@ public class TTransaction implements org.apache.thrift.TBase<TTransaction, TTran
schemes.put(TupleScheme.class, new TTransactionTupleSchemeFactory());
}
private short version; // required
private long sampledNewCount; // optional
private long sampledContinuationCount; // optional
private long unsampledNewCount; // optional
@@ -58,7 +56,6 @@ public class TTransaction implements org.apache.thrift.TBase<TTransaction, TTran
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
VERSION((short)1, "version"),
SAMPLED_NEW_COUNT((short)2, "sampledNewCount"),
SAMPLED_CONTINUATION_COUNT((short)3, "sampledContinuationCount"),
UNSAMPLED_NEW_COUNT((short)4, "unsampledNewCount"),
@@ -77,8 +74,6 @@ public class TTransaction implements org.apache.thrift.TBase<TTransaction, TTran
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // VERSION
return VERSION;
case 2: // SAMPLED_NEW_COUNT
return SAMPLED_NEW_COUNT;
case 3: // SAMPLED_CONTINUATION_COUNT
@@ -127,18 +122,15 @@ public class TTransaction implements org.apache.thrift.TBase<TTransaction, TTran
}
// isset id assignments
private static final int __VERSION_ISSET_ID = 0;
private static final int __SAMPLEDNEWCOUNT_ISSET_ID = 1;
private static final int __SAMPLEDCONTINUATIONCOUNT_ISSET_ID = 2;
private static final int __UNSAMPLEDNEWCOUNT_ISSET_ID = 3;
private static final int __UNSAMPLEDCONTINUATIONCOUNT_ISSET_ID = 4;
private static final int __SAMPLEDNEWCOUNT_ISSET_ID = 0;
private static final int __SAMPLEDCONTINUATIONCOUNT_ISSET_ID = 1;
private static final int __UNSAMPLEDNEWCOUNT_ISSET_ID = 2;
private static final int __UNSAMPLEDCONTINUATIONCOUNT_ISSET_ID = 3;
private byte __isset_bitfield = 0;
private static final _Fields optionals[] = {_Fields.SAMPLED_NEW_COUNT,_Fields.SAMPLED_CONTINUATION_COUNT,_Fields.UNSAMPLED_NEW_COUNT,_Fields.UNSAMPLED_CONTINUATION_COUNT};
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);
tmpMap.put(_Fields.VERSION, new org.apache.thrift.meta_data.FieldMetaData("version", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I16)));
tmpMap.put(_Fields.SAMPLED_NEW_COUNT, new org.apache.thrift.meta_data.FieldMetaData("sampledNewCount", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
tmpMap.put(_Fields.SAMPLED_CONTINUATION_COUNT, new org.apache.thrift.meta_data.FieldMetaData("sampledContinuationCount", org.apache.thrift.TFieldRequirementType.OPTIONAL,
@@ -152,16 +144,6 @@ public class TTransaction implements org.apache.thrift.TBase<TTransaction, TTran
}
public TTransaction() {
this.version = (short)0;
}
public TTransaction(
short version)
{
this();
this.version = version;
setVersionIsSet(true);
}
/**
@@ -169,7 +151,6 @@ public class TTransaction implements org.apache.thrift.TBase<TTransaction, TTran
*/
public TTransaction(TTransaction other) {
__isset_bitfield = other.__isset_bitfield;
this.version = other.version;
this.sampledNewCount = other.sampledNewCount;
this.sampledContinuationCount = other.sampledContinuationCount;
this.unsampledNewCount = other.unsampledNewCount;
@@ -182,8 +163,6 @@ public class TTransaction implements org.apache.thrift.TBase<TTransaction, TTran
@Override
public void clear() {
this.version = (short)0;
setSampledNewCountIsSet(false);
this.sampledNewCount = 0;
setSampledContinuationCountIsSet(false);
@@ -194,28 +173,6 @@ public class TTransaction implements org.apache.thrift.TBase<TTransaction, TTran
this.unsampledContinuationCount = 0;
}
public short getVersion() {
return this.version;
}
public void setVersion(short version) {
this.version = version;
setVersionIsSet(true);
}
public void unsetVersion() {
__isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __VERSION_ISSET_ID);
}
/** Returns true if field version is set (has been assigned a value) and false otherwise */
public boolean isSetVersion() {
return EncodingUtils.testBit(__isset_bitfield, __VERSION_ISSET_ID);
}
public void setVersionIsSet(boolean value) {
__isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __VERSION_ISSET_ID, value);
}
public long getSampledNewCount() {
return this.sampledNewCount;
}
@@ -306,14 +263,6 @@ public class TTransaction implements org.apache.thrift.TBase<TTransaction, TTran
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case VERSION:
if (value == null) {
unsetVersion();
} else {
setVersion((Short)value);
}
break;
case SAMPLED_NEW_COUNT:
if (value == null) {
unsetSampledNewCount();
@@ -351,9 +300,6 @@ public class TTransaction implements org.apache.thrift.TBase<TTransaction, TTran
public Object getFieldValue(_Fields field) {
switch (field) {
case VERSION:
return Short.valueOf(getVersion());
case SAMPLED_NEW_COUNT:
return Long.valueOf(getSampledNewCount());
@@ -377,8 +323,6 @@ public class TTransaction implements org.apache.thrift.TBase<TTransaction, TTran
}
switch (field) {
case VERSION:
return isSetVersion();
case SAMPLED_NEW_COUNT:
return isSetSampledNewCount();
case SAMPLED_CONTINUATION_COUNT:
@@ -404,15 +348,6 @@ public class TTransaction implements org.apache.thrift.TBase<TTransaction, TTran
if (that == null)
return false;
boolean this_present_version = true;
boolean that_present_version = true;
if (this_present_version || that_present_version) {
if (!(this_present_version && that_present_version))
return false;
if (this.version != that.version)
return false;
}
boolean this_present_sampledNewCount = true && this.isSetSampledNewCount();
boolean that_present_sampledNewCount = true && that.isSetSampledNewCount();
if (this_present_sampledNewCount || that_present_sampledNewCount) {
@@ -456,11 +391,6 @@ public class TTransaction implements org.apache.thrift.TBase<TTransaction, TTran
public int hashCode() {
List<Object> list = new ArrayList<Object>();
boolean present_version = true;
list.add(present_version);
if (present_version)
list.add(version);
boolean present_sampledNewCount = true && (isSetSampledNewCount());
list.add(present_sampledNewCount);
if (present_sampledNewCount)
@@ -492,16 +422,6 @@ public class TTransaction implements org.apache.thrift.TBase<TTransaction, TTran
int lastComparison = 0;
lastComparison = Boolean.valueOf(isSetVersion()).compareTo(other.isSetVersion());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetVersion()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.version, other.version);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetSampledNewCount()).compareTo(other.isSetSampledNewCount());
if (lastComparison != 0) {
return lastComparison;
@@ -562,11 +482,7 @@ public class TTransaction implements org.apache.thrift.TBase<TTransaction, TTran
StringBuilder sb = new StringBuilder("TTransaction(");
boolean first = true;
sb.append("version:");
sb.append(this.version);
first = false;
if (isSetSampledNewCount()) {
if (!first) sb.append(", ");
sb.append("sampledNewCount:");
sb.append(this.sampledNewCount);
first = false;
@@ -634,14 +550,6 @@ public class TTransaction implements org.apache.thrift.TBase<TTransaction, TTran
break;
}
switch (schemeField.id) {
case 1: // VERSION
if (schemeField.type == org.apache.thrift.protocol.TType.I16) {
struct.version = iprot.readI16();
struct.setVersionIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // SAMPLED_NEW_COUNT
if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
struct.sampledNewCount = iprot.readI64();
@@ -687,9 +595,6 @@ public class TTransaction implements org.apache.thrift.TBase<TTransaction, TTran
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
oprot.writeFieldBegin(VERSION_FIELD_DESC);
oprot.writeI16(struct.version);
oprot.writeFieldEnd();
if (struct.isSetSampledNewCount()) {
oprot.writeFieldBegin(SAMPLED_NEW_COUNT_FIELD_DESC);
oprot.writeI64(struct.sampledNewCount);
@@ -728,25 +633,19 @@ public class TTransaction implements org.apache.thrift.TBase<TTransaction, TTran
public void write(org.apache.thrift.protocol.TProtocol prot, TTransaction struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
BitSet optionals = new BitSet();
if (struct.isSetVersion()) {
if (struct.isSetSampledNewCount()) {
optionals.set(0);
}
if (struct.isSetSampledNewCount()) {
if (struct.isSetSampledContinuationCount()) {
optionals.set(1);
}
if (struct.isSetSampledContinuationCount()) {
if (struct.isSetUnsampledNewCount()) {
optionals.set(2);
}
if (struct.isSetUnsampledNewCount()) {
if (struct.isSetUnsampledContinuationCount()) {
optionals.set(3);
}
if (struct.isSetUnsampledContinuationCount()) {
optionals.set(4);
}
oprot.writeBitSet(optionals, 5);
if (struct.isSetVersion()) {
oprot.writeI16(struct.version);
}
oprot.writeBitSet(optionals, 4);
if (struct.isSetSampledNewCount()) {
oprot.writeI64(struct.sampledNewCount);
}
@@ -764,24 +663,20 @@ public class TTransaction implements org.apache.thrift.TBase<TTransaction, TTran
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, TTransaction struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
BitSet incoming = iprot.readBitSet(5);
BitSet incoming = iprot.readBitSet(4);
if (incoming.get(0)) {
struct.version = iprot.readI16();
struct.setVersionIsSet(true);
}
if (incoming.get(1)) {
struct.sampledNewCount = iprot.readI64();
struct.setSampledNewCountIsSet(true);
}
if (incoming.get(2)) {
if (incoming.get(1)) {
struct.sampledContinuationCount = iprot.readI64();
struct.setSampledContinuationCountIsSet(true);
}
if (incoming.get(3)) {
if (incoming.get(2)) {
struct.unsampledNewCount = iprot.readI64();
struct.setUnsampledNewCountIsSet(true);
}
if (incoming.get(4)) {
if (incoming.get(3)) {
struct.unsampledContinuationCount = iprot.readI64();
struct.setUnsampledContinuationCountIsSet(true);
}
-1
View File
@@ -54,7 +54,6 @@ struct TCpuLoad {
}
struct TTransaction {
1: i16 version = 0
2: optional i64 sampledNewCount
3: optional i64 sampledContinuationCount
4: optional i64 unsampledNewCount
@@ -106,9 +106,6 @@ public class AgentStatMapper implements RowMapper<List<AgentStat>> {
if (qualifierMap.containsKey(AGENT_STAT_COL_SYS_CPU)) {
agentStat.setSystemCpuUsage(Bytes.toDouble(qualifierMap.get(AGENT_STAT_COL_SYS_CPU)));
}
if (qualifierMap.containsKey(AGENT_STAT_COL_TRANSACTION_VERSION)) {
agentStat.setTransactionVersion(Bytes.toShort(qualifierMap.get(AGENT_STAT_COL_TRANSACTION_VERSION)));
}
if (qualifierMap.containsKey(AGENT_STAT_COL_TRANSACTION_SAMPLED_NEW)) {
agentStat.setSampledNewCount(Bytes.toLong(qualifierMap.get(AGENT_STAT_COL_TRANSACTION_SAMPLED_NEW)));
}
@@ -39,7 +39,6 @@ public class AgentStat {
private double jvmCpuUsage = NOT_COLLECTED;
private double systemCpuUsage = NOT_COLLECTED;
private short transactionVersion;
private long sampledNewCount = NOT_COLLECTED;
private long sampledContinuationCount = NOT_COLLECTED;
private long unsampledNewCount = NOT_COLLECTED;
@@ -144,14 +143,6 @@ public class AgentStat {
this.systemCpuUsage = systemCpuUsage;
}
public short getTransactionVersion() {
return transactionVersion;
}
public void setTransactionVersion(short transactionVersion) {
this.transactionVersion = transactionVersion;
}
public long getSampledNewCount() {
return sampledNewCount;
}
@@ -190,9 +181,8 @@ public class AgentStat {
+ ", gcType=" + gcType + ", gcOldCount=" + gcOldCount + ", gcOldTime=" + gcOldTime
+ ", heapUsed=" + heapUsed + ", heapMax=" + heapMax + ", nonHeapUsed=" + nonHeapUsed
+ ", nonHeapMax=" + nonHeapMax + ", jvmCpuUsage=" + jvmCpuUsage + ", systemCpuUsage="+ systemCpuUsage
+ ", transactionVersion=" + transactionVersion + ", sampledNewCount=" + sampledNewCount
+ ", sampledContinuationCount=" + sampledContinuationCount + ", unsampledNewCount=" + unsampledNewCount
+ ", unsampledContinuationCount=" + unsampledContinuationCount + "]";
+ ", sampledNewCount=" + sampledNewCount + ", sampledContinuationCount=" + sampledContinuationCount
+ ", unsampledNewCount=" + unsampledNewCount + ", unsampledContinuationCount=" + unsampledContinuationCount + "]";
}
}
@@ -77,7 +77,6 @@ public class AgentStatMapperTest {
private static final double JVM_CPU_USAGE = 10;
private static final double SYS_CPU_USAGE = 20;
private static final short TRANSACTION_VERSION = 1;
private static final long SAMPLED_NEW_COUNT = 100L;
private static final long SAMPLED_CONTINUATION_COUNT = 200L;
private static final long UNSAMPLED_NEW_COUNT = 50L;
@@ -109,7 +108,6 @@ public class AgentStatMapperTest {
createCell(AGENT_STAT_COL_NON_HEAP_MAX, Bytes.toBytes(NON_HEAP_MAX)),
createCell(AGENT_STAT_COL_JVM_CPU, Bytes.toBytes(JVM_CPU_USAGE)),
createCell(AGENT_STAT_COL_SYS_CPU, Bytes.toBytes(SYS_CPU_USAGE)),
createCell(AGENT_STAT_COL_TRANSACTION_VERSION, Bytes.toBytes(TRANSACTION_VERSION)),
createCell(AGENT_STAT_COL_TRANSACTION_SAMPLED_NEW, Bytes.toBytes(SAMPLED_NEW_COUNT)),
createCell(AGENT_STAT_COL_TRANSACTION_SAMPLED_CONTINUATION, Bytes.toBytes(SAMPLED_CONTINUATION_COUNT)),
createCell(AGENT_STAT_COL_TRANSACTION_UNSAMPLED_NEW, Bytes.toBytes(UNSAMPLED_NEW_COUNT)),
@@ -143,7 +141,6 @@ public class AgentStatMapperTest {
assertJvmGc(agentStat);
assertEquals(AgentStat.NOT_COLLECTED, agentStat.getJvmCpuUsage(), DELTA);
assertEquals(AgentStat.NOT_COLLECTED, agentStat.getSystemCpuUsage(), DELTA);
assertEquals(0, agentStat.getTransactionVersion());
assertEquals(AgentStat.NOT_COLLECTED, agentStat.getSampledNewCount());
assertEquals(AgentStat.NOT_COLLECTED, agentStat.getSampledContinuationCount());
assertEquals(AgentStat.NOT_COLLECTED, agentStat.getUnsampledNewCount());
@@ -164,7 +161,6 @@ public class AgentStatMapperTest {
assertEquals(0, agentStat.getCollectInterval());
assertJvmGc(agentStat);
assertCpuUsage(agentStat);
assertEquals(0, agentStat.getTransactionVersion());
assertEquals(AgentStat.NOT_COLLECTED, agentStat.getSampledNewCount());
assertEquals(AgentStat.NOT_COLLECTED, agentStat.getSampledContinuationCount());
assertEquals(AgentStat.NOT_COLLECTED, agentStat.getUnsampledNewCount());
@@ -189,7 +185,6 @@ public class AgentStatMapperTest {
}
private void assertTransaction(AgentStat agentStat) {
assertEquals(TRANSACTION_VERSION, agentStat.getTransactionVersion());
assertEquals(SAMPLED_NEW_COUNT, agentStat.getSampledNewCount());
assertEquals(SAMPLED_CONTINUATION_COUNT, agentStat.getSampledContinuationCount());
assertEquals(UNSAMPLED_NEW_COUNT, agentStat.getUnsampledNewCount());