commit aee71ead8f79cb9d9813717ec2fdb3966edb0fef Author: Alan Gates Date: Sat Jan 9 07:51:39 2016 -0800 HIVE-12829 Thrift changes for HIVE-12686 diff --git metastore/if/hive_metastore.thrift metastore/if/hive_metastore.thrift index 61a90f5..f98aa6e 100755 --- metastore/if/hive_metastore.thrift +++ metastore/if/hive_metastore.thrift @@ -600,6 +600,8 @@ struct LockResponse { struct CheckLockRequest { 1: required i64 lockid, + 2: optional i64 txnid, + 3: optional i64 elapsed_ms, } struct UnlockRequest { diff --git metastore/src/gen/thrift/gen-cpp/hive_metastore_types.cpp metastore/src/gen/thrift/gen-cpp/hive_metastore_types.cpp index d918cc5..917df27 100644 --- metastore/src/gen/thrift/gen-cpp/hive_metastore_types.cpp +++ metastore/src/gen/thrift/gen-cpp/hive_metastore_types.cpp @@ -11376,6 +11376,16 @@ void CheckLockRequest::__set_lockid(const int64_t val) { this->lockid = val; } +void CheckLockRequest::__set_txnid(const int64_t val) { + this->txnid = val; +__isset.txnid = true; +} + +void CheckLockRequest::__set_elapsed_ms(const int64_t val) { + this->elapsed_ms = val; +__isset.elapsed_ms = true; +} + uint32_t CheckLockRequest::read(::apache::thrift::protocol::TProtocol* iprot) { apache::thrift::protocol::TInputRecursionTracker tracker(*iprot); @@ -11406,6 +11416,22 @@ uint32_t CheckLockRequest::read(::apache::thrift::protocol::TProtocol* iprot) { xfer += iprot->skip(ftype); } break; + case 2: + if (ftype == ::apache::thrift::protocol::T_I64) { + xfer += iprot->readI64(this->txnid); + this->__isset.txnid = true; + } else { + xfer += iprot->skip(ftype); + } + break; + case 3: + if (ftype == ::apache::thrift::protocol::T_I64) { + xfer += iprot->readI64(this->elapsed_ms); + this->__isset.elapsed_ms = true; + } else { + xfer += iprot->skip(ftype); + } + break; default: xfer += iprot->skip(ftype); break; @@ -11429,6 +11455,16 @@ uint32_t CheckLockRequest::write(::apache::thrift::protocol::TProtocol* oprot) c xfer += oprot->writeI64(this->lockid); xfer += oprot->writeFieldEnd(); + if (this->__isset.txnid) { + xfer += oprot->writeFieldBegin("txnid", ::apache::thrift::protocol::T_I64, 2); + xfer += oprot->writeI64(this->txnid); + xfer += oprot->writeFieldEnd(); + } + if (this->__isset.elapsed_ms) { + xfer += oprot->writeFieldBegin("elapsed_ms", ::apache::thrift::protocol::T_I64, 3); + xfer += oprot->writeI64(this->elapsed_ms); + xfer += oprot->writeFieldEnd(); + } xfer += oprot->writeFieldStop(); xfer += oprot->writeStructEnd(); return xfer; @@ -11437,19 +11473,30 @@ uint32_t CheckLockRequest::write(::apache::thrift::protocol::TProtocol* oprot) c void swap(CheckLockRequest &a, CheckLockRequest &b) { using ::std::swap; swap(a.lockid, b.lockid); + swap(a.txnid, b.txnid); + swap(a.elapsed_ms, b.elapsed_ms); + swap(a.__isset, b.__isset); } CheckLockRequest::CheckLockRequest(const CheckLockRequest& other513) { lockid = other513.lockid; + txnid = other513.txnid; + elapsed_ms = other513.elapsed_ms; + __isset = other513.__isset; } CheckLockRequest& CheckLockRequest::operator=(const CheckLockRequest& other514) { lockid = other514.lockid; + txnid = other514.txnid; + elapsed_ms = other514.elapsed_ms; + __isset = other514.__isset; return *this; } void CheckLockRequest::printTo(std::ostream& out) const { using ::apache::thrift::to_string; out << "CheckLockRequest("; out << "lockid=" << to_string(lockid); + out << ", " << "txnid="; (__isset.txnid ? (out << to_string(txnid)) : (out << "")); + out << ", " << "elapsed_ms="; (__isset.elapsed_ms ? (out << to_string(elapsed_ms)) : (out << "")); out << ")"; } diff --git metastore/src/gen/thrift/gen-cpp/hive_metastore_types.h metastore/src/gen/thrift/gen-cpp/hive_metastore_types.h index 46b8d69..7755843 100644 --- metastore/src/gen/thrift/gen-cpp/hive_metastore_types.h +++ metastore/src/gen/thrift/gen-cpp/hive_metastore_types.h @@ -4648,24 +4648,45 @@ inline std::ostream& operator<<(std::ostream& out, const LockResponse& obj) return out; } +typedef struct _CheckLockRequest__isset { + _CheckLockRequest__isset() : txnid(false), elapsed_ms(false) {} + bool txnid :1; + bool elapsed_ms :1; +} _CheckLockRequest__isset; class CheckLockRequest { public: CheckLockRequest(const CheckLockRequest&); CheckLockRequest& operator=(const CheckLockRequest&); - CheckLockRequest() : lockid(0) { + CheckLockRequest() : lockid(0), txnid(0), elapsed_ms(0) { } virtual ~CheckLockRequest() throw(); int64_t lockid; + int64_t txnid; + int64_t elapsed_ms; + + _CheckLockRequest__isset __isset; void __set_lockid(const int64_t val); + void __set_txnid(const int64_t val); + + void __set_elapsed_ms(const int64_t val); + bool operator == (const CheckLockRequest & rhs) const { if (!(lockid == rhs.lockid)) return false; + if (__isset.txnid != rhs.__isset.txnid) + return false; + else if (__isset.txnid && !(txnid == rhs.txnid)) + return false; + if (__isset.elapsed_ms != rhs.__isset.elapsed_ms) + return false; + else if (__isset.elapsed_ms && !(elapsed_ms == rhs.elapsed_ms)) + return false; return true; } bool operator != (const CheckLockRequest &rhs) const { diff --git metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/CheckLockRequest.java metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/CheckLockRequest.java index 430be03..bcef2ff 100644 --- metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/CheckLockRequest.java +++ metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/CheckLockRequest.java @@ -39,6 +39,8 @@ private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("CheckLockRequest"); private static final org.apache.thrift.protocol.TField LOCKID_FIELD_DESC = new org.apache.thrift.protocol.TField("lockid", org.apache.thrift.protocol.TType.I64, (short)1); + private static final org.apache.thrift.protocol.TField TXNID_FIELD_DESC = new org.apache.thrift.protocol.TField("txnid", org.apache.thrift.protocol.TType.I64, (short)2); + private static final org.apache.thrift.protocol.TField ELAPSED_MS_FIELD_DESC = new org.apache.thrift.protocol.TField("elapsed_ms", org.apache.thrift.protocol.TType.I64, (short)3); private static final Map, SchemeFactory> schemes = new HashMap, SchemeFactory>(); static { @@ -47,10 +49,14 @@ } private long lockid; // required + private long txnid; // optional + private long elapsed_ms; // 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 { - LOCKID((short)1, "lockid"); + LOCKID((short)1, "lockid"), + TXNID((short)2, "txnid"), + ELAPSED_MS((short)3, "elapsed_ms"); private static final Map byName = new HashMap(); @@ -67,6 +73,10 @@ public static _Fields findByThriftId(int fieldId) { switch(fieldId) { case 1: // LOCKID return LOCKID; + case 2: // TXNID + return TXNID; + case 3: // ELAPSED_MS + return ELAPSED_MS; default: return null; } @@ -108,12 +118,19 @@ public String getFieldName() { // isset id assignments private static final int __LOCKID_ISSET_ID = 0; + private static final int __TXNID_ISSET_ID = 1; + private static final int __ELAPSED_MS_ISSET_ID = 2; private byte __isset_bitfield = 0; + private static final _Fields optionals[] = {_Fields.TXNID,_Fields.ELAPSED_MS}; 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.LOCKID, new org.apache.thrift.meta_data.FieldMetaData("lockid", org.apache.thrift.TFieldRequirementType.REQUIRED, new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); + tmpMap.put(_Fields.TXNID, new org.apache.thrift.meta_data.FieldMetaData("txnid", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); + tmpMap.put(_Fields.ELAPSED_MS, new org.apache.thrift.meta_data.FieldMetaData("elapsed_ms", org.apache.thrift.TFieldRequirementType.OPTIONAL, + new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64))); metaDataMap = Collections.unmodifiableMap(tmpMap); org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(CheckLockRequest.class, metaDataMap); } @@ -135,6 +152,8 @@ public CheckLockRequest( public CheckLockRequest(CheckLockRequest other) { __isset_bitfield = other.__isset_bitfield; this.lockid = other.lockid; + this.txnid = other.txnid; + this.elapsed_ms = other.elapsed_ms; } public CheckLockRequest deepCopy() { @@ -145,6 +164,10 @@ public CheckLockRequest deepCopy() { public void clear() { setLockidIsSet(false); this.lockid = 0; + setTxnidIsSet(false); + this.txnid = 0; + setElapsed_msIsSet(false); + this.elapsed_ms = 0; } public long getLockid() { @@ -169,6 +192,50 @@ public void setLockidIsSet(boolean value) { __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __LOCKID_ISSET_ID, value); } + public long getTxnid() { + return this.txnid; + } + + public void setTxnid(long txnid) { + this.txnid = txnid; + setTxnidIsSet(true); + } + + public void unsetTxnid() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __TXNID_ISSET_ID); + } + + /** Returns true if field txnid is set (has been assigned a value) and false otherwise */ + public boolean isSetTxnid() { + return EncodingUtils.testBit(__isset_bitfield, __TXNID_ISSET_ID); + } + + public void setTxnidIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TXNID_ISSET_ID, value); + } + + public long getElapsed_ms() { + return this.elapsed_ms; + } + + public void setElapsed_ms(long elapsed_ms) { + this.elapsed_ms = elapsed_ms; + setElapsed_msIsSet(true); + } + + public void unsetElapsed_ms() { + __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ELAPSED_MS_ISSET_ID); + } + + /** Returns true if field elapsed_ms is set (has been assigned a value) and false otherwise */ + public boolean isSetElapsed_ms() { + return EncodingUtils.testBit(__isset_bitfield, __ELAPSED_MS_ISSET_ID); + } + + public void setElapsed_msIsSet(boolean value) { + __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ELAPSED_MS_ISSET_ID, value); + } + public void setFieldValue(_Fields field, Object value) { switch (field) { case LOCKID: @@ -179,6 +246,22 @@ public void setFieldValue(_Fields field, Object value) { } break; + case TXNID: + if (value == null) { + unsetTxnid(); + } else { + setTxnid((Long)value); + } + break; + + case ELAPSED_MS: + if (value == null) { + unsetElapsed_ms(); + } else { + setElapsed_ms((Long)value); + } + break; + } } @@ -187,6 +270,12 @@ public Object getFieldValue(_Fields field) { case LOCKID: return getLockid(); + case TXNID: + return getTxnid(); + + case ELAPSED_MS: + return getElapsed_ms(); + } throw new IllegalStateException(); } @@ -200,6 +289,10 @@ public boolean isSet(_Fields field) { switch (field) { case LOCKID: return isSetLockid(); + case TXNID: + return isSetTxnid(); + case ELAPSED_MS: + return isSetElapsed_ms(); } throw new IllegalStateException(); } @@ -226,6 +319,24 @@ public boolean equals(CheckLockRequest that) { return false; } + boolean this_present_txnid = true && this.isSetTxnid(); + boolean that_present_txnid = true && that.isSetTxnid(); + if (this_present_txnid || that_present_txnid) { + if (!(this_present_txnid && that_present_txnid)) + return false; + if (this.txnid != that.txnid) + return false; + } + + boolean this_present_elapsed_ms = true && this.isSetElapsed_ms(); + boolean that_present_elapsed_ms = true && that.isSetElapsed_ms(); + if (this_present_elapsed_ms || that_present_elapsed_ms) { + if (!(this_present_elapsed_ms && that_present_elapsed_ms)) + return false; + if (this.elapsed_ms != that.elapsed_ms) + return false; + } + return true; } @@ -238,6 +349,16 @@ public int hashCode() { if (present_lockid) list.add(lockid); + boolean present_txnid = true && (isSetTxnid()); + list.add(present_txnid); + if (present_txnid) + list.add(txnid); + + boolean present_elapsed_ms = true && (isSetElapsed_ms()); + list.add(present_elapsed_ms); + if (present_elapsed_ms) + list.add(elapsed_ms); + return list.hashCode(); } @@ -259,6 +380,26 @@ public int compareTo(CheckLockRequest other) { return lastComparison; } } + lastComparison = Boolean.valueOf(isSetTxnid()).compareTo(other.isSetTxnid()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetTxnid()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.txnid, other.txnid); + if (lastComparison != 0) { + return lastComparison; + } + } + lastComparison = Boolean.valueOf(isSetElapsed_ms()).compareTo(other.isSetElapsed_ms()); + if (lastComparison != 0) { + return lastComparison; + } + if (isSetElapsed_ms()) { + lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.elapsed_ms, other.elapsed_ms); + if (lastComparison != 0) { + return lastComparison; + } + } return 0; } @@ -282,6 +423,18 @@ public String toString() { sb.append("lockid:"); sb.append(this.lockid); first = false; + if (isSetTxnid()) { + if (!first) sb.append(", "); + sb.append("txnid:"); + sb.append(this.txnid); + first = false; + } + if (isSetElapsed_ms()) { + if (!first) sb.append(", "); + sb.append("elapsed_ms:"); + sb.append(this.elapsed_ms); + first = false; + } sb.append(")"); return sb.toString(); } @@ -339,6 +492,22 @@ public void read(org.apache.thrift.protocol.TProtocol iprot, CheckLockRequest st org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } break; + case 2: // TXNID + if (schemeField.type == org.apache.thrift.protocol.TType.I64) { + struct.txnid = iprot.readI64(); + struct.setTxnidIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; + case 3: // ELAPSED_MS + if (schemeField.type == org.apache.thrift.protocol.TType.I64) { + struct.elapsed_ms = iprot.readI64(); + struct.setElapsed_msIsSet(true); + } else { + org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); + } + break; default: org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type); } @@ -355,6 +524,16 @@ public void write(org.apache.thrift.protocol.TProtocol oprot, CheckLockRequest s oprot.writeFieldBegin(LOCKID_FIELD_DESC); oprot.writeI64(struct.lockid); oprot.writeFieldEnd(); + if (struct.isSetTxnid()) { + oprot.writeFieldBegin(TXNID_FIELD_DESC); + oprot.writeI64(struct.txnid); + oprot.writeFieldEnd(); + } + if (struct.isSetElapsed_ms()) { + oprot.writeFieldBegin(ELAPSED_MS_FIELD_DESC); + oprot.writeI64(struct.elapsed_ms); + oprot.writeFieldEnd(); + } oprot.writeFieldStop(); oprot.writeStructEnd(); } @@ -373,6 +552,20 @@ public CheckLockRequestTupleScheme getScheme() { public void write(org.apache.thrift.protocol.TProtocol prot, CheckLockRequest struct) throws org.apache.thrift.TException { TTupleProtocol oprot = (TTupleProtocol) prot; oprot.writeI64(struct.lockid); + BitSet optionals = new BitSet(); + if (struct.isSetTxnid()) { + optionals.set(0); + } + if (struct.isSetElapsed_ms()) { + optionals.set(1); + } + oprot.writeBitSet(optionals, 2); + if (struct.isSetTxnid()) { + oprot.writeI64(struct.txnid); + } + if (struct.isSetElapsed_ms()) { + oprot.writeI64(struct.elapsed_ms); + } } @Override @@ -380,6 +573,15 @@ public void read(org.apache.thrift.protocol.TProtocol prot, CheckLockRequest str TTupleProtocol iprot = (TTupleProtocol) prot; struct.lockid = iprot.readI64(); struct.setLockidIsSet(true); + BitSet incoming = iprot.readBitSet(2); + if (incoming.get(0)) { + struct.txnid = iprot.readI64(); + struct.setTxnidIsSet(true); + } + if (incoming.get(1)) { + struct.elapsed_ms = iprot.readI64(); + struct.setElapsed_msIsSet(true); + } } } diff --git metastore/src/gen/thrift/gen-php/metastore/Types.php metastore/src/gen/thrift/gen-php/metastore/Types.php index bc11ea3..297a1c2 100644 --- metastore/src/gen/thrift/gen-php/metastore/Types.php +++ metastore/src/gen/thrift/gen-php/metastore/Types.php @@ -11399,6 +11399,14 @@ class CheckLockRequest { * @var int */ public $lockid = null; + /** + * @var int + */ + public $txnid = null; + /** + * @var int + */ + public $elapsed_ms = null; public function __construct($vals=null) { if (!isset(self::$_TSPEC)) { @@ -11407,12 +11415,26 @@ class CheckLockRequest { 'var' => 'lockid', 'type' => TType::I64, ), + 2 => array( + 'var' => 'txnid', + 'type' => TType::I64, + ), + 3 => array( + 'var' => 'elapsed_ms', + 'type' => TType::I64, + ), ); } if (is_array($vals)) { if (isset($vals['lockid'])) { $this->lockid = $vals['lockid']; } + if (isset($vals['txnid'])) { + $this->txnid = $vals['txnid']; + } + if (isset($vals['elapsed_ms'])) { + $this->elapsed_ms = $vals['elapsed_ms']; + } } } @@ -11442,6 +11464,20 @@ class CheckLockRequest { $xfer += $input->skip($ftype); } break; + case 2: + if ($ftype == TType::I64) { + $xfer += $input->readI64($this->txnid); + } else { + $xfer += $input->skip($ftype); + } + break; + case 3: + if ($ftype == TType::I64) { + $xfer += $input->readI64($this->elapsed_ms); + } else { + $xfer += $input->skip($ftype); + } + break; default: $xfer += $input->skip($ftype); break; @@ -11460,6 +11496,16 @@ class CheckLockRequest { $xfer += $output->writeI64($this->lockid); $xfer += $output->writeFieldEnd(); } + if ($this->txnid !== null) { + $xfer += $output->writeFieldBegin('txnid', TType::I64, 2); + $xfer += $output->writeI64($this->txnid); + $xfer += $output->writeFieldEnd(); + } + if ($this->elapsed_ms !== null) { + $xfer += $output->writeFieldBegin('elapsed_ms', TType::I64, 3); + $xfer += $output->writeI64($this->elapsed_ms); + $xfer += $output->writeFieldEnd(); + } $xfer += $output->writeFieldStop(); $xfer += $output->writeStructEnd(); return $xfer; diff --git metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py index 12de753..28d758c 100644 --- metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py +++ metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py @@ -7902,15 +7902,21 @@ class CheckLockRequest: """ Attributes: - lockid + - txnid + - elapsed_ms """ thrift_spec = ( None, # 0 (1, TType.I64, 'lockid', None, None, ), # 1 + (2, TType.I64, 'txnid', None, None, ), # 2 + (3, TType.I64, 'elapsed_ms', None, None, ), # 3 ) - def __init__(self, lockid=None,): + def __init__(self, lockid=None, txnid=None, elapsed_ms=None,): self.lockid = lockid + self.txnid = txnid + self.elapsed_ms = elapsed_ms def read(self, iprot): if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None: @@ -7926,6 +7932,16 @@ def read(self, iprot): self.lockid = iprot.readI64() else: iprot.skip(ftype) + elif fid == 2: + if ftype == TType.I64: + self.txnid = iprot.readI64() + else: + iprot.skip(ftype) + elif fid == 3: + if ftype == TType.I64: + self.elapsed_ms = iprot.readI64() + else: + iprot.skip(ftype) else: iprot.skip(ftype) iprot.readFieldEnd() @@ -7940,6 +7956,14 @@ def write(self, oprot): oprot.writeFieldBegin('lockid', TType.I64, 1) oprot.writeI64(self.lockid) oprot.writeFieldEnd() + if self.txnid is not None: + oprot.writeFieldBegin('txnid', TType.I64, 2) + oprot.writeI64(self.txnid) + oprot.writeFieldEnd() + if self.elapsed_ms is not None: + oprot.writeFieldBegin('elapsed_ms', TType.I64, 3) + oprot.writeI64(self.elapsed_ms) + oprot.writeFieldEnd() oprot.writeFieldStop() oprot.writeStructEnd() @@ -7952,6 +7976,8 @@ def validate(self): def __hash__(self): value = 17 value = (value * 31) ^ hash(self.lockid) + value = (value * 31) ^ hash(self.txnid) + value = (value * 31) ^ hash(self.elapsed_ms) return value def __repr__(self): diff --git metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb index 6a95a95..86cd237 100644 --- metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb +++ metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb @@ -1789,9 +1789,13 @@ end class CheckLockRequest include ::Thrift::Struct, ::Thrift::Struct_Union LOCKID = 1 + TXNID = 2 + ELAPSED_MS = 3 FIELDS = { - LOCKID => {:type => ::Thrift::Types::I64, :name => 'lockid'} + LOCKID => {:type => ::Thrift::Types::I64, :name => 'lockid'}, + TXNID => {:type => ::Thrift::Types::I64, :name => 'txnid', :optional => true}, + ELAPSED_MS => {:type => ::Thrift::Types::I64, :name => 'elapsed_ms', :optional => true} } def struct_fields; FIELDS; end