hive-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From w...@apache.org
Subject hive git commit: HIVE-11957 : Add StartedTime and LastHeartbeatTime columns to SHOW TRANSACTIONS output (Wei Zheng, reviewed by Eugene Koifman)
Date Sun, 16 Oct 2016 21:33:34 GMT
Repository: hive
Updated Branches:
  refs/heads/master 1901e3a6a -> 36bdbcc18


HIVE-11957 : Add StartedTime and LastHeartbeatTime columns to SHOW TRANSACTIONS output (Wei
Zheng, reviewed by Eugene Koifman)


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/36bdbcc1
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/36bdbcc1
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/36bdbcc1

Branch: refs/heads/master
Commit: 36bdbcc18e6efa017a28248eb5caef1bf5cfde00
Parents: 1901e3a
Author: Wei Zheng <weiz@apache.org>
Authored: Sun Oct 16 14:28:15 2016 -0700
Committer: Wei Zheng <weiz@apache.org>
Committed: Sun Oct 16 14:28:15 2016 -0700

----------------------------------------------------------------------
 metastore/if/hive_metastore.thrift              |   2 +
 .../gen/thrift/gen-cpp/hive_metastore_types.cpp |  44 ++++
 .../gen/thrift/gen-cpp/hive_metastore_types.h   |  20 +-
 .../hadoop/hive/metastore/api/TxnInfo.java      | 206 ++++++++++++++++++-
 .../src/gen/thrift/gen-php/metastore/Types.php  |  46 +++++
 .../gen/thrift/gen-py/hive_metastore/ttypes.py  |  28 ++-
 .../gen/thrift/gen-rb/hive_metastore_types.rb   |   6 +-
 .../hadoop/hive/metastore/txn/TxnHandler.java   |  12 +-
 .../org/apache/hadoop/hive/ql/exec/DDLTask.java |   8 +
 .../hadoop/hive/ql/plan/ShowTxnsDesc.java       |   2 +-
 .../clientpositive/dbtxnmgr_showlocks.q.out     |   2 +-
 11 files changed, 362 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/36bdbcc1/metastore/if/hive_metastore.thrift
----------------------------------------------------------------------
diff --git a/metastore/if/hive_metastore.thrift b/metastore/if/hive_metastore.thrift
index c5ba309..9f6ef91 100755
--- a/metastore/if/hive_metastore.thrift
+++ b/metastore/if/hive_metastore.thrift
@@ -625,6 +625,8 @@ struct TxnInfo {
     5: optional string agentInfo = "Unknown",
     6: optional i32 heartbeatCount=0,
     7: optional string metaInfo,
+    8: optional i64 startedTime,
+    9: optional i64 lastHeartbeatTime,
 }
 
 struct GetOpenTxnsInfoResponse {

http://git-wip-us.apache.org/repos/asf/hive/blob/36bdbcc1/metastore/src/gen/thrift/gen-cpp/hive_metastore_types.cpp
----------------------------------------------------------------------
diff --git a/metastore/src/gen/thrift/gen-cpp/hive_metastore_types.cpp b/metastore/src/gen/thrift/gen-cpp/hive_metastore_types.cpp
index 174b539..89541fa 100644
--- a/metastore/src/gen/thrift/gen-cpp/hive_metastore_types.cpp
+++ b/metastore/src/gen/thrift/gen-cpp/hive_metastore_types.cpp
@@ -11579,6 +11579,16 @@ void TxnInfo::__set_metaInfo(const std::string& val) {
 __isset.metaInfo = true;
 }
 
+void TxnInfo::__set_startedTime(const int64_t val) {
+  this->startedTime = val;
+__isset.startedTime = true;
+}
+
+void TxnInfo::__set_lastHeartbeatTime(const int64_t val) {
+  this->lastHeartbeatTime = val;
+__isset.lastHeartbeatTime = true;
+}
+
 uint32_t TxnInfo::read(::apache::thrift::protocol::TProtocol* iprot) {
 
   apache::thrift::protocol::TInputRecursionTracker tracker(*iprot);
@@ -11662,6 +11672,22 @@ uint32_t TxnInfo::read(::apache::thrift::protocol::TProtocol* iprot)
{
           xfer += iprot->skip(ftype);
         }
         break;
+      case 8:
+        if (ftype == ::apache::thrift::protocol::T_I64) {
+          xfer += iprot->readI64(this->startedTime);
+          this->__isset.startedTime = true;
+        } else {
+          xfer += iprot->skip(ftype);
+        }
+        break;
+      case 9:
+        if (ftype == ::apache::thrift::protocol::T_I64) {
+          xfer += iprot->readI64(this->lastHeartbeatTime);
+          this->__isset.lastHeartbeatTime = true;
+        } else {
+          xfer += iprot->skip(ftype);
+        }
+        break;
       default:
         xfer += iprot->skip(ftype);
         break;
@@ -11718,6 +11744,16 @@ uint32_t TxnInfo::write(::apache::thrift::protocol::TProtocol* oprot)
const {
     xfer += oprot->writeString(this->metaInfo);
     xfer += oprot->writeFieldEnd();
   }
+  if (this->__isset.startedTime) {
+    xfer += oprot->writeFieldBegin("startedTime", ::apache::thrift::protocol::T_I64, 8);
+    xfer += oprot->writeI64(this->startedTime);
+    xfer += oprot->writeFieldEnd();
+  }
+  if (this->__isset.lastHeartbeatTime) {
+    xfer += oprot->writeFieldBegin("lastHeartbeatTime", ::apache::thrift::protocol::T_I64,
9);
+    xfer += oprot->writeI64(this->lastHeartbeatTime);
+    xfer += oprot->writeFieldEnd();
+  }
   xfer += oprot->writeFieldStop();
   xfer += oprot->writeStructEnd();
   return xfer;
@@ -11732,6 +11768,8 @@ void swap(TxnInfo &a, TxnInfo &b) {
   swap(a.agentInfo, b.agentInfo);
   swap(a.heartbeatCount, b.heartbeatCount);
   swap(a.metaInfo, b.metaInfo);
+  swap(a.startedTime, b.startedTime);
+  swap(a.lastHeartbeatTime, b.lastHeartbeatTime);
   swap(a.__isset, b.__isset);
 }
 
@@ -11743,6 +11781,8 @@ TxnInfo::TxnInfo(const TxnInfo& other507) {
   agentInfo = other507.agentInfo;
   heartbeatCount = other507.heartbeatCount;
   metaInfo = other507.metaInfo;
+  startedTime = other507.startedTime;
+  lastHeartbeatTime = other507.lastHeartbeatTime;
   __isset = other507.__isset;
 }
 TxnInfo& TxnInfo::operator=(const TxnInfo& other508) {
@@ -11753,6 +11793,8 @@ TxnInfo& TxnInfo::operator=(const TxnInfo& other508) {
   agentInfo = other508.agentInfo;
   heartbeatCount = other508.heartbeatCount;
   metaInfo = other508.metaInfo;
+  startedTime = other508.startedTime;
+  lastHeartbeatTime = other508.lastHeartbeatTime;
   __isset = other508.__isset;
   return *this;
 }
@@ -11766,6 +11808,8 @@ void TxnInfo::printTo(std::ostream& out) const {
   out << ", " << "agentInfo="; (__isset.agentInfo ? (out << to_string(agentInfo))
: (out << "<null>"));
   out << ", " << "heartbeatCount="; (__isset.heartbeatCount ? (out << to_string(heartbeatCount))
: (out << "<null>"));
   out << ", " << "metaInfo="; (__isset.metaInfo ? (out << to_string(metaInfo))
: (out << "<null>"));
+  out << ", " << "startedTime="; (__isset.startedTime ? (out << to_string(startedTime))
: (out << "<null>"));
+  out << ", " << "lastHeartbeatTime="; (__isset.lastHeartbeatTime ? (out <<
to_string(lastHeartbeatTime)) : (out << "<null>"));
   out << ")";
 }
 

http://git-wip-us.apache.org/repos/asf/hive/blob/36bdbcc1/metastore/src/gen/thrift/gen-cpp/hive_metastore_types.h
----------------------------------------------------------------------
diff --git a/metastore/src/gen/thrift/gen-cpp/hive_metastore_types.h b/metastore/src/gen/thrift/gen-cpp/hive_metastore_types.h
index bfec694..303c298 100644
--- a/metastore/src/gen/thrift/gen-cpp/hive_metastore_types.h
+++ b/metastore/src/gen/thrift/gen-cpp/hive_metastore_types.h
@@ -4753,10 +4753,12 @@ inline std::ostream& operator<<(std::ostream& out, const
Function& obj)
 }
 
 typedef struct _TxnInfo__isset {
-  _TxnInfo__isset() : agentInfo(true), heartbeatCount(true), metaInfo(false) {}
+  _TxnInfo__isset() : agentInfo(true), heartbeatCount(true), metaInfo(false), startedTime(false),
lastHeartbeatTime(false) {}
   bool agentInfo :1;
   bool heartbeatCount :1;
   bool metaInfo :1;
+  bool startedTime :1;
+  bool lastHeartbeatTime :1;
 } _TxnInfo__isset;
 
 class TxnInfo {
@@ -4764,7 +4766,7 @@ class TxnInfo {
 
   TxnInfo(const TxnInfo&);
   TxnInfo& operator=(const TxnInfo&);
-  TxnInfo() : id(0), state((TxnState::type)0), user(), hostname(), agentInfo("Unknown"),
heartbeatCount(0), metaInfo() {
+  TxnInfo() : id(0), state((TxnState::type)0), user(), hostname(), agentInfo("Unknown"),
heartbeatCount(0), metaInfo(), startedTime(0), lastHeartbeatTime(0) {
   }
 
   virtual ~TxnInfo() throw();
@@ -4775,6 +4777,8 @@ class TxnInfo {
   std::string agentInfo;
   int32_t heartbeatCount;
   std::string metaInfo;
+  int64_t startedTime;
+  int64_t lastHeartbeatTime;
 
   _TxnInfo__isset __isset;
 
@@ -4792,6 +4796,10 @@ class TxnInfo {
 
   void __set_metaInfo(const std::string& val);
 
+  void __set_startedTime(const int64_t val);
+
+  void __set_lastHeartbeatTime(const int64_t val);
+
   bool operator == (const TxnInfo & rhs) const
   {
     if (!(id == rhs.id))
@@ -4814,6 +4822,14 @@ class TxnInfo {
       return false;
     else if (__isset.metaInfo && !(metaInfo == rhs.metaInfo))
       return false;
+    if (__isset.startedTime != rhs.__isset.startedTime)
+      return false;
+    else if (__isset.startedTime && !(startedTime == rhs.startedTime))
+      return false;
+    if (__isset.lastHeartbeatTime != rhs.__isset.lastHeartbeatTime)
+      return false;
+    else if (__isset.lastHeartbeatTime && !(lastHeartbeatTime == rhs.lastHeartbeatTime))
+      return false;
     return true;
   }
   bool operator != (const TxnInfo &rhs) const {

http://git-wip-us.apache.org/repos/asf/hive/blob/36bdbcc1/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/TxnInfo.java
----------------------------------------------------------------------
diff --git a/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/TxnInfo.java
b/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/TxnInfo.java
index 9c56ee3..ed382ed 100644
--- a/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/TxnInfo.java
+++ b/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/TxnInfo.java
@@ -45,6 +45,8 @@ public class TxnInfo implements org.apache.thrift.TBase<TxnInfo, TxnInfo._Fields
   private static final org.apache.thrift.protocol.TField AGENT_INFO_FIELD_DESC = new org.apache.thrift.protocol.TField("agentInfo",
org.apache.thrift.protocol.TType.STRING, (short)5);
   private static final org.apache.thrift.protocol.TField HEARTBEAT_COUNT_FIELD_DESC = new
org.apache.thrift.protocol.TField("heartbeatCount", org.apache.thrift.protocol.TType.I32,
(short)6);
   private static final org.apache.thrift.protocol.TField META_INFO_FIELD_DESC = new org.apache.thrift.protocol.TField("metaInfo",
org.apache.thrift.protocol.TType.STRING, (short)7);
+  private static final org.apache.thrift.protocol.TField STARTED_TIME_FIELD_DESC = new org.apache.thrift.protocol.TField("startedTime",
org.apache.thrift.protocol.TType.I64, (short)8);
+  private static final org.apache.thrift.protocol.TField LAST_HEARTBEAT_TIME_FIELD_DESC =
new org.apache.thrift.protocol.TField("lastHeartbeatTime", org.apache.thrift.protocol.TType.I64,
(short)9);
 
   private static final Map<Class<? extends IScheme>, SchemeFactory> schemes =
new HashMap<Class<? extends IScheme>, SchemeFactory>();
   static {
@@ -59,6 +61,8 @@ public class TxnInfo implements org.apache.thrift.TBase<TxnInfo, TxnInfo._Fields
   private String agentInfo; // optional
   private int heartbeatCount; // optional
   private String metaInfo; // optional
+  private long startedTime; // optional
+  private long lastHeartbeatTime; // 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 {
@@ -72,7 +76,9 @@ public class TxnInfo implements org.apache.thrift.TBase<TxnInfo, TxnInfo._Fields
     HOSTNAME((short)4, "hostname"),
     AGENT_INFO((short)5, "agentInfo"),
     HEARTBEAT_COUNT((short)6, "heartbeatCount"),
-    META_INFO((short)7, "metaInfo");
+    META_INFO((short)7, "metaInfo"),
+    STARTED_TIME((short)8, "startedTime"),
+    LAST_HEARTBEAT_TIME((short)9, "lastHeartbeatTime");
 
     private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
 
@@ -101,6 +107,10 @@ public class TxnInfo implements org.apache.thrift.TBase<TxnInfo, TxnInfo._Fields
           return HEARTBEAT_COUNT;
         case 7: // META_INFO
           return META_INFO;
+        case 8: // STARTED_TIME
+          return STARTED_TIME;
+        case 9: // LAST_HEARTBEAT_TIME
+          return LAST_HEARTBEAT_TIME;
         default:
           return null;
       }
@@ -143,8 +153,10 @@ public class TxnInfo implements org.apache.thrift.TBase<TxnInfo, TxnInfo._Fields
   // isset id assignments
   private static final int __ID_ISSET_ID = 0;
   private static final int __HEARTBEATCOUNT_ISSET_ID = 1;
+  private static final int __STARTEDTIME_ISSET_ID = 2;
+  private static final int __LASTHEARTBEATTIME_ISSET_ID = 3;
   private byte __isset_bitfield = 0;
-  private static final _Fields optionals[] = {_Fields.AGENT_INFO,_Fields.HEARTBEAT_COUNT,_Fields.META_INFO};
+  private static final _Fields optionals[] = {_Fields.AGENT_INFO,_Fields.HEARTBEAT_COUNT,_Fields.META_INFO,_Fields.STARTED_TIME,_Fields.LAST_HEARTBEAT_TIME};
   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);
@@ -162,6 +174,10 @@ public class TxnInfo implements org.apache.thrift.TBase<TxnInfo, TxnInfo._Fields
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I32)));
     tmpMap.put(_Fields.META_INFO, new org.apache.thrift.meta_data.FieldMetaData("metaInfo",
org.apache.thrift.TFieldRequirementType.OPTIONAL, 
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.STARTED_TIME, new org.apache.thrift.meta_data.FieldMetaData("startedTime",
org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
+    tmpMap.put(_Fields.LAST_HEARTBEAT_TIME, new org.apache.thrift.meta_data.FieldMetaData("lastHeartbeatTime",
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(TxnInfo.class, metaDataMap);
   }
@@ -209,6 +225,8 @@ public class TxnInfo implements org.apache.thrift.TBase<TxnInfo, TxnInfo._Fields
     if (other.isSetMetaInfo()) {
       this.metaInfo = other.metaInfo;
     }
+    this.startedTime = other.startedTime;
+    this.lastHeartbeatTime = other.lastHeartbeatTime;
   }
 
   public TxnInfo deepCopy() {
@@ -227,6 +245,10 @@ public class TxnInfo implements org.apache.thrift.TBase<TxnInfo, TxnInfo._Fields
     this.heartbeatCount = 0;
 
     this.metaInfo = null;
+    setStartedTimeIsSet(false);
+    this.startedTime = 0;
+    setLastHeartbeatTimeIsSet(false);
+    this.lastHeartbeatTime = 0;
   }
 
   public long getId() {
@@ -396,6 +418,50 @@ public class TxnInfo implements org.apache.thrift.TBase<TxnInfo, TxnInfo._Fields
     }
   }
 
+  public long getStartedTime() {
+    return this.startedTime;
+  }
+
+  public void setStartedTime(long startedTime) {
+    this.startedTime = startedTime;
+    setStartedTimeIsSet(true);
+  }
+
+  public void unsetStartedTime() {
+    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __STARTEDTIME_ISSET_ID);
+  }
+
+  /** Returns true if field startedTime is set (has been assigned a value) and false otherwise
*/
+  public boolean isSetStartedTime() {
+    return EncodingUtils.testBit(__isset_bitfield, __STARTEDTIME_ISSET_ID);
+  }
+
+  public void setStartedTimeIsSet(boolean value) {
+    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __STARTEDTIME_ISSET_ID, value);
+  }
+
+  public long getLastHeartbeatTime() {
+    return this.lastHeartbeatTime;
+  }
+
+  public void setLastHeartbeatTime(long lastHeartbeatTime) {
+    this.lastHeartbeatTime = lastHeartbeatTime;
+    setLastHeartbeatTimeIsSet(true);
+  }
+
+  public void unsetLastHeartbeatTime() {
+    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __LASTHEARTBEATTIME_ISSET_ID);
+  }
+
+  /** Returns true if field lastHeartbeatTime is set (has been assigned a value) and false
otherwise */
+  public boolean isSetLastHeartbeatTime() {
+    return EncodingUtils.testBit(__isset_bitfield, __LASTHEARTBEATTIME_ISSET_ID);
+  }
+
+  public void setLastHeartbeatTimeIsSet(boolean value) {
+    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __LASTHEARTBEATTIME_ISSET_ID,
value);
+  }
+
   public void setFieldValue(_Fields field, Object value) {
     switch (field) {
     case ID:
@@ -454,6 +520,22 @@ public class TxnInfo implements org.apache.thrift.TBase<TxnInfo, TxnInfo._Fields
       }
       break;
 
+    case STARTED_TIME:
+      if (value == null) {
+        unsetStartedTime();
+      } else {
+        setStartedTime((Long)value);
+      }
+      break;
+
+    case LAST_HEARTBEAT_TIME:
+      if (value == null) {
+        unsetLastHeartbeatTime();
+      } else {
+        setLastHeartbeatTime((Long)value);
+      }
+      break;
+
     }
   }
 
@@ -480,6 +562,12 @@ public class TxnInfo implements org.apache.thrift.TBase<TxnInfo, TxnInfo._Fields
     case META_INFO:
       return getMetaInfo();
 
+    case STARTED_TIME:
+      return getStartedTime();
+
+    case LAST_HEARTBEAT_TIME:
+      return getLastHeartbeatTime();
+
     }
     throw new IllegalStateException();
   }
@@ -505,6 +593,10 @@ public class TxnInfo implements org.apache.thrift.TBase<TxnInfo, TxnInfo._Fields
       return isSetHeartbeatCount();
     case META_INFO:
       return isSetMetaInfo();
+    case STARTED_TIME:
+      return isSetStartedTime();
+    case LAST_HEARTBEAT_TIME:
+      return isSetLastHeartbeatTime();
     }
     throw new IllegalStateException();
   }
@@ -585,6 +677,24 @@ public class TxnInfo implements org.apache.thrift.TBase<TxnInfo, TxnInfo._Fields
         return false;
     }
 
+    boolean this_present_startedTime = true && this.isSetStartedTime();
+    boolean that_present_startedTime = true && that.isSetStartedTime();
+    if (this_present_startedTime || that_present_startedTime) {
+      if (!(this_present_startedTime && that_present_startedTime))
+        return false;
+      if (this.startedTime != that.startedTime)
+        return false;
+    }
+
+    boolean this_present_lastHeartbeatTime = true && this.isSetLastHeartbeatTime();
+    boolean that_present_lastHeartbeatTime = true && that.isSetLastHeartbeatTime();
+    if (this_present_lastHeartbeatTime || that_present_lastHeartbeatTime) {
+      if (!(this_present_lastHeartbeatTime && that_present_lastHeartbeatTime))
+        return false;
+      if (this.lastHeartbeatTime != that.lastHeartbeatTime)
+        return false;
+    }
+
     return true;
   }
 
@@ -627,6 +737,16 @@ public class TxnInfo implements org.apache.thrift.TBase<TxnInfo, TxnInfo._Fields
     if (present_metaInfo)
       list.add(metaInfo);
 
+    boolean present_startedTime = true && (isSetStartedTime());
+    list.add(present_startedTime);
+    if (present_startedTime)
+      list.add(startedTime);
+
+    boolean present_lastHeartbeatTime = true && (isSetLastHeartbeatTime());
+    list.add(present_lastHeartbeatTime);
+    if (present_lastHeartbeatTime)
+      list.add(lastHeartbeatTime);
+
     return list.hashCode();
   }
 
@@ -708,6 +828,26 @@ public class TxnInfo implements org.apache.thrift.TBase<TxnInfo, TxnInfo._Fields
         return lastComparison;
       }
     }
+    lastComparison = Boolean.valueOf(isSetStartedTime()).compareTo(other.isSetStartedTime());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetStartedTime()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.startedTime, other.startedTime);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetLastHeartbeatTime()).compareTo(other.isSetLastHeartbeatTime());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetLastHeartbeatTime()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.lastHeartbeatTime, other.lastHeartbeatTime);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
     return 0;
   }
 
@@ -781,6 +921,18 @@ public class TxnInfo implements org.apache.thrift.TBase<TxnInfo, TxnInfo._Fields
       }
       first = false;
     }
+    if (isSetStartedTime()) {
+      if (!first) sb.append(", ");
+      sb.append("startedTime:");
+      sb.append(this.startedTime);
+      first = false;
+    }
+    if (isSetLastHeartbeatTime()) {
+      if (!first) sb.append(", ");
+      sb.append("lastHeartbeatTime:");
+      sb.append(this.lastHeartbeatTime);
+      first = false;
+    }
     sb.append(")");
     return sb.toString();
   }
@@ -898,6 +1050,22 @@ public class TxnInfo implements org.apache.thrift.TBase<TxnInfo,
TxnInfo._Fields
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
+          case 8: // STARTED_TIME
+            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+              struct.startedTime = iprot.readI64();
+              struct.setStartedTimeIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 9: // LAST_HEARTBEAT_TIME
+            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+              struct.lastHeartbeatTime = iprot.readI64();
+              struct.setLastHeartbeatTimeIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
           default:
             org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
         }
@@ -948,6 +1116,16 @@ public class TxnInfo implements org.apache.thrift.TBase<TxnInfo,
TxnInfo._Fields
           oprot.writeFieldEnd();
         }
       }
+      if (struct.isSetStartedTime()) {
+        oprot.writeFieldBegin(STARTED_TIME_FIELD_DESC);
+        oprot.writeI64(struct.startedTime);
+        oprot.writeFieldEnd();
+      }
+      if (struct.isSetLastHeartbeatTime()) {
+        oprot.writeFieldBegin(LAST_HEARTBEAT_TIME_FIELD_DESC);
+        oprot.writeI64(struct.lastHeartbeatTime);
+        oprot.writeFieldEnd();
+      }
       oprot.writeFieldStop();
       oprot.writeStructEnd();
     }
@@ -979,7 +1157,13 @@ public class TxnInfo implements org.apache.thrift.TBase<TxnInfo,
TxnInfo._Fields
       if (struct.isSetMetaInfo()) {
         optionals.set(2);
       }
-      oprot.writeBitSet(optionals, 3);
+      if (struct.isSetStartedTime()) {
+        optionals.set(3);
+      }
+      if (struct.isSetLastHeartbeatTime()) {
+        optionals.set(4);
+      }
+      oprot.writeBitSet(optionals, 5);
       if (struct.isSetAgentInfo()) {
         oprot.writeString(struct.agentInfo);
       }
@@ -989,6 +1173,12 @@ public class TxnInfo implements org.apache.thrift.TBase<TxnInfo,
TxnInfo._Fields
       if (struct.isSetMetaInfo()) {
         oprot.writeString(struct.metaInfo);
       }
+      if (struct.isSetStartedTime()) {
+        oprot.writeI64(struct.startedTime);
+      }
+      if (struct.isSetLastHeartbeatTime()) {
+        oprot.writeI64(struct.lastHeartbeatTime);
+      }
     }
 
     @Override
@@ -1002,7 +1192,7 @@ public class TxnInfo implements org.apache.thrift.TBase<TxnInfo,
TxnInfo._Fields
       struct.setUserIsSet(true);
       struct.hostname = iprot.readString();
       struct.setHostnameIsSet(true);
-      BitSet incoming = iprot.readBitSet(3);
+      BitSet incoming = iprot.readBitSet(5);
       if (incoming.get(0)) {
         struct.agentInfo = iprot.readString();
         struct.setAgentInfoIsSet(true);
@@ -1015,6 +1205,14 @@ public class TxnInfo implements org.apache.thrift.TBase<TxnInfo,
TxnInfo._Fields
         struct.metaInfo = iprot.readString();
         struct.setMetaInfoIsSet(true);
       }
+      if (incoming.get(3)) {
+        struct.startedTime = iprot.readI64();
+        struct.setStartedTimeIsSet(true);
+      }
+      if (incoming.get(4)) {
+        struct.lastHeartbeatTime = iprot.readI64();
+        struct.setLastHeartbeatTimeIsSet(true);
+      }
     }
   }
 

http://git-wip-us.apache.org/repos/asf/hive/blob/36bdbcc1/metastore/src/gen/thrift/gen-php/metastore/Types.php
----------------------------------------------------------------------
diff --git a/metastore/src/gen/thrift/gen-php/metastore/Types.php b/metastore/src/gen/thrift/gen-php/metastore/Types.php
index 2f9cc9b..18895cf 100644
--- a/metastore/src/gen/thrift/gen-php/metastore/Types.php
+++ b/metastore/src/gen/thrift/gen-php/metastore/Types.php
@@ -11683,6 +11683,14 @@ class TxnInfo {
    * @var string
    */
   public $metaInfo = null;
+  /**
+   * @var int
+   */
+  public $startedTime = null;
+  /**
+   * @var int
+   */
+  public $lastHeartbeatTime = null;
 
   public function __construct($vals=null) {
     if (!isset(self::$_TSPEC)) {
@@ -11715,6 +11723,14 @@ class TxnInfo {
           'var' => 'metaInfo',
           'type' => TType::STRING,
           ),
+        8 => array(
+          'var' => 'startedTime',
+          'type' => TType::I64,
+          ),
+        9 => array(
+          'var' => 'lastHeartbeatTime',
+          'type' => TType::I64,
+          ),
         );
     }
     if (is_array($vals)) {
@@ -11739,6 +11755,12 @@ class TxnInfo {
       if (isset($vals['metaInfo'])) {
         $this->metaInfo = $vals['metaInfo'];
       }
+      if (isset($vals['startedTime'])) {
+        $this->startedTime = $vals['startedTime'];
+      }
+      if (isset($vals['lastHeartbeatTime'])) {
+        $this->lastHeartbeatTime = $vals['lastHeartbeatTime'];
+      }
     }
   }
 
@@ -11810,6 +11832,20 @@ class TxnInfo {
             $xfer += $input->skip($ftype);
           }
           break;
+        case 8:
+          if ($ftype == TType::I64) {
+            $xfer += $input->readI64($this->startedTime);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 9:
+          if ($ftype == TType::I64) {
+            $xfer += $input->readI64($this->lastHeartbeatTime);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
         default:
           $xfer += $input->skip($ftype);
           break;
@@ -11858,6 +11894,16 @@ class TxnInfo {
       $xfer += $output->writeString($this->metaInfo);
       $xfer += $output->writeFieldEnd();
     }
+    if ($this->startedTime !== null) {
+      $xfer += $output->writeFieldBegin('startedTime', TType::I64, 8);
+      $xfer += $output->writeI64($this->startedTime);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->lastHeartbeatTime !== null) {
+      $xfer += $output->writeFieldBegin('lastHeartbeatTime', TType::I64, 9);
+      $xfer += $output->writeI64($this->lastHeartbeatTime);
+      $xfer += $output->writeFieldEnd();
+    }
     $xfer += $output->writeFieldStop();
     $xfer += $output->writeStructEnd();
     return $xfer;

http://git-wip-us.apache.org/repos/asf/hive/blob/36bdbcc1/metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py
----------------------------------------------------------------------
diff --git a/metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py b/metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py
index 2d308c9..65a65dd 100644
--- a/metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py
+++ b/metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py
@@ -8027,6 +8027,8 @@ class TxnInfo:
    - agentInfo
    - heartbeatCount
    - metaInfo
+   - startedTime
+   - lastHeartbeatTime
   """
 
   thrift_spec = (
@@ -8038,9 +8040,11 @@ class TxnInfo:
     (5, TType.STRING, 'agentInfo', None, "Unknown", ), # 5
     (6, TType.I32, 'heartbeatCount', None, 0, ), # 6
     (7, TType.STRING, 'metaInfo', None, None, ), # 7
+    (8, TType.I64, 'startedTime', None, None, ), # 8
+    (9, TType.I64, 'lastHeartbeatTime', None, None, ), # 9
   )
 
-  def __init__(self, id=None, state=None, user=None, hostname=None, agentInfo=thrift_spec[5][4],
heartbeatCount=thrift_spec[6][4], metaInfo=None,):
+  def __init__(self, id=None, state=None, user=None, hostname=None, agentInfo=thrift_spec[5][4],
heartbeatCount=thrift_spec[6][4], metaInfo=None, startedTime=None, lastHeartbeatTime=None,):
     self.id = id
     self.state = state
     self.user = user
@@ -8048,6 +8052,8 @@ class TxnInfo:
     self.agentInfo = agentInfo
     self.heartbeatCount = heartbeatCount
     self.metaInfo = metaInfo
+    self.startedTime = startedTime
+    self.lastHeartbeatTime = lastHeartbeatTime
 
   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:
@@ -8093,6 +8099,16 @@ class TxnInfo:
           self.metaInfo = iprot.readString()
         else:
           iprot.skip(ftype)
+      elif fid == 8:
+        if ftype == TType.I64:
+          self.startedTime = iprot.readI64()
+        else:
+          iprot.skip(ftype)
+      elif fid == 9:
+        if ftype == TType.I64:
+          self.lastHeartbeatTime = iprot.readI64()
+        else:
+          iprot.skip(ftype)
       else:
         iprot.skip(ftype)
       iprot.readFieldEnd()
@@ -8131,6 +8147,14 @@ class TxnInfo:
       oprot.writeFieldBegin('metaInfo', TType.STRING, 7)
       oprot.writeString(self.metaInfo)
       oprot.writeFieldEnd()
+    if self.startedTime is not None:
+      oprot.writeFieldBegin('startedTime', TType.I64, 8)
+      oprot.writeI64(self.startedTime)
+      oprot.writeFieldEnd()
+    if self.lastHeartbeatTime is not None:
+      oprot.writeFieldBegin('lastHeartbeatTime', TType.I64, 9)
+      oprot.writeI64(self.lastHeartbeatTime)
+      oprot.writeFieldEnd()
     oprot.writeFieldStop()
     oprot.writeStructEnd()
 
@@ -8155,6 +8179,8 @@ class TxnInfo:
     value = (value * 31) ^ hash(self.agentInfo)
     value = (value * 31) ^ hash(self.heartbeatCount)
     value = (value * 31) ^ hash(self.metaInfo)
+    value = (value * 31) ^ hash(self.startedTime)
+    value = (value * 31) ^ hash(self.lastHeartbeatTime)
     return value
 
   def __repr__(self):

http://git-wip-us.apache.org/repos/asf/hive/blob/36bdbcc1/metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb
----------------------------------------------------------------------
diff --git a/metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb b/metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb
index bd94e98..51adf50 100644
--- a/metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb
+++ b/metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb
@@ -1793,6 +1793,8 @@ class TxnInfo
   AGENTINFO = 5
   HEARTBEATCOUNT = 6
   METAINFO = 7
+  STARTEDTIME = 8
+  LASTHEARTBEATTIME = 9
 
   FIELDS = {
     ID => {:type => ::Thrift::Types::I64, :name => 'id'},
@@ -1801,7 +1803,9 @@ class TxnInfo
     HOSTNAME => {:type => ::Thrift::Types::STRING, :name => 'hostname'},
     AGENTINFO => {:type => ::Thrift::Types::STRING, :name => 'agentInfo', :default
=> %q"Unknown", :optional => true},
     HEARTBEATCOUNT => {:type => ::Thrift::Types::I32, :name => 'heartbeatCount',
:default => 0, :optional => true},
-    METAINFO => {:type => ::Thrift::Types::STRING, :name => 'metaInfo', :optional
=> true}
+    METAINFO => {:type => ::Thrift::Types::STRING, :name => 'metaInfo', :optional
=> true},
+    STARTEDTIME => {:type => ::Thrift::Types::I64, :name => 'startedTime', :optional
=> true},
+    LASTHEARTBEATTIME => {:type => ::Thrift::Types::I64, :name => 'lastHeartbeatTime',
:optional => true}
   }
 
   def struct_fields; FIELDS; end

http://git-wip-us.apache.org/repos/asf/hive/blob/36bdbcc1/metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java b/metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java
index fe16ebd..547ee98 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnHandler.java
@@ -292,9 +292,10 @@ abstract class TxnHandler implements TxnStore, TxnStore.MutexAPI {
             "initialized, null record found in next_txn_id");
         }
         close(rs);
-        List<TxnInfo> txnInfo = new ArrayList<TxnInfo>();
+        List<TxnInfo> txnInfos = new ArrayList<TxnInfo>();
         //need the WHERE clause below to ensure consistent results with READ_COMMITTED
-        s = "select txn_id, txn_state, txn_user, txn_host from TXNS where txn_id <= "
+ hwm;
+        s = "select txn_id, txn_state, txn_user, txn_host, txn_started, txn_last_heartbeat
from " +
+            "TXNS where txn_id <= " + hwm;
         LOG.debug("Going to execute query<" + s + ">");
         rs = stmt.executeQuery(s);
         while (rs.next()) {
@@ -313,11 +314,14 @@ abstract class TxnHandler implements TxnStore, TxnStore.MutexAPI {
               throw new MetaException("Unexpected transaction state " + c +
                 " found in txns table");
           }
-          txnInfo.add(new TxnInfo(rs.getLong(1), state, rs.getString(3), rs.getString(4)));
+          TxnInfo txnInfo = new TxnInfo(rs.getLong(1), state, rs.getString(3), rs.getString(4));
+          txnInfo.setStartedTime(rs.getLong(5));
+          txnInfo.setLastHeartbeatTime(rs.getLong(6));
+          txnInfos.add(txnInfo);
         }
         LOG.debug("Going to rollback");
         dbConn.rollback();
-        return new GetOpenTxnsInfoResponse(hwm, txnInfo);
+        return new GetOpenTxnsInfoResponse(hwm, txnInfos);
       } catch (SQLException e) {
         LOG.debug("Going to rollback");
         rollbackDBConn(dbConn);

http://git-wip-us.apache.org/repos/asf/hive/blob/36bdbcc1/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java b/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java
index 362ea32..acf570f 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java
@@ -2791,6 +2791,10 @@ public class DDLTask extends Task<DDLWork> implements Serializable
{
       os.write(separator);
       os.writeBytes("Transaction State");
       os.write(separator);
+      os.writeBytes("Started Time");
+      os.write(separator);
+      os.writeBytes("Last Heartbeat Time");
+      os.write(separator);
       os.writeBytes("User");
       os.write(separator);
       os.writeBytes("Hostname");
@@ -2801,6 +2805,10 @@ public class DDLTask extends Task<DDLWork> implements Serializable
{
         os.write(separator);
         os.writeBytes(txn.getState().toString());
         os.write(separator);
+        os.writeBytes(Long.toString(txn.getStartedTime()));
+        os.write(separator);
+        os.writeBytes(Long.toString(txn.getLastHeartbeatTime()));
+        os.write(separator);
         os.writeBytes(txn.getUser());
         os.write(separator);
         os.writeBytes(txn.getHostname());

http://git-wip-us.apache.org/repos/asf/hive/blob/36bdbcc1/ql/src/java/org/apache/hadoop/hive/ql/plan/ShowTxnsDesc.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/plan/ShowTxnsDesc.java b/ql/src/java/org/apache/hadoop/hive/ql/plan/ShowTxnsDesc.java
index c4508d0..9885cca 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/plan/ShowTxnsDesc.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/plan/ShowTxnsDesc.java
@@ -27,7 +27,7 @@ import java.io.Serializable;
 public class ShowTxnsDesc extends DDLDesc implements Serializable {
 
   private static final long serialVersionUID = 1L;
-  private static final String schema = "txnid,state,user,host#string:string:string:string";
+  private static final String schema = "txnid,state,startedtime,lastheartbeattime,user,host#string:string:string:string:string:string";
 
   private String resFile;
 

http://git-wip-us.apache.org/repos/asf/hive/blob/36bdbcc1/ql/src/test/results/clientpositive/dbtxnmgr_showlocks.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/dbtxnmgr_showlocks.q.out b/ql/src/test/results/clientpositive/dbtxnmgr_showlocks.q.out
index ef07a2a..3b683f8 100644
--- a/ql/src/test/results/clientpositive/dbtxnmgr_showlocks.q.out
+++ b/ql/src/test/results/clientpositive/dbtxnmgr_showlocks.q.out
@@ -17,7 +17,7 @@ PREHOOK: query: show transactions
 PREHOOK: type: SHOW TRANSACTIONS
 POSTHOOK: query: show transactions
 POSTHOOK: type: SHOW TRANSACTIONS
-Transaction ID	Transaction State	User	Hostname
+Transaction ID	Transaction State	Started Time	Last Heartbeat Time	User	Hostname
 PREHOOK: query: create table partitioned_acid_table (a int, b int) partitioned by (p string)
clustered by (a) into 2 buckets stored as orc tblproperties ('transactional'='true')
 PREHOOK: type: CREATETABLE
 PREHOOK: Output: database:default


Mime
View raw message