You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by se...@apache.org on 2018/06/28 22:48:46 UTC

[50/52] [abbrv] hive git commit: HIVE-19867 : Test and verify Concurrent INSERT (Steve Yeom)

http://git-wip-us.apache.org/repos/asf/hive/blob/222b4aca/standalone-metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/SetPartitionsStatsRequest.java
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/SetPartitionsStatsRequest.java b/standalone-metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/SetPartitionsStatsRequest.java
index 8f46012..2053e3e 100644
--- a/standalone-metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/SetPartitionsStatsRequest.java
+++ b/standalone-metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/SetPartitionsStatsRequest.java
@@ -41,7 +41,8 @@ import org.slf4j.LoggerFactory;
   private static final org.apache.thrift.protocol.TField COL_STATS_FIELD_DESC = new org.apache.thrift.protocol.TField("colStats", org.apache.thrift.protocol.TType.LIST, (short)1);
   private static final org.apache.thrift.protocol.TField NEED_MERGE_FIELD_DESC = new org.apache.thrift.protocol.TField("needMerge", org.apache.thrift.protocol.TType.BOOL, (short)2);
   private static final org.apache.thrift.protocol.TField TXN_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("txnId", org.apache.thrift.protocol.TType.I64, (short)3);
-  private static final org.apache.thrift.protocol.TField VALID_WRITE_ID_LIST_FIELD_DESC = new org.apache.thrift.protocol.TField("validWriteIdList", org.apache.thrift.protocol.TType.STRING, (short)4);
+  private static final org.apache.thrift.protocol.TField WRITE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("writeId", org.apache.thrift.protocol.TType.I64, (short)4);
+  private static final org.apache.thrift.protocol.TField VALID_WRITE_ID_LIST_FIELD_DESC = new org.apache.thrift.protocol.TField("validWriteIdList", org.apache.thrift.protocol.TType.STRING, (short)5);
 
   private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
   static {
@@ -52,6 +53,7 @@ import org.slf4j.LoggerFactory;
   private List<ColumnStatistics> colStats; // required
   private boolean needMerge; // optional
   private long txnId; // optional
+  private long writeId; // optional
   private String validWriteIdList; // optional
 
   /** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
@@ -59,7 +61,8 @@ import org.slf4j.LoggerFactory;
     COL_STATS((short)1, "colStats"),
     NEED_MERGE((short)2, "needMerge"),
     TXN_ID((short)3, "txnId"),
-    VALID_WRITE_ID_LIST((short)4, "validWriteIdList");
+    WRITE_ID((short)4, "writeId"),
+    VALID_WRITE_ID_LIST((short)5, "validWriteIdList");
 
     private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
 
@@ -80,7 +83,9 @@ import org.slf4j.LoggerFactory;
           return NEED_MERGE;
         case 3: // TXN_ID
           return TXN_ID;
-        case 4: // VALID_WRITE_ID_LIST
+        case 4: // WRITE_ID
+          return WRITE_ID;
+        case 5: // VALID_WRITE_ID_LIST
           return VALID_WRITE_ID_LIST;
         default:
           return null;
@@ -124,8 +129,9 @@ import org.slf4j.LoggerFactory;
   // isset id assignments
   private static final int __NEEDMERGE_ISSET_ID = 0;
   private static final int __TXNID_ISSET_ID = 1;
+  private static final int __WRITEID_ISSET_ID = 2;
   private byte __isset_bitfield = 0;
-  private static final _Fields optionals[] = {_Fields.NEED_MERGE,_Fields.TXN_ID,_Fields.VALID_WRITE_ID_LIST};
+  private static final _Fields optionals[] = {_Fields.NEED_MERGE,_Fields.TXN_ID,_Fields.WRITE_ID,_Fields.VALID_WRITE_ID_LIST};
   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);
@@ -136,6 +142,8 @@ import org.slf4j.LoggerFactory;
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
     tmpMap.put(_Fields.TXN_ID, 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.WRITE_ID, new org.apache.thrift.meta_data.FieldMetaData("writeId", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
     tmpMap.put(_Fields.VALID_WRITE_ID_LIST, new org.apache.thrift.meta_data.FieldMetaData("validWriteIdList", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
     metaDataMap = Collections.unmodifiableMap(tmpMap);
@@ -145,6 +153,8 @@ import org.slf4j.LoggerFactory;
   public SetPartitionsStatsRequest() {
     this.txnId = -1L;
 
+    this.writeId = -1L;
+
   }
 
   public SetPartitionsStatsRequest(
@@ -168,6 +178,7 @@ import org.slf4j.LoggerFactory;
     }
     this.needMerge = other.needMerge;
     this.txnId = other.txnId;
+    this.writeId = other.writeId;
     if (other.isSetValidWriteIdList()) {
       this.validWriteIdList = other.validWriteIdList;
     }
@@ -184,6 +195,8 @@ import org.slf4j.LoggerFactory;
     this.needMerge = false;
     this.txnId = -1L;
 
+    this.writeId = -1L;
+
     this.validWriteIdList = null;
   }
 
@@ -269,6 +282,28 @@ import org.slf4j.LoggerFactory;
     __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TXNID_ISSET_ID, value);
   }
 
+  public long getWriteId() {
+    return this.writeId;
+  }
+
+  public void setWriteId(long writeId) {
+    this.writeId = writeId;
+    setWriteIdIsSet(true);
+  }
+
+  public void unsetWriteId() {
+    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __WRITEID_ISSET_ID);
+  }
+
+  /** Returns true if field writeId is set (has been assigned a value) and false otherwise */
+  public boolean isSetWriteId() {
+    return EncodingUtils.testBit(__isset_bitfield, __WRITEID_ISSET_ID);
+  }
+
+  public void setWriteIdIsSet(boolean value) {
+    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __WRITEID_ISSET_ID, value);
+  }
+
   public String getValidWriteIdList() {
     return this.validWriteIdList;
   }
@@ -318,6 +353,14 @@ import org.slf4j.LoggerFactory;
       }
       break;
 
+    case WRITE_ID:
+      if (value == null) {
+        unsetWriteId();
+      } else {
+        setWriteId((Long)value);
+      }
+      break;
+
     case VALID_WRITE_ID_LIST:
       if (value == null) {
         unsetValidWriteIdList();
@@ -340,6 +383,9 @@ import org.slf4j.LoggerFactory;
     case TXN_ID:
       return getTxnId();
 
+    case WRITE_ID:
+      return getWriteId();
+
     case VALID_WRITE_ID_LIST:
       return getValidWriteIdList();
 
@@ -360,6 +406,8 @@ import org.slf4j.LoggerFactory;
       return isSetNeedMerge();
     case TXN_ID:
       return isSetTxnId();
+    case WRITE_ID:
+      return isSetWriteId();
     case VALID_WRITE_ID_LIST:
       return isSetValidWriteIdList();
     }
@@ -406,6 +454,15 @@ import org.slf4j.LoggerFactory;
         return false;
     }
 
+    boolean this_present_writeId = true && this.isSetWriteId();
+    boolean that_present_writeId = true && that.isSetWriteId();
+    if (this_present_writeId || that_present_writeId) {
+      if (!(this_present_writeId && that_present_writeId))
+        return false;
+      if (this.writeId != that.writeId)
+        return false;
+    }
+
     boolean this_present_validWriteIdList = true && this.isSetValidWriteIdList();
     boolean that_present_validWriteIdList = true && that.isSetValidWriteIdList();
     if (this_present_validWriteIdList || that_present_validWriteIdList) {
@@ -437,6 +494,11 @@ import org.slf4j.LoggerFactory;
     if (present_txnId)
       list.add(txnId);
 
+    boolean present_writeId = true && (isSetWriteId());
+    list.add(present_writeId);
+    if (present_writeId)
+      list.add(writeId);
+
     boolean present_validWriteIdList = true && (isSetValidWriteIdList());
     list.add(present_validWriteIdList);
     if (present_validWriteIdList)
@@ -483,6 +545,16 @@ import org.slf4j.LoggerFactory;
         return lastComparison;
       }
     }
+    lastComparison = Boolean.valueOf(isSetWriteId()).compareTo(other.isSetWriteId());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetWriteId()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.writeId, other.writeId);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
     lastComparison = Boolean.valueOf(isSetValidWriteIdList()).compareTo(other.isSetValidWriteIdList());
     if (lastComparison != 0) {
       return lastComparison;
@@ -532,6 +604,12 @@ import org.slf4j.LoggerFactory;
       sb.append(this.txnId);
       first = false;
     }
+    if (isSetWriteId()) {
+      if (!first) sb.append(", ");
+      sb.append("writeId:");
+      sb.append(this.writeId);
+      first = false;
+    }
     if (isSetValidWriteIdList()) {
       if (!first) sb.append(", ");
       sb.append("validWriteIdList:");
@@ -626,7 +704,15 @@ import org.slf4j.LoggerFactory;
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
-          case 4: // VALID_WRITE_ID_LIST
+          case 4: // WRITE_ID
+            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+              struct.writeId = iprot.readI64();
+              struct.setWriteIdIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 5: // VALID_WRITE_ID_LIST
             if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
               struct.validWriteIdList = iprot.readString();
               struct.setValidWriteIdListIsSet(true);
@@ -669,6 +755,11 @@ import org.slf4j.LoggerFactory;
         oprot.writeI64(struct.txnId);
         oprot.writeFieldEnd();
       }
+      if (struct.isSetWriteId()) {
+        oprot.writeFieldBegin(WRITE_ID_FIELD_DESC);
+        oprot.writeI64(struct.writeId);
+        oprot.writeFieldEnd();
+      }
       if (struct.validWriteIdList != null) {
         if (struct.isSetValidWriteIdList()) {
           oprot.writeFieldBegin(VALID_WRITE_ID_LIST_FIELD_DESC);
@@ -707,16 +798,22 @@ import org.slf4j.LoggerFactory;
       if (struct.isSetTxnId()) {
         optionals.set(1);
       }
-      if (struct.isSetValidWriteIdList()) {
+      if (struct.isSetWriteId()) {
         optionals.set(2);
       }
-      oprot.writeBitSet(optionals, 3);
+      if (struct.isSetValidWriteIdList()) {
+        optionals.set(3);
+      }
+      oprot.writeBitSet(optionals, 4);
       if (struct.isSetNeedMerge()) {
         oprot.writeBool(struct.needMerge);
       }
       if (struct.isSetTxnId()) {
         oprot.writeI64(struct.txnId);
       }
+      if (struct.isSetWriteId()) {
+        oprot.writeI64(struct.writeId);
+      }
       if (struct.isSetValidWriteIdList()) {
         oprot.writeString(struct.validWriteIdList);
       }
@@ -737,7 +834,7 @@ import org.slf4j.LoggerFactory;
         }
       }
       struct.setColStatsIsSet(true);
-      BitSet incoming = iprot.readBitSet(3);
+      BitSet incoming = iprot.readBitSet(4);
       if (incoming.get(0)) {
         struct.needMerge = iprot.readBool();
         struct.setNeedMergeIsSet(true);
@@ -747,6 +844,10 @@ import org.slf4j.LoggerFactory;
         struct.setTxnIdIsSet(true);
       }
       if (incoming.get(2)) {
+        struct.writeId = iprot.readI64();
+        struct.setWriteIdIsSet(true);
+      }
+      if (incoming.get(3)) {
         struct.validWriteIdList = iprot.readString();
         struct.setValidWriteIdListIsSet(true);
       }

http://git-wip-us.apache.org/repos/asf/hive/blob/222b4aca/standalone-metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Table.java
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Table.java b/standalone-metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Table.java
index d9f17cc..27c0528 100644
--- a/standalone-metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Table.java
+++ b/standalone-metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/Table.java
@@ -57,8 +57,9 @@ import org.slf4j.LoggerFactory;
   private static final org.apache.thrift.protocol.TField CAT_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("catName", org.apache.thrift.protocol.TType.STRING, (short)17);
   private static final org.apache.thrift.protocol.TField OWNER_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("ownerType", org.apache.thrift.protocol.TType.I32, (short)18);
   private static final org.apache.thrift.protocol.TField TXN_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("txnId", org.apache.thrift.protocol.TType.I64, (short)19);
-  private static final org.apache.thrift.protocol.TField VALID_WRITE_ID_LIST_FIELD_DESC = new org.apache.thrift.protocol.TField("validWriteIdList", org.apache.thrift.protocol.TType.STRING, (short)20);
-  private static final org.apache.thrift.protocol.TField IS_STATS_COMPLIANT_FIELD_DESC = new org.apache.thrift.protocol.TField("isStatsCompliant", org.apache.thrift.protocol.TType.I32, (short)21);
+  private static final org.apache.thrift.protocol.TField WRITE_ID_FIELD_DESC = new org.apache.thrift.protocol.TField("writeId", org.apache.thrift.protocol.TType.I64, (short)20);
+  private static final org.apache.thrift.protocol.TField VALID_WRITE_ID_LIST_FIELD_DESC = new org.apache.thrift.protocol.TField("validWriteIdList", org.apache.thrift.protocol.TType.STRING, (short)21);
+  private static final org.apache.thrift.protocol.TField IS_STATS_COMPLIANT_FIELD_DESC = new org.apache.thrift.protocol.TField("isStatsCompliant", org.apache.thrift.protocol.TType.I32, (short)22);
 
   private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
   static {
@@ -85,6 +86,7 @@ import org.slf4j.LoggerFactory;
   private String catName; // optional
   private PrincipalType ownerType; // optional
   private long txnId; // optional
+  private long writeId; // optional
   private String validWriteIdList; // optional
   private IsolationLevelCompliance isStatsCompliant; // optional
 
@@ -113,12 +115,13 @@ import org.slf4j.LoggerFactory;
      */
     OWNER_TYPE((short)18, "ownerType"),
     TXN_ID((short)19, "txnId"),
-    VALID_WRITE_ID_LIST((short)20, "validWriteIdList"),
+    WRITE_ID((short)20, "writeId"),
+    VALID_WRITE_ID_LIST((short)21, "validWriteIdList"),
     /**
      * 
      * @see IsolationLevelCompliance
      */
-    IS_STATS_COMPLIANT((short)21, "isStatsCompliant");
+    IS_STATS_COMPLIANT((short)22, "isStatsCompliant");
 
     private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
 
@@ -171,9 +174,11 @@ import org.slf4j.LoggerFactory;
           return OWNER_TYPE;
         case 19: // TXN_ID
           return TXN_ID;
-        case 20: // VALID_WRITE_ID_LIST
+        case 20: // WRITE_ID
+          return WRITE_ID;
+        case 21: // VALID_WRITE_ID_LIST
           return VALID_WRITE_ID_LIST;
-        case 21: // IS_STATS_COMPLIANT
+        case 22: // IS_STATS_COMPLIANT
           return IS_STATS_COMPLIANT;
         default:
           return null;
@@ -221,8 +226,9 @@ import org.slf4j.LoggerFactory;
   private static final int __TEMPORARY_ISSET_ID = 3;
   private static final int __REWRITEENABLED_ISSET_ID = 4;
   private static final int __TXNID_ISSET_ID = 5;
+  private static final int __WRITEID_ISSET_ID = 6;
   private byte __isset_bitfield = 0;
-  private static final _Fields optionals[] = {_Fields.PRIVILEGES,_Fields.TEMPORARY,_Fields.REWRITE_ENABLED,_Fields.CREATION_METADATA,_Fields.CAT_NAME,_Fields.OWNER_TYPE,_Fields.TXN_ID,_Fields.VALID_WRITE_ID_LIST,_Fields.IS_STATS_COMPLIANT};
+  private static final _Fields optionals[] = {_Fields.PRIVILEGES,_Fields.TEMPORARY,_Fields.REWRITE_ENABLED,_Fields.CREATION_METADATA,_Fields.CAT_NAME,_Fields.OWNER_TYPE,_Fields.TXN_ID,_Fields.WRITE_ID,_Fields.VALID_WRITE_ID_LIST,_Fields.IS_STATS_COMPLIANT};
   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);
@@ -267,6 +273,8 @@ import org.slf4j.LoggerFactory;
         new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, PrincipalType.class)));
     tmpMap.put(_Fields.TXN_ID, 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.WRITE_ID, new org.apache.thrift.meta_data.FieldMetaData("writeId", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.I64)));
     tmpMap.put(_Fields.VALID_WRITE_ID_LIST, new org.apache.thrift.meta_data.FieldMetaData("validWriteIdList", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
     tmpMap.put(_Fields.IS_STATS_COMPLIANT, new org.apache.thrift.meta_data.FieldMetaData("isStatsCompliant", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
@@ -282,6 +290,8 @@ import org.slf4j.LoggerFactory;
 
     this.txnId = -1L;
 
+    this.writeId = -1L;
+
   }
 
   public Table(
@@ -371,6 +381,7 @@ import org.slf4j.LoggerFactory;
       this.ownerType = other.ownerType;
     }
     this.txnId = other.txnId;
+    this.writeId = other.writeId;
     if (other.isSetValidWriteIdList()) {
       this.validWriteIdList = other.validWriteIdList;
     }
@@ -411,6 +422,8 @@ import org.slf4j.LoggerFactory;
 
     this.txnId = -1L;
 
+    this.writeId = -1L;
+
     this.validWriteIdList = null;
     this.isStatsCompliant = null;
   }
@@ -880,6 +893,28 @@ import org.slf4j.LoggerFactory;
     __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __TXNID_ISSET_ID, value);
   }
 
+  public long getWriteId() {
+    return this.writeId;
+  }
+
+  public void setWriteId(long writeId) {
+    this.writeId = writeId;
+    setWriteIdIsSet(true);
+  }
+
+  public void unsetWriteId() {
+    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __WRITEID_ISSET_ID);
+  }
+
+  /** Returns true if field writeId is set (has been assigned a value) and false otherwise */
+  public boolean isSetWriteId() {
+    return EncodingUtils.testBit(__isset_bitfield, __WRITEID_ISSET_ID);
+  }
+
+  public void setWriteIdIsSet(boolean value) {
+    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __WRITEID_ISSET_ID, value);
+  }
+
   public String getValidWriteIdList() {
     return this.validWriteIdList;
   }
@@ -1088,6 +1123,14 @@ import org.slf4j.LoggerFactory;
       }
       break;
 
+    case WRITE_ID:
+      if (value == null) {
+        unsetWriteId();
+      } else {
+        setWriteId((Long)value);
+      }
+      break;
+
     case VALID_WRITE_ID_LIST:
       if (value == null) {
         unsetValidWriteIdList();
@@ -1166,6 +1209,9 @@ import org.slf4j.LoggerFactory;
     case TXN_ID:
       return getTxnId();
 
+    case WRITE_ID:
+      return getWriteId();
+
     case VALID_WRITE_ID_LIST:
       return getValidWriteIdList();
 
@@ -1221,6 +1267,8 @@ import org.slf4j.LoggerFactory;
       return isSetOwnerType();
     case TXN_ID:
       return isSetTxnId();
+    case WRITE_ID:
+      return isSetWriteId();
     case VALID_WRITE_ID_LIST:
       return isSetValidWriteIdList();
     case IS_STATS_COMPLIANT:
@@ -1413,6 +1461,15 @@ import org.slf4j.LoggerFactory;
         return false;
     }
 
+    boolean this_present_writeId = true && this.isSetWriteId();
+    boolean that_present_writeId = true && that.isSetWriteId();
+    if (this_present_writeId || that_present_writeId) {
+      if (!(this_present_writeId && that_present_writeId))
+        return false;
+      if (this.writeId != that.writeId)
+        return false;
+    }
+
     boolean this_present_validWriteIdList = true && this.isSetValidWriteIdList();
     boolean that_present_validWriteIdList = true && that.isSetValidWriteIdList();
     if (this_present_validWriteIdList || that_present_validWriteIdList) {
@@ -1533,6 +1590,11 @@ import org.slf4j.LoggerFactory;
     if (present_txnId)
       list.add(txnId);
 
+    boolean present_writeId = true && (isSetWriteId());
+    list.add(present_writeId);
+    if (present_writeId)
+      list.add(writeId);
+
     boolean present_validWriteIdList = true && (isSetValidWriteIdList());
     list.add(present_validWriteIdList);
     if (present_validWriteIdList)
@@ -1744,6 +1806,16 @@ import org.slf4j.LoggerFactory;
         return lastComparison;
       }
     }
+    lastComparison = Boolean.valueOf(isSetWriteId()).compareTo(other.isSetWriteId());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetWriteId()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.writeId, other.writeId);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
     lastComparison = Boolean.valueOf(isSetValidWriteIdList()).compareTo(other.isSetValidWriteIdList());
     if (lastComparison != 0) {
       return lastComparison;
@@ -1925,6 +1997,12 @@ import org.slf4j.LoggerFactory;
       sb.append(this.txnId);
       first = false;
     }
+    if (isSetWriteId()) {
+      if (!first) sb.append(", ");
+      sb.append("writeId:");
+      sb.append(this.writeId);
+      first = false;
+    }
     if (isSetValidWriteIdList()) {
       if (!first) sb.append(", ");
       sb.append("validWriteIdList:");
@@ -2174,7 +2252,15 @@ import org.slf4j.LoggerFactory;
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
-          case 20: // VALID_WRITE_ID_LIST
+          case 20: // WRITE_ID
+            if (schemeField.type == org.apache.thrift.protocol.TType.I64) {
+              struct.writeId = iprot.readI64();
+              struct.setWriteIdIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 21: // VALID_WRITE_ID_LIST
             if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
               struct.validWriteIdList = iprot.readString();
               struct.setValidWriteIdListIsSet(true);
@@ -2182,7 +2268,7 @@ import org.slf4j.LoggerFactory;
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
-          case 21: // IS_STATS_COMPLIANT
+          case 22: // IS_STATS_COMPLIANT
             if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
               struct.isStatsCompliant = org.apache.hadoop.hive.metastore.api.IsolationLevelCompliance.findByValue(iprot.readI32());
               struct.setIsStatsCompliantIsSet(true);
@@ -2315,6 +2401,11 @@ import org.slf4j.LoggerFactory;
         oprot.writeI64(struct.txnId);
         oprot.writeFieldEnd();
       }
+      if (struct.isSetWriteId()) {
+        oprot.writeFieldBegin(WRITE_ID_FIELD_DESC);
+        oprot.writeI64(struct.writeId);
+        oprot.writeFieldEnd();
+      }
       if (struct.validWriteIdList != null) {
         if (struct.isSetValidWriteIdList()) {
           oprot.writeFieldBegin(VALID_WRITE_ID_LIST_FIELD_DESC);
@@ -2404,13 +2495,16 @@ import org.slf4j.LoggerFactory;
       if (struct.isSetTxnId()) {
         optionals.set(18);
       }
-      if (struct.isSetValidWriteIdList()) {
+      if (struct.isSetWriteId()) {
         optionals.set(19);
       }
-      if (struct.isSetIsStatsCompliant()) {
+      if (struct.isSetValidWriteIdList()) {
         optionals.set(20);
       }
-      oprot.writeBitSet(optionals, 21);
+      if (struct.isSetIsStatsCompliant()) {
+        optionals.set(21);
+      }
+      oprot.writeBitSet(optionals, 22);
       if (struct.isSetTableName()) {
         oprot.writeString(struct.tableName);
       }
@@ -2481,6 +2575,9 @@ import org.slf4j.LoggerFactory;
       if (struct.isSetTxnId()) {
         oprot.writeI64(struct.txnId);
       }
+      if (struct.isSetWriteId()) {
+        oprot.writeI64(struct.writeId);
+      }
       if (struct.isSetValidWriteIdList()) {
         oprot.writeString(struct.validWriteIdList);
       }
@@ -2492,7 +2589,7 @@ import org.slf4j.LoggerFactory;
     @Override
     public void read(org.apache.thrift.protocol.TProtocol prot, Table struct) throws org.apache.thrift.TException {
       TTupleProtocol iprot = (TTupleProtocol) prot;
-      BitSet incoming = iprot.readBitSet(21);
+      BitSet incoming = iprot.readBitSet(22);
       if (incoming.get(0)) {
         struct.tableName = iprot.readString();
         struct.setTableNameIsSet(true);
@@ -2594,10 +2691,14 @@ import org.slf4j.LoggerFactory;
         struct.setTxnIdIsSet(true);
       }
       if (incoming.get(19)) {
+        struct.writeId = iprot.readI64();
+        struct.setWriteIdIsSet(true);
+      }
+      if (incoming.get(20)) {
         struct.validWriteIdList = iprot.readString();
         struct.setValidWriteIdListIsSet(true);
       }
-      if (incoming.get(20)) {
+      if (incoming.get(21)) {
         struct.isStatsCompliant = org.apache.hadoop.hive.metastore.api.IsolationLevelCompliance.findByValue(iprot.readI32());
         struct.setIsStatsCompliantIsSet(true);
       }

http://git-wip-us.apache.org/repos/asf/hive/blob/222b4aca/standalone-metastore/src/gen/thrift/gen-php/metastore/Types.php
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/gen/thrift/gen-php/metastore/Types.php b/standalone-metastore/src/gen/thrift/gen-php/metastore/Types.php
index 9033e9a..7ced369 100644
--- a/standalone-metastore/src/gen/thrift/gen-php/metastore/Types.php
+++ b/standalone-metastore/src/gen/thrift/gen-php/metastore/Types.php
@@ -6533,6 +6533,10 @@ class Table {
    */
   public $txnId = -1;
   /**
+   * @var int
+   */
+  public $writeId = -1;
+  /**
    * @var string
    */
   public $validWriteIdList = null;
@@ -6637,10 +6641,14 @@ class Table {
           'type' => TType::I64,
           ),
         20 => array(
+          'var' => 'writeId',
+          'type' => TType::I64,
+          ),
+        21 => array(
           'var' => 'validWriteIdList',
           'type' => TType::STRING,
           ),
-        21 => array(
+        22 => array(
           'var' => 'isStatsCompliant',
           'type' => TType::I32,
           ),
@@ -6704,6 +6712,9 @@ class Table {
       if (isset($vals['txnId'])) {
         $this->txnId = $vals['txnId'];
       }
+      if (isset($vals['writeId'])) {
+        $this->writeId = $vals['writeId'];
+      }
       if (isset($vals['validWriteIdList'])) {
         $this->validWriteIdList = $vals['validWriteIdList'];
       }
@@ -6893,13 +6904,20 @@ class Table {
           }
           break;
         case 20:
+          if ($ftype == TType::I64) {
+            $xfer += $input->readI64($this->writeId);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 21:
           if ($ftype == TType::STRING) {
             $xfer += $input->readString($this->validWriteIdList);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 21:
+        case 22:
           if ($ftype == TType::I32) {
             $xfer += $input->readI32($this->isStatsCompliant);
           } else {
@@ -7048,13 +7066,18 @@ class Table {
       $xfer += $output->writeI64($this->txnId);
       $xfer += $output->writeFieldEnd();
     }
+    if ($this->writeId !== null) {
+      $xfer += $output->writeFieldBegin('writeId', TType::I64, 20);
+      $xfer += $output->writeI64($this->writeId);
+      $xfer += $output->writeFieldEnd();
+    }
     if ($this->validWriteIdList !== null) {
-      $xfer += $output->writeFieldBegin('validWriteIdList', TType::STRING, 20);
+      $xfer += $output->writeFieldBegin('validWriteIdList', TType::STRING, 21);
       $xfer += $output->writeString($this->validWriteIdList);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->isStatsCompliant !== null) {
-      $xfer += $output->writeFieldBegin('isStatsCompliant', TType::I32, 21);
+      $xfer += $output->writeFieldBegin('isStatsCompliant', TType::I32, 22);
       $xfer += $output->writeI32($this->isStatsCompliant);
       $xfer += $output->writeFieldEnd();
     }
@@ -7109,6 +7132,10 @@ class Partition {
    */
   public $txnId = -1;
   /**
+   * @var int
+   */
+  public $writeId = -1;
+  /**
    * @var string
    */
   public $validWriteIdList = null;
@@ -7175,10 +7202,14 @@ class Partition {
           'type' => TType::I64,
           ),
         11 => array(
+          'var' => 'writeId',
+          'type' => TType::I64,
+          ),
+        12 => array(
           'var' => 'validWriteIdList',
           'type' => TType::STRING,
           ),
-        12 => array(
+        13 => array(
           'var' => 'isStatsCompliant',
           'type' => TType::I32,
           ),
@@ -7215,6 +7246,9 @@ class Partition {
       if (isset($vals['txnId'])) {
         $this->txnId = $vals['txnId'];
       }
+      if (isset($vals['writeId'])) {
+        $this->writeId = $vals['writeId'];
+      }
       if (isset($vals['validWriteIdList'])) {
         $this->validWriteIdList = $vals['validWriteIdList'];
       }
@@ -7339,13 +7373,20 @@ class Partition {
           }
           break;
         case 11:
+          if ($ftype == TType::I64) {
+            $xfer += $input->readI64($this->writeId);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 12:
           if ($ftype == TType::STRING) {
             $xfer += $input->readString($this->validWriteIdList);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 12:
+        case 13:
           if ($ftype == TType::I32) {
             $xfer += $input->readI32($this->isStatsCompliant);
           } else {
@@ -7446,13 +7487,18 @@ class Partition {
       $xfer += $output->writeI64($this->txnId);
       $xfer += $output->writeFieldEnd();
     }
+    if ($this->writeId !== null) {
+      $xfer += $output->writeFieldBegin('writeId', TType::I64, 11);
+      $xfer += $output->writeI64($this->writeId);
+      $xfer += $output->writeFieldEnd();
+    }
     if ($this->validWriteIdList !== null) {
-      $xfer += $output->writeFieldBegin('validWriteIdList', TType::STRING, 11);
+      $xfer += $output->writeFieldBegin('validWriteIdList', TType::STRING, 12);
       $xfer += $output->writeString($this->validWriteIdList);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->isStatsCompliant !== null) {
-      $xfer += $output->writeFieldBegin('isStatsCompliant', TType::I32, 12);
+      $xfer += $output->writeFieldBegin('isStatsCompliant', TType::I32, 13);
       $xfer += $output->writeI32($this->isStatsCompliant);
       $xfer += $output->writeFieldEnd();
     }
@@ -7984,6 +8030,10 @@ class PartitionSpec {
    */
   public $txnId = -1;
   /**
+   * @var int
+   */
+  public $writeId = -1;
+  /**
    * @var string
    */
   public $validWriteIdList = null;
@@ -8026,10 +8076,14 @@ class PartitionSpec {
           'type' => TType::I64,
           ),
         8 => array(
+          'var' => 'writeId',
+          'type' => TType::I64,
+          ),
+        9 => array(
           'var' => 'validWriteIdList',
           'type' => TType::STRING,
           ),
-        9 => array(
+        10 => array(
           'var' => 'isStatsCompliant',
           'type' => TType::I32,
           ),
@@ -8057,6 +8111,9 @@ class PartitionSpec {
       if (isset($vals['txnId'])) {
         $this->txnId = $vals['txnId'];
       }
+      if (isset($vals['writeId'])) {
+        $this->writeId = $vals['writeId'];
+      }
       if (isset($vals['validWriteIdList'])) {
         $this->validWriteIdList = $vals['validWriteIdList'];
       }
@@ -8137,13 +8194,20 @@ class PartitionSpec {
           }
           break;
         case 8:
+          if ($ftype == TType::I64) {
+            $xfer += $input->readI64($this->writeId);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 9:
           if ($ftype == TType::STRING) {
             $xfer += $input->readString($this->validWriteIdList);
           } else {
             $xfer += $input->skip($ftype);
           }
           break;
-        case 9:
+        case 10:
           if ($ftype == TType::I32) {
             $xfer += $input->readI32($this->isStatsCompliant);
           } else {
@@ -8204,13 +8268,18 @@ class PartitionSpec {
       $xfer += $output->writeI64($this->txnId);
       $xfer += $output->writeFieldEnd();
     }
+    if ($this->writeId !== null) {
+      $xfer += $output->writeFieldBegin('writeId', TType::I64, 8);
+      $xfer += $output->writeI64($this->writeId);
+      $xfer += $output->writeFieldEnd();
+    }
     if ($this->validWriteIdList !== null) {
-      $xfer += $output->writeFieldBegin('validWriteIdList', TType::STRING, 8);
+      $xfer += $output->writeFieldBegin('validWriteIdList', TType::STRING, 9);
       $xfer += $output->writeString($this->validWriteIdList);
       $xfer += $output->writeFieldEnd();
     }
     if ($this->isStatsCompliant !== null) {
-      $xfer += $output->writeFieldBegin('isStatsCompliant', TType::I32, 9);
+      $xfer += $output->writeFieldBegin('isStatsCompliant', TType::I32, 10);
       $xfer += $output->writeI32($this->isStatsCompliant);
       $xfer += $output->writeFieldEnd();
     }
@@ -10466,6 +10535,10 @@ class SetPartitionsStatsRequest {
    */
   public $txnId = -1;
   /**
+   * @var int
+   */
+  public $writeId = -1;
+  /**
    * @var string
    */
   public $validWriteIdList = null;
@@ -10491,6 +10564,10 @@ class SetPartitionsStatsRequest {
           'type' => TType::I64,
           ),
         4 => array(
+          'var' => 'writeId',
+          'type' => TType::I64,
+          ),
+        5 => array(
           'var' => 'validWriteIdList',
           'type' => TType::STRING,
           ),
@@ -10506,6 +10583,9 @@ class SetPartitionsStatsRequest {
       if (isset($vals['txnId'])) {
         $this->txnId = $vals['txnId'];
       }
+      if (isset($vals['writeId'])) {
+        $this->writeId = $vals['writeId'];
+      }
       if (isset($vals['validWriteIdList'])) {
         $this->validWriteIdList = $vals['validWriteIdList'];
       }
@@ -10564,6 +10644,13 @@ class SetPartitionsStatsRequest {
           }
           break;
         case 4:
+          if ($ftype == TType::I64) {
+            $xfer += $input->readI64($this->writeId);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 5:
           if ($ftype == TType::STRING) {
             $xfer += $input->readString($this->validWriteIdList);
           } else {
@@ -10610,8 +10697,13 @@ class SetPartitionsStatsRequest {
       $xfer += $output->writeI64($this->txnId);
       $xfer += $output->writeFieldEnd();
     }
+    if ($this->writeId !== null) {
+      $xfer += $output->writeFieldBegin('writeId', TType::I64, 4);
+      $xfer += $output->writeI64($this->writeId);
+      $xfer += $output->writeFieldEnd();
+    }
     if ($this->validWriteIdList !== null) {
-      $xfer += $output->writeFieldBegin('validWriteIdList', TType::STRING, 4);
+      $xfer += $output->writeFieldBegin('validWriteIdList', TType::STRING, 5);
       $xfer += $output->writeString($this->validWriteIdList);
       $xfer += $output->writeFieldEnd();
     }
@@ -30962,6 +31054,10 @@ class AlterPartitionsRequest {
    */
   public $txnId = -1;
   /**
+   * @var int
+   */
+  public $writeId = -1;
+  /**
    * @var string
    */
   public $validWriteIdList = null;
@@ -30996,6 +31092,10 @@ class AlterPartitionsRequest {
           'type' => TType::I64,
           ),
         6 => array(
+          'var' => 'writeId',
+          'type' => TType::I64,
+          ),
+        7 => array(
           'var' => 'validWriteIdList',
           'type' => TType::STRING,
           ),
@@ -31017,6 +31117,9 @@ class AlterPartitionsRequest {
       if (isset($vals['txnId'])) {
         $this->txnId = $vals['txnId'];
       }
+      if (isset($vals['writeId'])) {
+        $this->writeId = $vals['writeId'];
+      }
       if (isset($vals['validWriteIdList'])) {
         $this->validWriteIdList = $vals['validWriteIdList'];
       }
@@ -31090,6 +31193,13 @@ class AlterPartitionsRequest {
           }
           break;
         case 6:
+          if ($ftype == TType::I64) {
+            $xfer += $input->readI64($this->writeId);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 7:
           if ($ftype == TType::STRING) {
             $xfer += $input->readString($this->validWriteIdList);
           } else {
@@ -31149,8 +31259,13 @@ class AlterPartitionsRequest {
       $xfer += $output->writeI64($this->txnId);
       $xfer += $output->writeFieldEnd();
     }
+    if ($this->writeId !== null) {
+      $xfer += $output->writeFieldBegin('writeId', TType::I64, 6);
+      $xfer += $output->writeI64($this->writeId);
+      $xfer += $output->writeFieldEnd();
+    }
     if ($this->validWriteIdList !== null) {
-      $xfer += $output->writeFieldBegin('validWriteIdList', TType::STRING, 6);
+      $xfer += $output->writeFieldBegin('validWriteIdList', TType::STRING, 7);
       $xfer += $output->writeString($this->validWriteIdList);
       $xfer += $output->writeFieldEnd();
     }

http://git-wip-us.apache.org/repos/asf/hive/blob/222b4aca/standalone-metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py b/standalone-metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py
index ccca4e9..9b02951 100644
--- a/standalone-metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py
+++ b/standalone-metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py
@@ -4568,6 +4568,7 @@ class Table:
    - catName
    - ownerType
    - txnId
+   - writeId
    - validWriteIdList
    - isStatsCompliant
   """
@@ -4593,11 +4594,12 @@ class Table:
     (17, TType.STRING, 'catName', None, None, ), # 17
     (18, TType.I32, 'ownerType', None,     1, ), # 18
     (19, TType.I64, 'txnId', None, -1, ), # 19
-    (20, TType.STRING, 'validWriteIdList', None, None, ), # 20
-    (21, TType.I32, 'isStatsCompliant', None, None, ), # 21
+    (20, TType.I64, 'writeId', None, -1, ), # 20
+    (21, TType.STRING, 'validWriteIdList', None, None, ), # 21
+    (22, TType.I32, 'isStatsCompliant', None, None, ), # 22
   )
 
-  def __init__(self, tableName=None, dbName=None, owner=None, createTime=None, lastAccessTime=None, retention=None, sd=None, partitionKeys=None, parameters=None, viewOriginalText=None, viewExpandedText=None, tableType=None, privileges=None, temporary=thrift_spec[14][4], rewriteEnabled=None, creationMetadata=None, catName=None, ownerType=thrift_spec[18][4], txnId=thrift_spec[19][4], validWriteIdList=None, isStatsCompliant=None,):
+  def __init__(self, tableName=None, dbName=None, owner=None, createTime=None, lastAccessTime=None, retention=None, sd=None, partitionKeys=None, parameters=None, viewOriginalText=None, viewExpandedText=None, tableType=None, privileges=None, temporary=thrift_spec[14][4], rewriteEnabled=None, creationMetadata=None, catName=None, ownerType=thrift_spec[18][4], txnId=thrift_spec[19][4], writeId=thrift_spec[20][4], validWriteIdList=None, isStatsCompliant=None,):
     self.tableName = tableName
     self.dbName = dbName
     self.owner = owner
@@ -4617,6 +4619,7 @@ class Table:
     self.catName = catName
     self.ownerType = ownerType
     self.txnId = txnId
+    self.writeId = writeId
     self.validWriteIdList = validWriteIdList
     self.isStatsCompliant = isStatsCompliant
 
@@ -4740,11 +4743,16 @@ class Table:
         else:
           iprot.skip(ftype)
       elif fid == 20:
+        if ftype == TType.I64:
+          self.writeId = iprot.readI64()
+        else:
+          iprot.skip(ftype)
+      elif fid == 21:
         if ftype == TType.STRING:
           self.validWriteIdList = iprot.readString()
         else:
           iprot.skip(ftype)
-      elif fid == 21:
+      elif fid == 22:
         if ftype == TType.I32:
           self.isStatsCompliant = iprot.readI32()
         else:
@@ -4842,12 +4850,16 @@ class Table:
       oprot.writeFieldBegin('txnId', TType.I64, 19)
       oprot.writeI64(self.txnId)
       oprot.writeFieldEnd()
+    if self.writeId is not None:
+      oprot.writeFieldBegin('writeId', TType.I64, 20)
+      oprot.writeI64(self.writeId)
+      oprot.writeFieldEnd()
     if self.validWriteIdList is not None:
-      oprot.writeFieldBegin('validWriteIdList', TType.STRING, 20)
+      oprot.writeFieldBegin('validWriteIdList', TType.STRING, 21)
       oprot.writeString(self.validWriteIdList)
       oprot.writeFieldEnd()
     if self.isStatsCompliant is not None:
-      oprot.writeFieldBegin('isStatsCompliant', TType.I32, 21)
+      oprot.writeFieldBegin('isStatsCompliant', TType.I32, 22)
       oprot.writeI32(self.isStatsCompliant)
       oprot.writeFieldEnd()
     oprot.writeFieldStop()
@@ -4878,6 +4890,7 @@ class Table:
     value = (value * 31) ^ hash(self.catName)
     value = (value * 31) ^ hash(self.ownerType)
     value = (value * 31) ^ hash(self.txnId)
+    value = (value * 31) ^ hash(self.writeId)
     value = (value * 31) ^ hash(self.validWriteIdList)
     value = (value * 31) ^ hash(self.isStatsCompliant)
     return value
@@ -4906,6 +4919,7 @@ class Partition:
    - privileges
    - catName
    - txnId
+   - writeId
    - validWriteIdList
    - isStatsCompliant
   """
@@ -4922,11 +4936,12 @@ class Partition:
     (8, TType.STRUCT, 'privileges', (PrincipalPrivilegeSet, PrincipalPrivilegeSet.thrift_spec), None, ), # 8
     (9, TType.STRING, 'catName', None, None, ), # 9
     (10, TType.I64, 'txnId', None, -1, ), # 10
-    (11, TType.STRING, 'validWriteIdList', None, None, ), # 11
-    (12, TType.I32, 'isStatsCompliant', None, None, ), # 12
+    (11, TType.I64, 'writeId', None, -1, ), # 11
+    (12, TType.STRING, 'validWriteIdList', None, None, ), # 12
+    (13, TType.I32, 'isStatsCompliant', None, None, ), # 13
   )
 
-  def __init__(self, values=None, dbName=None, tableName=None, createTime=None, lastAccessTime=None, sd=None, parameters=None, privileges=None, catName=None, txnId=thrift_spec[10][4], validWriteIdList=None, isStatsCompliant=None,):
+  def __init__(self, values=None, dbName=None, tableName=None, createTime=None, lastAccessTime=None, sd=None, parameters=None, privileges=None, catName=None, txnId=thrift_spec[10][4], writeId=thrift_spec[11][4], validWriteIdList=None, isStatsCompliant=None,):
     self.values = values
     self.dbName = dbName
     self.tableName = tableName
@@ -4937,6 +4952,7 @@ class Partition:
     self.privileges = privileges
     self.catName = catName
     self.txnId = txnId
+    self.writeId = writeId
     self.validWriteIdList = validWriteIdList
     self.isStatsCompliant = isStatsCompliant
 
@@ -5013,11 +5029,16 @@ class Partition:
         else:
           iprot.skip(ftype)
       elif fid == 11:
+        if ftype == TType.I64:
+          self.writeId = iprot.readI64()
+        else:
+          iprot.skip(ftype)
+      elif fid == 12:
         if ftype == TType.STRING:
           self.validWriteIdList = iprot.readString()
         else:
           iprot.skip(ftype)
-      elif fid == 12:
+      elif fid == 13:
         if ftype == TType.I32:
           self.isStatsCompliant = iprot.readI32()
         else:
@@ -5079,12 +5100,16 @@ class Partition:
       oprot.writeFieldBegin('txnId', TType.I64, 10)
       oprot.writeI64(self.txnId)
       oprot.writeFieldEnd()
+    if self.writeId is not None:
+      oprot.writeFieldBegin('writeId', TType.I64, 11)
+      oprot.writeI64(self.writeId)
+      oprot.writeFieldEnd()
     if self.validWriteIdList is not None:
-      oprot.writeFieldBegin('validWriteIdList', TType.STRING, 11)
+      oprot.writeFieldBegin('validWriteIdList', TType.STRING, 12)
       oprot.writeString(self.validWriteIdList)
       oprot.writeFieldEnd()
     if self.isStatsCompliant is not None:
-      oprot.writeFieldBegin('isStatsCompliant', TType.I32, 12)
+      oprot.writeFieldBegin('isStatsCompliant', TType.I32, 13)
       oprot.writeI32(self.isStatsCompliant)
       oprot.writeFieldEnd()
     oprot.writeFieldStop()
@@ -5106,6 +5131,7 @@ class Partition:
     value = (value * 31) ^ hash(self.privileges)
     value = (value * 31) ^ hash(self.catName)
     value = (value * 31) ^ hash(self.txnId)
+    value = (value * 31) ^ hash(self.writeId)
     value = (value * 31) ^ hash(self.validWriteIdList)
     value = (value * 31) ^ hash(self.isStatsCompliant)
     return value
@@ -5442,6 +5468,7 @@ class PartitionSpec:
    - partitionList
    - catName
    - txnId
+   - writeId
    - validWriteIdList
    - isStatsCompliant
   """
@@ -5455,11 +5482,12 @@ class PartitionSpec:
     (5, TType.STRUCT, 'partitionList', (PartitionListComposingSpec, PartitionListComposingSpec.thrift_spec), None, ), # 5
     (6, TType.STRING, 'catName', None, None, ), # 6
     (7, TType.I64, 'txnId', None, -1, ), # 7
-    (8, TType.STRING, 'validWriteIdList', None, None, ), # 8
-    (9, TType.I32, 'isStatsCompliant', None, None, ), # 9
+    (8, TType.I64, 'writeId', None, -1, ), # 8
+    (9, TType.STRING, 'validWriteIdList', None, None, ), # 9
+    (10, TType.I32, 'isStatsCompliant', None, None, ), # 10
   )
 
-  def __init__(self, dbName=None, tableName=None, rootPath=None, sharedSDPartitionSpec=None, partitionList=None, catName=None, txnId=thrift_spec[7][4], validWriteIdList=None, isStatsCompliant=None,):
+  def __init__(self, dbName=None, tableName=None, rootPath=None, sharedSDPartitionSpec=None, partitionList=None, catName=None, txnId=thrift_spec[7][4], writeId=thrift_spec[8][4], validWriteIdList=None, isStatsCompliant=None,):
     self.dbName = dbName
     self.tableName = tableName
     self.rootPath = rootPath
@@ -5467,6 +5495,7 @@ class PartitionSpec:
     self.partitionList = partitionList
     self.catName = catName
     self.txnId = txnId
+    self.writeId = writeId
     self.validWriteIdList = validWriteIdList
     self.isStatsCompliant = isStatsCompliant
 
@@ -5517,11 +5546,16 @@ class PartitionSpec:
         else:
           iprot.skip(ftype)
       elif fid == 8:
+        if ftype == TType.I64:
+          self.writeId = iprot.readI64()
+        else:
+          iprot.skip(ftype)
+      elif fid == 9:
         if ftype == TType.STRING:
           self.validWriteIdList = iprot.readString()
         else:
           iprot.skip(ftype)
-      elif fid == 9:
+      elif fid == 10:
         if ftype == TType.I32:
           self.isStatsCompliant = iprot.readI32()
         else:
@@ -5564,12 +5598,16 @@ class PartitionSpec:
       oprot.writeFieldBegin('txnId', TType.I64, 7)
       oprot.writeI64(self.txnId)
       oprot.writeFieldEnd()
+    if self.writeId is not None:
+      oprot.writeFieldBegin('writeId', TType.I64, 8)
+      oprot.writeI64(self.writeId)
+      oprot.writeFieldEnd()
     if self.validWriteIdList is not None:
-      oprot.writeFieldBegin('validWriteIdList', TType.STRING, 8)
+      oprot.writeFieldBegin('validWriteIdList', TType.STRING, 9)
       oprot.writeString(self.validWriteIdList)
       oprot.writeFieldEnd()
     if self.isStatsCompliant is not None:
-      oprot.writeFieldBegin('isStatsCompliant', TType.I32, 9)
+      oprot.writeFieldBegin('isStatsCompliant', TType.I32, 10)
       oprot.writeI32(self.isStatsCompliant)
       oprot.writeFieldEnd()
     oprot.writeFieldStop()
@@ -5588,6 +5626,7 @@ class PartitionSpec:
     value = (value * 31) ^ hash(self.partitionList)
     value = (value * 31) ^ hash(self.catName)
     value = (value * 31) ^ hash(self.txnId)
+    value = (value * 31) ^ hash(self.writeId)
     value = (value * 31) ^ hash(self.validWriteIdList)
     value = (value * 31) ^ hash(self.isStatsCompliant)
     return value
@@ -7211,6 +7250,7 @@ class SetPartitionsStatsRequest:
    - colStats
    - needMerge
    - txnId
+   - writeId
    - validWriteIdList
   """
 
@@ -7219,13 +7259,15 @@ class SetPartitionsStatsRequest:
     (1, TType.LIST, 'colStats', (TType.STRUCT,(ColumnStatistics, ColumnStatistics.thrift_spec)), None, ), # 1
     (2, TType.BOOL, 'needMerge', None, None, ), # 2
     (3, TType.I64, 'txnId', None, -1, ), # 3
-    (4, TType.STRING, 'validWriteIdList', None, None, ), # 4
+    (4, TType.I64, 'writeId', None, -1, ), # 4
+    (5, TType.STRING, 'validWriteIdList', None, None, ), # 5
   )
 
-  def __init__(self, colStats=None, needMerge=None, txnId=thrift_spec[3][4], validWriteIdList=None,):
+  def __init__(self, colStats=None, needMerge=None, txnId=thrift_spec[3][4], writeId=thrift_spec[4][4], validWriteIdList=None,):
     self.colStats = colStats
     self.needMerge = needMerge
     self.txnId = txnId
+    self.writeId = writeId
     self.validWriteIdList = validWriteIdList
 
   def read(self, iprot):
@@ -7259,6 +7301,11 @@ class SetPartitionsStatsRequest:
         else:
           iprot.skip(ftype)
       elif fid == 4:
+        if ftype == TType.I64:
+          self.writeId = iprot.readI64()
+        else:
+          iprot.skip(ftype)
+      elif fid == 5:
         if ftype == TType.STRING:
           self.validWriteIdList = iprot.readString()
         else:
@@ -7288,8 +7335,12 @@ class SetPartitionsStatsRequest:
       oprot.writeFieldBegin('txnId', TType.I64, 3)
       oprot.writeI64(self.txnId)
       oprot.writeFieldEnd()
+    if self.writeId is not None:
+      oprot.writeFieldBegin('writeId', TType.I64, 4)
+      oprot.writeI64(self.writeId)
+      oprot.writeFieldEnd()
     if self.validWriteIdList is not None:
-      oprot.writeFieldBegin('validWriteIdList', TType.STRING, 4)
+      oprot.writeFieldBegin('validWriteIdList', TType.STRING, 5)
       oprot.writeString(self.validWriteIdList)
       oprot.writeFieldEnd()
     oprot.writeFieldStop()
@@ -7306,6 +7357,7 @@ class SetPartitionsStatsRequest:
     value = (value * 31) ^ hash(self.colStats)
     value = (value * 31) ^ hash(self.needMerge)
     value = (value * 31) ^ hash(self.txnId)
+    value = (value * 31) ^ hash(self.writeId)
     value = (value * 31) ^ hash(self.validWriteIdList)
     return value
 
@@ -22042,6 +22094,7 @@ class AlterPartitionsRequest:
    - partitions
    - environmentContext
    - txnId
+   - writeId
    - validWriteIdList
   """
 
@@ -22052,15 +22105,17 @@ class AlterPartitionsRequest:
     (3, TType.LIST, 'partitions', (TType.STRUCT,(Partition, Partition.thrift_spec)), None, ), # 3
     (4, TType.STRUCT, 'environmentContext', (EnvironmentContext, EnvironmentContext.thrift_spec), None, ), # 4
     (5, TType.I64, 'txnId', None, -1, ), # 5
-    (6, TType.STRING, 'validWriteIdList', None, None, ), # 6
+    (6, TType.I64, 'writeId', None, -1, ), # 6
+    (7, TType.STRING, 'validWriteIdList', None, None, ), # 7
   )
 
-  def __init__(self, dbName=None, tableName=None, partitions=None, environmentContext=None, txnId=thrift_spec[5][4], validWriteIdList=None,):
+  def __init__(self, dbName=None, tableName=None, partitions=None, environmentContext=None, txnId=thrift_spec[5][4], writeId=thrift_spec[6][4], validWriteIdList=None,):
     self.dbName = dbName
     self.tableName = tableName
     self.partitions = partitions
     self.environmentContext = environmentContext
     self.txnId = txnId
+    self.writeId = writeId
     self.validWriteIdList = validWriteIdList
 
   def read(self, iprot):
@@ -22105,6 +22160,11 @@ class AlterPartitionsRequest:
         else:
           iprot.skip(ftype)
       elif fid == 6:
+        if ftype == TType.I64:
+          self.writeId = iprot.readI64()
+        else:
+          iprot.skip(ftype)
+      elif fid == 7:
         if ftype == TType.STRING:
           self.validWriteIdList = iprot.readString()
         else:
@@ -22142,8 +22202,12 @@ class AlterPartitionsRequest:
       oprot.writeFieldBegin('txnId', TType.I64, 5)
       oprot.writeI64(self.txnId)
       oprot.writeFieldEnd()
+    if self.writeId is not None:
+      oprot.writeFieldBegin('writeId', TType.I64, 6)
+      oprot.writeI64(self.writeId)
+      oprot.writeFieldEnd()
     if self.validWriteIdList is not None:
-      oprot.writeFieldBegin('validWriteIdList', TType.STRING, 6)
+      oprot.writeFieldBegin('validWriteIdList', TType.STRING, 7)
       oprot.writeString(self.validWriteIdList)
       oprot.writeFieldEnd()
     oprot.writeFieldStop()
@@ -22168,6 +22232,7 @@ class AlterPartitionsRequest:
     value = (value * 31) ^ hash(self.partitions)
     value = (value * 31) ^ hash(self.environmentContext)
     value = (value * 31) ^ hash(self.txnId)
+    value = (value * 31) ^ hash(self.writeId)
     value = (value * 31) ^ hash(self.validWriteIdList)
     return value
 

http://git-wip-us.apache.org/repos/asf/hive/blob/222b4aca/standalone-metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb b/standalone-metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb
index 7b5132c..d58a60e 100644
--- a/standalone-metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb
+++ b/standalone-metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb
@@ -1071,8 +1071,9 @@ class Table
   CATNAME = 17
   OWNERTYPE = 18
   TXNID = 19
-  VALIDWRITEIDLIST = 20
-  ISSTATSCOMPLIANT = 21
+  WRITEID = 20
+  VALIDWRITEIDLIST = 21
+  ISSTATSCOMPLIANT = 22
 
   FIELDS = {
     TABLENAME => {:type => ::Thrift::Types::STRING, :name => 'tableName'},
@@ -1094,6 +1095,7 @@ class Table
     CATNAME => {:type => ::Thrift::Types::STRING, :name => 'catName', :optional => true},
     OWNERTYPE => {:type => ::Thrift::Types::I32, :name => 'ownerType', :default =>     1, :optional => true, :enum_class => ::PrincipalType},
     TXNID => {:type => ::Thrift::Types::I64, :name => 'txnId', :default => -1, :optional => true},
+    WRITEID => {:type => ::Thrift::Types::I64, :name => 'writeId', :default => -1, :optional => true},
     VALIDWRITEIDLIST => {:type => ::Thrift::Types::STRING, :name => 'validWriteIdList', :optional => true},
     ISSTATSCOMPLIANT => {:type => ::Thrift::Types::I32, :name => 'isStatsCompliant', :optional => true, :enum_class => ::IsolationLevelCompliance}
   }
@@ -1124,8 +1126,9 @@ class Partition
   PRIVILEGES = 8
   CATNAME = 9
   TXNID = 10
-  VALIDWRITEIDLIST = 11
-  ISSTATSCOMPLIANT = 12
+  WRITEID = 11
+  VALIDWRITEIDLIST = 12
+  ISSTATSCOMPLIANT = 13
 
   FIELDS = {
     VALUES => {:type => ::Thrift::Types::LIST, :name => 'values', :element => {:type => ::Thrift::Types::STRING}},
@@ -1138,6 +1141,7 @@ class Partition
     PRIVILEGES => {:type => ::Thrift::Types::STRUCT, :name => 'privileges', :class => ::PrincipalPrivilegeSet, :optional => true},
     CATNAME => {:type => ::Thrift::Types::STRING, :name => 'catName', :optional => true},
     TXNID => {:type => ::Thrift::Types::I64, :name => 'txnId', :default => -1, :optional => true},
+    WRITEID => {:type => ::Thrift::Types::I64, :name => 'writeId', :default => -1, :optional => true},
     VALIDWRITEIDLIST => {:type => ::Thrift::Types::STRING, :name => 'validWriteIdList', :optional => true},
     ISSTATSCOMPLIANT => {:type => ::Thrift::Types::I32, :name => 'isStatsCompliant', :optional => true, :enum_class => ::IsolationLevelCompliance}
   }
@@ -1222,8 +1226,9 @@ class PartitionSpec
   PARTITIONLIST = 5
   CATNAME = 6
   TXNID = 7
-  VALIDWRITEIDLIST = 8
-  ISSTATSCOMPLIANT = 9
+  WRITEID = 8
+  VALIDWRITEIDLIST = 9
+  ISSTATSCOMPLIANT = 10
 
   FIELDS = {
     DBNAME => {:type => ::Thrift::Types::STRING, :name => 'dbName'},
@@ -1233,6 +1238,7 @@ class PartitionSpec
     PARTITIONLIST => {:type => ::Thrift::Types::STRUCT, :name => 'partitionList', :class => ::PartitionListComposingSpec, :optional => true},
     CATNAME => {:type => ::Thrift::Types::STRING, :name => 'catName', :optional => true},
     TXNID => {:type => ::Thrift::Types::I64, :name => 'txnId', :default => -1, :optional => true},
+    WRITEID => {:type => ::Thrift::Types::I64, :name => 'writeId', :default => -1, :optional => true},
     VALIDWRITEIDLIST => {:type => ::Thrift::Types::STRING, :name => 'validWriteIdList', :optional => true},
     ISSTATSCOMPLIANT => {:type => ::Thrift::Types::I32, :name => 'isStatsCompliant', :optional => true, :enum_class => ::IsolationLevelCompliance}
   }
@@ -1637,12 +1643,14 @@ class SetPartitionsStatsRequest
   COLSTATS = 1
   NEEDMERGE = 2
   TXNID = 3
-  VALIDWRITEIDLIST = 4
+  WRITEID = 4
+  VALIDWRITEIDLIST = 5
 
   FIELDS = {
     COLSTATS => {:type => ::Thrift::Types::LIST, :name => 'colStats', :element => {:type => ::Thrift::Types::STRUCT, :class => ::ColumnStatistics}},
     NEEDMERGE => {:type => ::Thrift::Types::BOOL, :name => 'needMerge', :optional => true},
     TXNID => {:type => ::Thrift::Types::I64, :name => 'txnId', :default => -1, :optional => true},
+    WRITEID => {:type => ::Thrift::Types::I64, :name => 'writeId', :default => -1, :optional => true},
     VALIDWRITEIDLIST => {:type => ::Thrift::Types::STRING, :name => 'validWriteIdList', :optional => true}
   }
 
@@ -5019,7 +5027,8 @@ class AlterPartitionsRequest
   PARTITIONS = 3
   ENVIRONMENTCONTEXT = 4
   TXNID = 5
-  VALIDWRITEIDLIST = 6
+  WRITEID = 6
+  VALIDWRITEIDLIST = 7
 
   FIELDS = {
     DBNAME => {:type => ::Thrift::Types::STRING, :name => 'dbName'},
@@ -5027,6 +5036,7 @@ class AlterPartitionsRequest
     PARTITIONS => {:type => ::Thrift::Types::LIST, :name => 'partitions', :element => {:type => ::Thrift::Types::STRUCT, :class => ::Partition}},
     ENVIRONMENTCONTEXT => {:type => ::Thrift::Types::STRUCT, :name => 'environmentContext', :class => ::EnvironmentContext},
     TXNID => {:type => ::Thrift::Types::I64, :name => 'txnId', :default => -1, :optional => true},
+    WRITEID => {:type => ::Thrift::Types::I64, :name => 'writeId', :default => -1, :optional => true},
     VALIDWRITEIDLIST => {:type => ::Thrift::Types::STRING, :name => 'validWriteIdList', :optional => true}
   }
 

http://git-wip-us.apache.org/repos/asf/hive/blob/222b4aca/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/AlterHandler.java
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/AlterHandler.java b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/AlterHandler.java
index 010870d..e7cf07f 100644
--- a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/AlterHandler.java
+++ b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/AlterHandler.java
@@ -197,6 +197,7 @@ public interface AlterHandler extends Configurable {
    */
   List<Partition> alterPartitions(final RawStore msdb, Warehouse wh, final String catName,
     final String dbname, final String name, final List<Partition> new_parts,
-    EnvironmentContext environmentContext, long txnId, String writeIdList, IHMSHandler handler)
+    EnvironmentContext environmentContext, long txnId, String writeIdList, long writeId,
+    IHMSHandler handler)
       throws InvalidOperationException, InvalidObjectException, AlreadyExistsException, MetaException;
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hive/blob/222b4aca/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java
index 5b70307..e532b2e 100644
--- a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java
+++ b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java
@@ -297,7 +297,7 @@ public class HiveAlterHandler implements AlterHandler {
                 partValues.add(part.getValues());
               }
               msdb.alterPartitions(
-                  catName, newDbName, newTblName, partValues, partBatch, -1, null);
+                  catName, newDbName, newTblName, partValues, partBatch, -1, null, -1);
             }
           }
 
@@ -659,7 +659,7 @@ public class HiveAlterHandler implements AlterHandler {
     EnvironmentContext environmentContext)
       throws InvalidOperationException, InvalidObjectException, AlreadyExistsException, MetaException {
     return alterPartitions(msdb, wh, DEFAULT_CATALOG_NAME, dbname, name, new_parts,
-        environmentContext, -1, null, null);
+        environmentContext, -1, null, -1, null);
   }
 
   @Override
@@ -667,7 +667,8 @@ public class HiveAlterHandler implements AlterHandler {
                                          final String dbname, final String name,
                                          final List<Partition> new_parts,
                                          EnvironmentContext environmentContext,
-                                         long txnId, String writeIdList, IHMSHandler handler)
+                                         long txnId, String writeIdList, long writeId,
+                                         IHMSHandler handler)
       throws InvalidOperationException, InvalidObjectException, AlreadyExistsException, MetaException {
     List<Partition> oldParts = new ArrayList<>();
     List<List<String>> partValsList = new ArrayList<>();
@@ -715,7 +716,7 @@ public class HiveAlterHandler implements AlterHandler {
         }
       }
 
-      msdb.alterPartitions(catName, dbname, name, partValsList, new_parts, txnId, writeIdList);
+      msdb.alterPartitions(catName, dbname, name, partValsList, new_parts, txnId, writeIdList, writeId);
       Iterator<Partition> oldPartsIt = oldParts.iterator();
       for (Partition newPart : new_parts) {
         Partition oldPart;

http://git-wip-us.apache.org/repos/asf/hive/blob/222b4aca/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
index df2bf10..2f46e48 100644
--- a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
+++ b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
@@ -4881,7 +4881,7 @@ public class HiveMetaStore extends ThriftHiveMetastore {
         final List<Partition> new_parts)
         throws TException {
       alter_partitions_with_environment_context(
-          db_name, tbl_name, new_parts, null, -1, null);
+          db_name, tbl_name, new_parts, null, -1, null, -1);
     }
 
     @Override
@@ -4891,13 +4891,14 @@ public class HiveMetaStore extends ThriftHiveMetastore {
       alter_partitions_with_environment_context(
           req.getDbName(), req.getTableName(), req.getPartitions(), req.getEnvironmentContext(),
           req.isSetTxnId() ? req.getTxnId() : -1,
-          req.isSetValidWriteIdList() ? req.getValidWriteIdList() : null);
+          req.isSetValidWriteIdList() ? req.getValidWriteIdList() : null,
+          req.isSetWriteId() ? req.getWriteId() : -1);
       return new AlterPartitionsResponse();
     }
 
     private void alter_partitions_with_environment_context(final String db_name, final String tbl_name,
         final List<Partition> new_parts, EnvironmentContext environmentContext,
-        long txnId, String writeIdList)
+        long txnId, String writeIdList, long writeId)
         throws TException {
 
       String[] parsedDbName = parseDbName(db_name, conf);
@@ -4921,7 +4922,7 @@ public class HiveMetaStore extends ThriftHiveMetastore {
           firePreEvent(new PreAlterPartitionEvent(parsedDbName[DB_NAME], tbl_name, null, tmpPart, this));
         }
         oldParts = alterHandler.alterPartitions(getMS(), wh, parsedDbName[CAT_NAME],
-            parsedDbName[DB_NAME], tbl_name, new_parts, environmentContext, txnId, writeIdList, this);
+            parsedDbName[DB_NAME], tbl_name, new_parts, environmentContext, txnId, writeIdList, writeId, this);
         Iterator<Partition> olditr = oldParts.iterator();
         // Only fetch the table if we have a listener that needs it.
         Table table = null;

http://git-wip-us.apache.org/repos/asf/hive/blob/222b4aca/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
index 1e50ba7..30355e5 100644
--- a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
+++ b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
@@ -1886,25 +1886,25 @@ public class HiveMetaStoreClient implements IMetaStoreClient, AutoCloseable {
   public void alter_partitions(String dbName, String tblName, List<Partition> newParts)
       throws TException {
     alter_partitions(
-        getDefaultCatalog(conf), dbName, tblName, newParts, new EnvironmentContext(), -1, null);
+        getDefaultCatalog(conf), dbName, tblName, newParts, new EnvironmentContext(), -1, null, -1);
   }
 
   @Override
   public void alter_partitions(String dbName, String tblName, List<Partition> newParts,
                                EnvironmentContext environmentContext) throws TException {
     alter_partitions(
-        getDefaultCatalog(conf), dbName, tblName, newParts, environmentContext, -1, null);
+        getDefaultCatalog(conf), dbName, tblName, newParts, environmentContext, -1, null, -1);
   }
 
   @Override
   public void alter_partitions(String dbName, String tblName, List<Partition> newParts,
                                EnvironmentContext environmentContext,
-                               long txnId, String writeIdList)
+                               long txnId, String writeIdList, long writeId)
       throws InvalidOperationException, MetaException, TException {
     //client.alter_partition_with_environment_context(getDefaultCatalog(conf),
       //  dbName, tblName, newParts, environmentContext);
     alter_partitions(getDefaultCatalog(conf),
-        dbName, tblName, newParts, environmentContext, txnId, writeIdList);
+        dbName, tblName, newParts, environmentContext, txnId, writeIdList, writeId);
 
   }
 
@@ -1912,7 +1912,7 @@ public class HiveMetaStoreClient implements IMetaStoreClient, AutoCloseable {
   public void alter_partitions(String catName, String dbName, String tblName,
                                List<Partition> newParts,
                                EnvironmentContext environmentContext,
-                               long txnId, String writeIdList) throws TException {
+                               long txnId, String writeIdList, long writeId) throws TException {
     AlterPartitionsRequest req = new AlterPartitionsRequest();
     req.setDbName(prependCatalogToDbName(catName, dbName, conf));
     req.setTableName(tblName);
@@ -1920,6 +1920,7 @@ public class HiveMetaStoreClient implements IMetaStoreClient, AutoCloseable {
     req.setEnvironmentContext(environmentContext);
     req.setTxnId(txnId);
     req.setValidWriteIdList(writeIdList);
+    req.setWriteId(writeId);
     client.alter_partitions_with_environment_context(req);
   }
 

http://git-wip-us.apache.org/repos/asf/hive/blob/222b4aca/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java
index 8bc3df5..1cda157 100644
--- a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java
+++ b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java
@@ -2133,7 +2133,7 @@ public interface IMetaStoreClient {
 
   void alter_partitions(String dbName, String tblName, List<Partition> newParts,
                         EnvironmentContext environmentContext,
-                        long txnId, String writeIdList)
+                        long txnId, String writeIdList, long writeId)
       throws InvalidOperationException, MetaException, TException;
 
   /**
@@ -2155,7 +2155,7 @@ public interface IMetaStoreClient {
   default void alter_partitions(String catName, String dbName, String tblName,
                                 List<Partition> newParts)
       throws InvalidOperationException, MetaException, TException {
-    alter_partitions(catName, dbName, tblName, newParts, new EnvironmentContext(), -1, null);
+    alter_partitions(catName, dbName, tblName, newParts, new EnvironmentContext(), -1, null, -1);
   }
 
   /**
@@ -2177,7 +2177,7 @@ public interface IMetaStoreClient {
    */
   void alter_partitions(String catName, String dbName, String tblName, List<Partition> newParts,
                         EnvironmentContext environmentContext,
-                        long txnId, String writeIdList)
+                        long txnId, String writeIdList, long writeId)
       throws InvalidOperationException, MetaException, TException;
 
   /**

http://git-wip-us.apache.org/repos/asf/hive/blob/222b4aca/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
index f4919e0..750040a 100644
--- a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
+++ b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
@@ -1989,6 +1989,7 @@ public class ObjectStore implements RawStore, Configurable {
     if (TxnUtils.isTransactionalTable(tbl)) {
       mtable.setTxnId(tbl.getTxnId());
       mtable.setWriteIdList(tbl.getValidWriteIdList());
+      mtable.setWriteId(tbl.getWriteId());
     }
     return mtable;
   }
@@ -2601,6 +2602,7 @@ public class ObjectStore implements RawStore, Configurable {
     if (TxnUtils.isTransactionalTable(mt.getParameters())) {
       mpart.setTxnId(part.getTxnId());
       mpart.setWriteIdList(part.getValidWriteIdList());
+      mpart.setWriteId(part.getWriteId());
     }
     return mpart;
   }
@@ -4141,12 +4143,13 @@ public class ObjectStore implements RawStore, Configurable {
           TxnUtils.isTransactionalTable(newTable)) {
         // Check concurrent INSERT case and set false to the flag.
         if (!isCurrentStatsValidForTheQuery(oldt, newt.getTxnId(), newt.getWriteIdList(),
-                -1, true)) {
+                newt.getWriteId(), true)) {
           StatsSetupConst.setBasicStatsState(oldt.getParameters(), StatsSetupConst.FALSE);
           LOG.info("Removed COLUMN_STATS_ACCURATE from the parameters of the table " +
                   dbname + "." + name + ". will be made persistent.");
         }
         oldt.setTxnId(newTable.getTxnId());
+        oldt.setWriteId(newTable.getWriteId());
         oldt.setWriteIdList(newTable.getValidWriteIdList());
       }
 
@@ -4231,13 +4234,14 @@ public class ObjectStore implements RawStore, Configurable {
         TxnUtils.isTransactionalTable(table.getParameters())) {
       // Check concurrent INSERT case and set false to the flag.
       if (!isCurrentStatsValidForTheQuery(oldp, newp.getTxnId(), newp.getWriteIdList(),
-              -1, true)) {
+              newp.getWriteId(), true)) {
         StatsSetupConst.setBasicStatsState(oldp.getParameters(), StatsSetupConst.FALSE);
         LOG.info("Removed COLUMN_STATS_ACCURATE from the parameters of the partition " +
                 dbname + "." + name + "." + oldp.getPartitionName() + " will be made persistent.");
       }
       oldp.setTxnId(newPart.getTxnId());
       oldp.setWriteIdList(newPart.getValidWriteIdList());
+      oldp.setWriteId(newPart.getWriteId());
     }
     return oldCD;
   }
@@ -4271,7 +4275,7 @@ public class ObjectStore implements RawStore, Configurable {
   @Override
   public void alterPartitions(String catName, String dbname, String name,
                               List<List<String>> part_vals, List<Partition> newParts,
-                              long txnId, String writeIdList)
+                              long txnId, String writeIdList, long writeId)
       throws InvalidObjectException, MetaException {
     boolean success = false;
     Exception e = null;
@@ -4284,6 +4288,7 @@ public class ObjectStore implements RawStore, Configurable {
         if (txnId > 0) {
           tmpPart.setTxnId(txnId);
           tmpPart.setValidWriteIdList(writeIdList);
+          tmpPart.setWriteId(writeId);
         }
         MColumnDescriptor oldCd = alterPartitionNoTxn(catName, dbname, name, tmpPartVals, tmpPart);
         if (oldCd != null) {
@@ -12245,16 +12250,18 @@ public class ObjectStore implements RawStore, Configurable {
    * ~ COLUMN_STATE_ACCURATE(CSA) state is true
    * ~ Isolation-level (snapshot) compliant with the query
    * @param tbl                    MTable of the stats entity
-   * @param txnId                  transaction id of the query
+   * @param queryTxnId             transaction id of the query
    * @param queryValidWriteIdList  valid writeId list of the query
+   * @param queryWriteId           writeId of the query
    * @Precondition   "tbl" should be retrieved from the TBLS table.
    */
   private boolean isCurrentStatsValidForTheQuery(
-      MTable tbl, long txnId, String queryValidWriteIdList,
-      long statsWriteId, boolean checkConcurrentWrites)
+      MTable tbl, long queryTxnId, String queryValidWriteIdList,
+      long queryWriteId, boolean checkConcurrentWrites)
       throws MetaException {
-    return isCurrentStatsValidForTheQuery(tbl.getTxnId(), tbl.getParameters(), tbl.getWriteIdList(),
-        txnId, queryValidWriteIdList, statsWriteId, checkConcurrentWrites);
+    return isCurrentStatsValidForTheQuery(tbl.getParameters(), tbl.getTxnId(),
+        tbl.getWriteIdList(),tbl.getWriteId(),
+        queryTxnId, queryValidWriteIdList, queryWriteId, checkConcurrentWrites);
   }
 
   /**
@@ -12272,18 +12279,34 @@ public class ObjectStore implements RawStore, Configurable {
    * @Precondition   "part" should be retrieved from the PARTITIONS table.
    */
   private boolean isCurrentStatsValidForTheQuery(
-      MPartition part, long txnId, String queryValidWriteIdList,
-      long statsWriteId, boolean checkConcurrentWrites)
+      MPartition part, long queryTxnId, String queryValidWriteIdList,
+      long queryWriteId, boolean checkConcurrentWrites)
       throws MetaException {
-    return isCurrentStatsValidForTheQuery(part.getTxnId(), part.getParameters(), part.getWriteIdList(),
-        txnId, queryValidWriteIdList, statsWriteId, checkConcurrentWrites);
+    return isCurrentStatsValidForTheQuery(part.getParameters(), part.getTxnId(),
+        part.getWriteIdList(), part.getWriteId(),
+        queryTxnId, queryValidWriteIdList, queryWriteId, checkConcurrentWrites);
   }
 
   private boolean isCurrentStatsValidForTheQuery(
-      long statsTxnId, Map<String, String> statsParams, String statsWriteIdList,
+      Map<String, String> statsParams, long statsTxnId,
+      String statsWriteIdList, long statsWriteId,
       long queryTxnId, String queryValidWriteIdList,
-      long statsWriteId, boolean checkConcurrentWrites)
+      long queryWriteId, boolean checkConcurrentWrites)
       throws MetaException {
+    // If checkConcurrentWrites is true and
+    // statsWriteId or queryWriteId is -1 or 0,
+    // return true since -1 or 0 is not a valid writeId.
+    if (checkConcurrentWrites) {
+      if (queryWriteId < 1) {
+        LOG.error("Cannot check for concurrent inserts without a valid query write ID");
+        return false;
+      }
+      if (statsWriteId < 1) {
+        return true; // TODO: this is questionable, too
+      }
+    }
+
+
     // Note: can be changed to debug/info to verify the calls.
     LOG.trace("Called with stats {}, {}; query {}, {}; checkConcurrentWrites {}",
         statsTxnId, statsWriteIdList, queryTxnId, queryValidWriteIdList, checkConcurrentWrites);
@@ -12325,6 +12348,6 @@ public class ObjectStore implements RawStore, Configurable {
     ValidWriteIdList list4TheQuery = new ValidReaderWriteIdList(queryValidWriteIdList);
 
     return !checkConcurrentWrites ? TxnIdUtils.checkEquivalentWriteIds(list4Stats, list4TheQuery) :
-            !TxnIdUtils.areTheseConcurrentWrites(list4Stats, list4TheQuery, statsWriteId);
+            !TxnIdUtils.areTheseConcurrentWrites(list4Stats, statsWriteId, list4TheQuery, queryWriteId);
   }
 }

http://git-wip-us.apache.org/repos/asf/hive/blob/222b4aca/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/RawStore.java
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/RawStore.java b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/RawStore.java
index 8cc9d2c..4800c8a 100644
--- a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/RawStore.java
+++ b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/RawStore.java
@@ -516,12 +516,13 @@ public interface RawStore extends Configurable {
    *                  partition, not just the pieces to update.
    * @param txnId transaction id of the transaction that called this method.
    * @param writeIdList valid write id list of the transaction on the current table
+   * @param writeid write id of the transaction for the table
    * @throws InvalidObjectException One of the indicated partitions does not exist.
    * @throws MetaException error accessing the RDBMS.
    */
   void alterPartitions(String catName, String db_name, String tbl_name,
       List<List<String>> part_vals_list, List<Partition> new_parts,
-      long txnId, String writeIdList)
+      long txnId, String writeIdList, long writeId)
       throws InvalidObjectException, MetaException;
 
   /**

http://git-wip-us.apache.org/repos/asf/hive/blob/222b4aca/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java
index e4894fa..42cf485 100644
--- a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java
+++ b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/cache/CachedStore.java
@@ -1172,9 +1172,9 @@ public class CachedStore implements RawStore, Configurable {
   @Override
   public void alterPartitions(String catName, String dbName, String tblName,
                               List<List<String>> partValsList, List<Partition> newParts,
-                              long txnId, String writeIdList)
+                              long txnId, String writeIdList, long writeId)
       throws InvalidObjectException, MetaException {
-    rawStore.alterPartitions(catName, dbName, tblName, partValsList, newParts, txnId, writeIdList);
+    rawStore.alterPartitions(catName, dbName, tblName, partValsList, newParts, txnId, writeIdList, writeId);
     catName = normalizeIdentifier(catName);
     dbName = normalizeIdentifier(dbName);
     tblName = normalizeIdentifier(tblName);

http://git-wip-us.apache.org/repos/asf/hive/blob/222b4aca/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/model/MPartition.java
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/model/MPartition.java b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/model/MPartition.java
index 56f9048..b5218f3 100644
--- a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/model/MPartition.java
+++ b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/model/MPartition.java
@@ -31,6 +31,7 @@ public class MPartition {
   private MStorageDescriptor sd;
   private Map<String, String> parameters;
   private long txnId;
+  private long writeId;
   private String writeIdList;
   
   public MPartition() {}
@@ -161,6 +162,14 @@ public class MPartition {
     this.txnId = txnId;
   }
 
+  public long getWriteId() {
+    return writeId;
+  }
+
+  public void setWriteId(long writeId) {
+    this.writeId = writeId;
+  }
+
   public String getWriteIdList() {
     return writeIdList;
   }

http://git-wip-us.apache.org/repos/asf/hive/blob/222b4aca/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/model/MTable.java
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/model/MTable.java b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/model/MTable.java
index 7ef1ef6..2693251 100644
--- a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/model/MTable.java
+++ b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/model/MTable.java
@@ -39,6 +39,7 @@ public class MTable {
   private boolean rewriteEnabled;
   private String tableType;
   private long txnId;
+  private long writeId;
   private String writeIdList;
 
   public MTable() {}
@@ -282,6 +283,14 @@ public class MTable {
     this.txnId = txnId;
   }
 
+  public long getWriteId() {
+    return writeId;
+  }
+
+  public void setWriteId(long writeId) {
+    this.writeId = writeId;
+  }
+
   public String getWriteIdList() {
     return writeIdList;
   }

http://git-wip-us.apache.org/repos/asf/hive/blob/222b4aca/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnDbUtil.java
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnDbUtil.java b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnDbUtil.java
index bfbd928..7f1c89b 100644
--- a/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnDbUtil.java
+++ b/standalone-metastore/src/main/java/org/apache/hadoop/hive/metastore/txn/TxnDbUtil.java
@@ -204,7 +204,7 @@ public final class TxnDbUtil {
             " \"SD_ID\" BIGINT, \"TBL_NAME\" VARCHAR(256), \"TBL_TYPE\" VARCHAR(128), " +
             " \"VIEW_EXPANDED_TEXT\" LONG VARCHAR, \"VIEW_ORIGINAL_TEXT\" LONG VARCHAR, " +
             " \"IS_REWRITE_ENABLED\" CHAR(1) NOT NULL DEFAULT \'N\', \"TXN_ID\" BIGINT DEFAULT 0, " +
-            " \"WRITEID_LIST\" CLOB, " +
+            " \"WRITE_ID\" BIGINT DEFAULT 0, \"WRITEID_LIST\" CLOB, " +
             " PRIMARY KEY (TBL_ID))"
         );
       } catch (SQLException e) {
@@ -220,7 +220,7 @@ public final class TxnDbUtil {
             " \"PART_ID\" BIGINT NOT NULL, \"CREATE_TIME\" INTEGER NOT NULL, " +
             " \"LAST_ACCESS_TIME\" INTEGER NOT NULL, \"PART_NAME\" VARCHAR(767), " +
             " \"SD_ID\" BIGINT, \"TBL_ID\" BIGINT, \"TXN_ID\" BIGINT DEFAULT 0, " +
-            " \"WRITEID_LIST\" CLOB, " +
+            " \"WRITE_ID\" BIGINT DEFAULT 0, \"WRITEID_LIST\" CLOB, " +
             " PRIMARY KEY (PART_ID))"
         );
       } catch (SQLException e) {

http://git-wip-us.apache.org/repos/asf/hive/blob/222b4aca/standalone-metastore/src/main/resources/package.jdo
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/resources/package.jdo b/standalone-metastore/src/main/resources/package.jdo
index 92b803f..4746aee 100644
--- a/standalone-metastore/src/main/resources/package.jdo
+++ b/standalone-metastore/src/main/resources/package.jdo
@@ -213,6 +213,9 @@
       <field name="txnId">
         <column name="TXN_ID"/>
       </field>
+      <field name="writeId">
+        <column name="WRITE_ID"/>
+      </field>
       <field name="writeIdList">
         <column name="WRITEID_LIST" jdbc-type="CLOB" allows-null="true"/>
       </field>
@@ -498,6 +501,9 @@
       <field name="txnId">
         <column name="TXN_ID"/>
       </field>
+      <field name="writeId">
+        <column name="WRITE_ID"/>
+      </field>
       <field name="writeIdList">
         <column name="WRITEID_LIST" jdbc-type="CLOB" allows-null="true"/>
       </field>

http://git-wip-us.apache.org/repos/asf/hive/blob/222b4aca/standalone-metastore/src/main/sql/derby/hive-schema-4.0.0.derby.sql
----------------------------------------------------------------------
diff --git a/standalone-metastore/src/main/sql/derby/hive-schema-4.0.0.derby.sql b/standalone-metastore/src/main/sql/derby/hive-schema-4.0.0.derby.sql
index 062e374..1af5dbc 100644
--- a/standalone-metastore/src/main/sql/derby/hive-schema-4.0.0.derby.sql
+++ b/standalone-metastore/src/main/sql/derby/hive-schema-4.0.0.derby.sql
@@ -47,7 +47,7 @@ CREATE TABLE "APP"."IDXS" ("INDEX_ID" BIGINT NOT NULL, "CREATE_TIME" INTEGER NOT
 
 CREATE TABLE "APP"."INDEX_PARAMS" ("INDEX_ID" BIGINT NOT NULL, "PARAM_KEY" VARCHAR(256) NOT NULL, "PARAM_VALUE" VARCHAR(4000));
 
-CREATE TABLE "APP"."PARTITIONS" ("PART_ID" BIGINT NOT NULL, "CREATE_TIME" INTEGER NOT NULL, "LAST_ACCESS_TIME" INTEGER NOT NULL, "PART_NAME" VARCHAR(767), "SD_ID" BIGINT, "TBL_ID" BIGINT, "TXN_ID" BIGINT DEFAULT 0, "WRITEID_LIST" CLOB);
+CREATE TABLE "APP"."PARTITIONS" ("PART_ID" BIGINT NOT NULL, "CREATE_TIME" INTEGER NOT NULL, "LAST_ACCESS_TIME" INTEGER NOT NULL, "PART_NAME" VARCHAR(767), "SD_ID" BIGINT, "TBL_ID" BIGINT, "TXN_ID" BIGINT DEFAULT 0, "WRITE_ID" BIGINT DEFAULT 0, "WRITEID_LIST" CLOB);
 
 CREATE TABLE "APP"."SERDES" ("SERDE_ID" BIGINT NOT NULL, "NAME" VARCHAR(128), "SLIB" VARCHAR(4000), "DESCRIPTION" VARCHAR(4000), "SERIALIZER_CLASS" VARCHAR(4000), "DESERIALIZER_CLASS" VARCHAR(4000), SERDE_TYPE INTEGER);
 
@@ -75,7 +75,7 @@ CREATE TABLE "APP"."COLUMNS" ("SD_ID" BIGINT NOT NULL, "COMMENT" VARCHAR(256), "
 
 CREATE TABLE "APP"."ROLES" ("ROLE_ID" BIGINT NOT NULL, "CREATE_TIME" INTEGER NOT NULL, "OWNER_NAME" VARCHAR(128), "ROLE_NAME" VARCHAR(128));
 
-CREATE TABLE "APP"."TBLS" ("TBL_ID" BIGINT NOT NULL, "CREATE_TIME" INTEGER NOT NULL, "DB_ID" BIGINT, "LAST_ACCESS_TIME" INTEGER NOT NULL, "OWNER" VARCHAR(767), "OWNER_TYPE" VARCHAR(10), "RETENTION" INTEGER NOT NULL, "SD_ID" BIGINT, "TBL_NAME" VARCHAR(256), "TBL_TYPE" VARCHAR(128), "VIEW_EXPANDED_TEXT" LONG VARCHAR, "VIEW_ORIGINAL_TEXT" LONG VARCHAR, "IS_REWRITE_ENABLED" CHAR(1) NOT NULL DEFAULT 'N', "TXN_ID" BIGINT DEFAULT 0, "WRITEID_LIST" CLOB);
+CREATE TABLE "APP"."TBLS" ("TBL_ID" BIGINT NOT NULL, "CREATE_TIME" INTEGER NOT NULL, "DB_ID" BIGINT, "LAST_ACCESS_TIME" INTEGER NOT NULL, "OWNER" VARCHAR(767), "OWNER_TYPE" VARCHAR(10), "RETENTION" INTEGER NOT NULL, "SD_ID" BIGINT, "TBL_NAME" VARCHAR(256), "TBL_TYPE" VARCHAR(128), "VIEW_EXPANDED_TEXT" LONG VARCHAR, "VIEW_ORIGINAL_TEXT" LONG VARCHAR, "IS_REWRITE_ENABLED" CHAR(1) NOT NULL DEFAULT 'N', "TXN_ID" BIGINT DEFAULT 0, "WRITE_ID" BIGINT DEFAULT 0, "WRITEID_LIST" CLOB);
 
 CREATE TABLE "APP"."PARTITION_KEYS" ("TBL_ID" BIGINT NOT NULL, "PKEY_COMMENT" VARCHAR(4000), "PKEY_NAME" VARCHAR(128) NOT NULL, "PKEY_TYPE" VARCHAR(767) NOT NULL, "INTEGER_IDX" INTEGER NOT NULL);