You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ek...@apache.org on 2016/05/19 19:29:22 UTC

[3/6] hive git commit: HIVE-13622 WriteSet tracking optimizations (Eugene Koifman, reviewed by Alan Gates)

http://git-wip-us.apache.org/repos/asf/hive/blob/f25b8652/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 883f266..00f017b 100644
--- a/metastore/src/gen/thrift/gen-cpp/hive_metastore_types.h
+++ b/metastore/src/gen/thrift/gen-cpp/hive_metastore_types.h
@@ -109,6 +109,19 @@ struct GrantRevokeType {
 
 extern const std::map<int, const char*> _GrantRevokeType_VALUES_TO_NAMES;
 
+struct DataOperationType {
+  enum type {
+    SELECT = 1,
+    INSERT = 2,
+    UPDATE = 3,
+    DELETE = 4,
+    UNSET = 5,
+    NO_TXN = 6
+  };
+};
+
+extern const std::map<int, const char*> _DataOperationType_VALUES_TO_NAMES;
+
 struct EventRequestType {
   enum type {
     INSERT = 1,
@@ -5137,9 +5150,11 @@ inline std::ostream& operator<<(std::ostream& out, const CommitTxnRequest& obj)
 }
 
 typedef struct _LockComponent__isset {
-  _LockComponent__isset() : tablename(false), partitionname(false) {}
+  _LockComponent__isset() : tablename(false), partitionname(false), operationType(true), isAcid(true) {}
   bool tablename :1;
   bool partitionname :1;
+  bool operationType :1;
+  bool isAcid :1;
 } _LockComponent__isset;
 
 class LockComponent {
@@ -5147,7 +5162,9 @@ class LockComponent {
 
   LockComponent(const LockComponent&);
   LockComponent& operator=(const LockComponent&);
-  LockComponent() : type((LockType::type)0), level((LockLevel::type)0), dbname(), tablename(), partitionname() {
+  LockComponent() : type((LockType::type)0), level((LockLevel::type)0), dbname(), tablename(), partitionname(), operationType((DataOperationType::type)5), isAcid(false) {
+    operationType = (DataOperationType::type)5;
+
   }
 
   virtual ~LockComponent() throw();
@@ -5156,6 +5173,8 @@ class LockComponent {
   std::string dbname;
   std::string tablename;
   std::string partitionname;
+  DataOperationType::type operationType;
+  bool isAcid;
 
   _LockComponent__isset __isset;
 
@@ -5169,6 +5188,10 @@ class LockComponent {
 
   void __set_partitionname(const std::string& val);
 
+  void __set_operationType(const DataOperationType::type val);
+
+  void __set_isAcid(const bool val);
+
   bool operator == (const LockComponent & rhs) const
   {
     if (!(type == rhs.type))
@@ -5185,6 +5208,14 @@ class LockComponent {
       return false;
     else if (__isset.partitionname && !(partitionname == rhs.partitionname))
       return false;
+    if (__isset.operationType != rhs.__isset.operationType)
+      return false;
+    else if (__isset.operationType && !(operationType == rhs.operationType))
+      return false;
+    if (__isset.isAcid != rhs.__isset.isAcid)
+      return false;
+    else if (__isset.isAcid && !(isAcid == rhs.isAcid))
+      return false;
     return true;
   }
   bool operator != (const LockComponent &rhs) const {
@@ -6105,13 +6136,19 @@ inline std::ostream& operator<<(std::ostream& out, const ShowCompactResponse& ob
   return out;
 }
 
+typedef struct _AddDynamicPartitions__isset {
+  _AddDynamicPartitions__isset() : operationType(true) {}
+  bool operationType :1;
+} _AddDynamicPartitions__isset;
 
 class AddDynamicPartitions {
  public:
 
   AddDynamicPartitions(const AddDynamicPartitions&);
   AddDynamicPartitions& operator=(const AddDynamicPartitions&);
-  AddDynamicPartitions() : txnid(0), dbname(), tablename() {
+  AddDynamicPartitions() : txnid(0), dbname(), tablename(), operationType((DataOperationType::type)5) {
+    operationType = (DataOperationType::type)5;
+
   }
 
   virtual ~AddDynamicPartitions() throw();
@@ -6119,6 +6156,9 @@ class AddDynamicPartitions {
   std::string dbname;
   std::string tablename;
   std::vector<std::string>  partitionnames;
+  DataOperationType::type operationType;
+
+  _AddDynamicPartitions__isset __isset;
 
   void __set_txnid(const int64_t val);
 
@@ -6128,6 +6168,8 @@ class AddDynamicPartitions {
 
   void __set_partitionnames(const std::vector<std::string> & val);
 
+  void __set_operationType(const DataOperationType::type val);
+
   bool operator == (const AddDynamicPartitions & rhs) const
   {
     if (!(txnid == rhs.txnid))
@@ -6138,6 +6180,10 @@ class AddDynamicPartitions {
       return false;
     if (!(partitionnames == rhs.partitionnames))
       return false;
+    if (__isset.operationType != rhs.__isset.operationType)
+      return false;
+    else if (__isset.operationType && !(operationType == rhs.operationType))
+      return false;
     return true;
   }
   bool operator != (const AddDynamicPartitions &rhs) const {

http://git-wip-us.apache.org/repos/asf/hive/blob/f25b8652/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/AddDynamicPartitions.java
----------------------------------------------------------------------
diff --git a/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/AddDynamicPartitions.java b/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/AddDynamicPartitions.java
index 544eff1..734a6df 100644
--- a/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/AddDynamicPartitions.java
+++ b/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/AddDynamicPartitions.java
@@ -42,6 +42,7 @@ public class AddDynamicPartitions implements org.apache.thrift.TBase<AddDynamicP
   private static final org.apache.thrift.protocol.TField DBNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("dbname", org.apache.thrift.protocol.TType.STRING, (short)2);
   private static final org.apache.thrift.protocol.TField TABLENAME_FIELD_DESC = new org.apache.thrift.protocol.TField("tablename", org.apache.thrift.protocol.TType.STRING, (short)3);
   private static final org.apache.thrift.protocol.TField PARTITIONNAMES_FIELD_DESC = new org.apache.thrift.protocol.TField("partitionnames", org.apache.thrift.protocol.TType.LIST, (short)4);
+  private static final org.apache.thrift.protocol.TField OPERATION_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("operationType", org.apache.thrift.protocol.TType.I32, (short)5);
 
   private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
   static {
@@ -53,13 +54,19 @@ public class AddDynamicPartitions implements org.apache.thrift.TBase<AddDynamicP
   private String dbname; // required
   private String tablename; // required
   private List<String> partitionnames; // required
+  private DataOperationType operationType; // 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 {
     TXNID((short)1, "txnid"),
     DBNAME((short)2, "dbname"),
     TABLENAME((short)3, "tablename"),
-    PARTITIONNAMES((short)4, "partitionnames");
+    PARTITIONNAMES((short)4, "partitionnames"),
+    /**
+     * 
+     * @see DataOperationType
+     */
+    OPERATION_TYPE((short)5, "operationType");
 
     private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
 
@@ -82,6 +89,8 @@ public class AddDynamicPartitions implements org.apache.thrift.TBase<AddDynamicP
           return TABLENAME;
         case 4: // PARTITIONNAMES
           return PARTITIONNAMES;
+        case 5: // OPERATION_TYPE
+          return OPERATION_TYPE;
         default:
           return null;
       }
@@ -124,6 +133,7 @@ public class AddDynamicPartitions implements org.apache.thrift.TBase<AddDynamicP
   // isset id assignments
   private static final int __TXNID_ISSET_ID = 0;
   private byte __isset_bitfield = 0;
+  private static final _Fields optionals[] = {_Fields.OPERATION_TYPE};
   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,11 +146,15 @@ public class AddDynamicPartitions implements org.apache.thrift.TBase<AddDynamicP
     tmpMap.put(_Fields.PARTITIONNAMES, new org.apache.thrift.meta_data.FieldMetaData("partitionnames", org.apache.thrift.TFieldRequirementType.REQUIRED, 
         new org.apache.thrift.meta_data.ListMetaData(org.apache.thrift.protocol.TType.LIST, 
             new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING))));
+    tmpMap.put(_Fields.OPERATION_TYPE, new org.apache.thrift.meta_data.FieldMetaData("operationType", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, DataOperationType.class)));
     metaDataMap = Collections.unmodifiableMap(tmpMap);
     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(AddDynamicPartitions.class, metaDataMap);
   }
 
   public AddDynamicPartitions() {
+    this.operationType = org.apache.hadoop.hive.metastore.api.DataOperationType.UNSET;
+
   }
 
   public AddDynamicPartitions(
@@ -173,6 +187,9 @@ public class AddDynamicPartitions implements org.apache.thrift.TBase<AddDynamicP
       List<String> __this__partitionnames = new ArrayList<String>(other.partitionnames);
       this.partitionnames = __this__partitionnames;
     }
+    if (other.isSetOperationType()) {
+      this.operationType = other.operationType;
+    }
   }
 
   public AddDynamicPartitions deepCopy() {
@@ -186,6 +203,8 @@ public class AddDynamicPartitions implements org.apache.thrift.TBase<AddDynamicP
     this.dbname = null;
     this.tablename = null;
     this.partitionnames = null;
+    this.operationType = org.apache.hadoop.hive.metastore.api.DataOperationType.UNSET;
+
   }
 
   public long getTxnid() {
@@ -294,6 +313,37 @@ public class AddDynamicPartitions implements org.apache.thrift.TBase<AddDynamicP
     }
   }
 
+  /**
+   * 
+   * @see DataOperationType
+   */
+  public DataOperationType getOperationType() {
+    return this.operationType;
+  }
+
+  /**
+   * 
+   * @see DataOperationType
+   */
+  public void setOperationType(DataOperationType operationType) {
+    this.operationType = operationType;
+  }
+
+  public void unsetOperationType() {
+    this.operationType = null;
+  }
+
+  /** Returns true if field operationType is set (has been assigned a value) and false otherwise */
+  public boolean isSetOperationType() {
+    return this.operationType != null;
+  }
+
+  public void setOperationTypeIsSet(boolean value) {
+    if (!value) {
+      this.operationType = null;
+    }
+  }
+
   public void setFieldValue(_Fields field, Object value) {
     switch (field) {
     case TXNID:
@@ -328,6 +378,14 @@ public class AddDynamicPartitions implements org.apache.thrift.TBase<AddDynamicP
       }
       break;
 
+    case OPERATION_TYPE:
+      if (value == null) {
+        unsetOperationType();
+      } else {
+        setOperationType((DataOperationType)value);
+      }
+      break;
+
     }
   }
 
@@ -345,6 +403,9 @@ public class AddDynamicPartitions implements org.apache.thrift.TBase<AddDynamicP
     case PARTITIONNAMES:
       return getPartitionnames();
 
+    case OPERATION_TYPE:
+      return getOperationType();
+
     }
     throw new IllegalStateException();
   }
@@ -364,6 +425,8 @@ public class AddDynamicPartitions implements org.apache.thrift.TBase<AddDynamicP
       return isSetTablename();
     case PARTITIONNAMES:
       return isSetPartitionnames();
+    case OPERATION_TYPE:
+      return isSetOperationType();
     }
     throw new IllegalStateException();
   }
@@ -417,6 +480,15 @@ public class AddDynamicPartitions implements org.apache.thrift.TBase<AddDynamicP
         return false;
     }
 
+    boolean this_present_operationType = true && this.isSetOperationType();
+    boolean that_present_operationType = true && that.isSetOperationType();
+    if (this_present_operationType || that_present_operationType) {
+      if (!(this_present_operationType && that_present_operationType))
+        return false;
+      if (!this.operationType.equals(that.operationType))
+        return false;
+    }
+
     return true;
   }
 
@@ -444,6 +516,11 @@ public class AddDynamicPartitions implements org.apache.thrift.TBase<AddDynamicP
     if (present_partitionnames)
       list.add(partitionnames);
 
+    boolean present_operationType = true && (isSetOperationType());
+    list.add(present_operationType);
+    if (present_operationType)
+      list.add(operationType.getValue());
+
     return list.hashCode();
   }
 
@@ -495,6 +572,16 @@ public class AddDynamicPartitions implements org.apache.thrift.TBase<AddDynamicP
         return lastComparison;
       }
     }
+    lastComparison = Boolean.valueOf(isSetOperationType()).compareTo(other.isSetOperationType());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetOperationType()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.operationType, other.operationType);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
     return 0;
   }
 
@@ -542,6 +629,16 @@ public class AddDynamicPartitions implements org.apache.thrift.TBase<AddDynamicP
       sb.append(this.partitionnames);
     }
     first = false;
+    if (isSetOperationType()) {
+      if (!first) sb.append(", ");
+      sb.append("operationType:");
+      if (this.operationType == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.operationType);
+      }
+      first = false;
+    }
     sb.append(")");
     return sb.toString();
   }
@@ -645,6 +742,14 @@ public class AddDynamicPartitions implements org.apache.thrift.TBase<AddDynamicP
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
+          case 5: // OPERATION_TYPE
+            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+              struct.operationType = org.apache.hadoop.hive.metastore.api.DataOperationType.findByValue(iprot.readI32());
+              struct.setOperationTypeIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
           default:
             org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
         }
@@ -683,6 +788,13 @@ public class AddDynamicPartitions implements org.apache.thrift.TBase<AddDynamicP
         }
         oprot.writeFieldEnd();
       }
+      if (struct.operationType != null) {
+        if (struct.isSetOperationType()) {
+          oprot.writeFieldBegin(OPERATION_TYPE_FIELD_DESC);
+          oprot.writeI32(struct.operationType.getValue());
+          oprot.writeFieldEnd();
+        }
+      }
       oprot.writeFieldStop();
       oprot.writeStructEnd();
     }
@@ -710,6 +822,14 @@ public class AddDynamicPartitions implements org.apache.thrift.TBase<AddDynamicP
           oprot.writeString(_iter536);
         }
       }
+      BitSet optionals = new BitSet();
+      if (struct.isSetOperationType()) {
+        optionals.set(0);
+      }
+      oprot.writeBitSet(optionals, 1);
+      if (struct.isSetOperationType()) {
+        oprot.writeI32(struct.operationType.getValue());
+      }
     }
 
     @Override
@@ -732,6 +852,11 @@ public class AddDynamicPartitions implements org.apache.thrift.TBase<AddDynamicP
         }
       }
       struct.setPartitionnamesIsSet(true);
+      BitSet incoming = iprot.readBitSet(1);
+      if (incoming.get(0)) {
+        struct.operationType = org.apache.hadoop.hive.metastore.api.DataOperationType.findByValue(iprot.readI32());
+        struct.setOperationTypeIsSet(true);
+      }
     }
   }
 

http://git-wip-us.apache.org/repos/asf/hive/blob/f25b8652/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/DataOperationType.java
----------------------------------------------------------------------
diff --git a/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/DataOperationType.java b/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/DataOperationType.java
new file mode 100644
index 0000000..15a6e9a
--- /dev/null
+++ b/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/DataOperationType.java
@@ -0,0 +1,57 @@
+/**
+ * Autogenerated by Thrift Compiler (0.9.3)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+package org.apache.hadoop.hive.metastore.api;
+
+
+import java.util.Map;
+import java.util.HashMap;
+import org.apache.thrift.TEnum;
+
+public enum DataOperationType implements org.apache.thrift.TEnum {
+  SELECT(1),
+  INSERT(2),
+  UPDATE(3),
+  DELETE(4),
+  UNSET(5),
+  NO_TXN(6);
+
+  private final int value;
+
+  private DataOperationType(int value) {
+    this.value = value;
+  }
+
+  /**
+   * Get the integer value of this enum value, as defined in the Thrift IDL.
+   */
+  public int getValue() {
+    return value;
+  }
+
+  /**
+   * Find a the enum type by its integer value, as defined in the Thrift IDL.
+   * @return null if the value is not found.
+   */
+  public static DataOperationType findByValue(int value) { 
+    switch (value) {
+      case 1:
+        return SELECT;
+      case 2:
+        return INSERT;
+      case 3:
+        return UPDATE;
+      case 4:
+        return DELETE;
+      case 5:
+        return UNSET;
+      case 6:
+        return NO_TXN;
+      default:
+        return null;
+    }
+  }
+}

http://git-wip-us.apache.org/repos/asf/hive/blob/f25b8652/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/LockComponent.java
----------------------------------------------------------------------
diff --git a/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/LockComponent.java b/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/LockComponent.java
index adb0c44..26d1b76 100644
--- a/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/LockComponent.java
+++ b/metastore/src/gen/thrift/gen-javabean/org/apache/hadoop/hive/metastore/api/LockComponent.java
@@ -43,6 +43,8 @@ public class LockComponent implements org.apache.thrift.TBase<LockComponent, Loc
   private static final org.apache.thrift.protocol.TField DBNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("dbname", org.apache.thrift.protocol.TType.STRING, (short)3);
   private static final org.apache.thrift.protocol.TField TABLENAME_FIELD_DESC = new org.apache.thrift.protocol.TField("tablename", org.apache.thrift.protocol.TType.STRING, (short)4);
   private static final org.apache.thrift.protocol.TField PARTITIONNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("partitionname", org.apache.thrift.protocol.TType.STRING, (short)5);
+  private static final org.apache.thrift.protocol.TField OPERATION_TYPE_FIELD_DESC = new org.apache.thrift.protocol.TField("operationType", org.apache.thrift.protocol.TType.I32, (short)6);
+  private static final org.apache.thrift.protocol.TField IS_ACID_FIELD_DESC = new org.apache.thrift.protocol.TField("isAcid", org.apache.thrift.protocol.TType.BOOL, (short)7);
 
   private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
   static {
@@ -55,6 +57,8 @@ public class LockComponent implements org.apache.thrift.TBase<LockComponent, Loc
   private String dbname; // required
   private String tablename; // optional
   private String partitionname; // optional
+  private DataOperationType operationType; // optional
+  private boolean isAcid; // 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 {
@@ -70,7 +74,13 @@ public class LockComponent implements org.apache.thrift.TBase<LockComponent, Loc
     LEVEL((short)2, "level"),
     DBNAME((short)3, "dbname"),
     TABLENAME((short)4, "tablename"),
-    PARTITIONNAME((short)5, "partitionname");
+    PARTITIONNAME((short)5, "partitionname"),
+    /**
+     * 
+     * @see DataOperationType
+     */
+    OPERATION_TYPE((short)6, "operationType"),
+    IS_ACID((short)7, "isAcid");
 
     private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
 
@@ -95,6 +105,10 @@ public class LockComponent implements org.apache.thrift.TBase<LockComponent, Loc
           return TABLENAME;
         case 5: // PARTITIONNAME
           return PARTITIONNAME;
+        case 6: // OPERATION_TYPE
+          return OPERATION_TYPE;
+        case 7: // IS_ACID
+          return IS_ACID;
         default:
           return null;
       }
@@ -135,7 +149,9 @@ public class LockComponent implements org.apache.thrift.TBase<LockComponent, Loc
   }
 
   // isset id assignments
-  private static final _Fields optionals[] = {_Fields.TABLENAME,_Fields.PARTITIONNAME};
+  private static final int __ISACID_ISSET_ID = 0;
+  private byte __isset_bitfield = 0;
+  private static final _Fields optionals[] = {_Fields.TABLENAME,_Fields.PARTITIONNAME,_Fields.OPERATION_TYPE,_Fields.IS_ACID};
   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);
@@ -149,11 +165,19 @@ public class LockComponent implements org.apache.thrift.TBase<LockComponent, Loc
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
     tmpMap.put(_Fields.PARTITIONNAME, new org.apache.thrift.meta_data.FieldMetaData("partitionname", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
         new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.OPERATION_TYPE, new org.apache.thrift.meta_data.FieldMetaData("operationType", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, DataOperationType.class)));
+    tmpMap.put(_Fields.IS_ACID, new org.apache.thrift.meta_data.FieldMetaData("isAcid", org.apache.thrift.TFieldRequirementType.OPTIONAL, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.BOOL)));
     metaDataMap = Collections.unmodifiableMap(tmpMap);
     org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(LockComponent.class, metaDataMap);
   }
 
   public LockComponent() {
+    this.operationType = org.apache.hadoop.hive.metastore.api.DataOperationType.UNSET;
+
+    this.isAcid = false;
+
   }
 
   public LockComponent(
@@ -171,6 +195,7 @@ public class LockComponent implements org.apache.thrift.TBase<LockComponent, Loc
    * Performs a deep copy on <i>other</i>.
    */
   public LockComponent(LockComponent other) {
+    __isset_bitfield = other.__isset_bitfield;
     if (other.isSetType()) {
       this.type = other.type;
     }
@@ -186,6 +211,10 @@ public class LockComponent implements org.apache.thrift.TBase<LockComponent, Loc
     if (other.isSetPartitionname()) {
       this.partitionname = other.partitionname;
     }
+    if (other.isSetOperationType()) {
+      this.operationType = other.operationType;
+    }
+    this.isAcid = other.isAcid;
   }
 
   public LockComponent deepCopy() {
@@ -199,6 +228,10 @@ public class LockComponent implements org.apache.thrift.TBase<LockComponent, Loc
     this.dbname = null;
     this.tablename = null;
     this.partitionname = null;
+    this.operationType = org.apache.hadoop.hive.metastore.api.DataOperationType.UNSET;
+
+    this.isAcid = false;
+
   }
 
   /**
@@ -332,6 +365,59 @@ public class LockComponent implements org.apache.thrift.TBase<LockComponent, Loc
     }
   }
 
+  /**
+   * 
+   * @see DataOperationType
+   */
+  public DataOperationType getOperationType() {
+    return this.operationType;
+  }
+
+  /**
+   * 
+   * @see DataOperationType
+   */
+  public void setOperationType(DataOperationType operationType) {
+    this.operationType = operationType;
+  }
+
+  public void unsetOperationType() {
+    this.operationType = null;
+  }
+
+  /** Returns true if field operationType is set (has been assigned a value) and false otherwise */
+  public boolean isSetOperationType() {
+    return this.operationType != null;
+  }
+
+  public void setOperationTypeIsSet(boolean value) {
+    if (!value) {
+      this.operationType = null;
+    }
+  }
+
+  public boolean isIsAcid() {
+    return this.isAcid;
+  }
+
+  public void setIsAcid(boolean isAcid) {
+    this.isAcid = isAcid;
+    setIsAcidIsSet(true);
+  }
+
+  public void unsetIsAcid() {
+    __isset_bitfield = EncodingUtils.clearBit(__isset_bitfield, __ISACID_ISSET_ID);
+  }
+
+  /** Returns true if field isAcid is set (has been assigned a value) and false otherwise */
+  public boolean isSetIsAcid() {
+    return EncodingUtils.testBit(__isset_bitfield, __ISACID_ISSET_ID);
+  }
+
+  public void setIsAcidIsSet(boolean value) {
+    __isset_bitfield = EncodingUtils.setBit(__isset_bitfield, __ISACID_ISSET_ID, value);
+  }
+
   public void setFieldValue(_Fields field, Object value) {
     switch (field) {
     case TYPE:
@@ -374,6 +460,22 @@ public class LockComponent implements org.apache.thrift.TBase<LockComponent, Loc
       }
       break;
 
+    case OPERATION_TYPE:
+      if (value == null) {
+        unsetOperationType();
+      } else {
+        setOperationType((DataOperationType)value);
+      }
+      break;
+
+    case IS_ACID:
+      if (value == null) {
+        unsetIsAcid();
+      } else {
+        setIsAcid((Boolean)value);
+      }
+      break;
+
     }
   }
 
@@ -394,6 +496,12 @@ public class LockComponent implements org.apache.thrift.TBase<LockComponent, Loc
     case PARTITIONNAME:
       return getPartitionname();
 
+    case OPERATION_TYPE:
+      return getOperationType();
+
+    case IS_ACID:
+      return isIsAcid();
+
     }
     throw new IllegalStateException();
   }
@@ -415,6 +523,10 @@ public class LockComponent implements org.apache.thrift.TBase<LockComponent, Loc
       return isSetTablename();
     case PARTITIONNAME:
       return isSetPartitionname();
+    case OPERATION_TYPE:
+      return isSetOperationType();
+    case IS_ACID:
+      return isSetIsAcid();
     }
     throw new IllegalStateException();
   }
@@ -477,6 +589,24 @@ public class LockComponent implements org.apache.thrift.TBase<LockComponent, Loc
         return false;
     }
 
+    boolean this_present_operationType = true && this.isSetOperationType();
+    boolean that_present_operationType = true && that.isSetOperationType();
+    if (this_present_operationType || that_present_operationType) {
+      if (!(this_present_operationType && that_present_operationType))
+        return false;
+      if (!this.operationType.equals(that.operationType))
+        return false;
+    }
+
+    boolean this_present_isAcid = true && this.isSetIsAcid();
+    boolean that_present_isAcid = true && that.isSetIsAcid();
+    if (this_present_isAcid || that_present_isAcid) {
+      if (!(this_present_isAcid && that_present_isAcid))
+        return false;
+      if (this.isAcid != that.isAcid)
+        return false;
+    }
+
     return true;
   }
 
@@ -509,6 +639,16 @@ public class LockComponent implements org.apache.thrift.TBase<LockComponent, Loc
     if (present_partitionname)
       list.add(partitionname);
 
+    boolean present_operationType = true && (isSetOperationType());
+    list.add(present_operationType);
+    if (present_operationType)
+      list.add(operationType.getValue());
+
+    boolean present_isAcid = true && (isSetIsAcid());
+    list.add(present_isAcid);
+    if (present_isAcid)
+      list.add(isAcid);
+
     return list.hashCode();
   }
 
@@ -570,6 +710,26 @@ public class LockComponent implements org.apache.thrift.TBase<LockComponent, Loc
         return lastComparison;
       }
     }
+    lastComparison = Boolean.valueOf(isSetOperationType()).compareTo(other.isSetOperationType());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetOperationType()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.operationType, other.operationType);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetIsAcid()).compareTo(other.isSetIsAcid());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetIsAcid()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.isAcid, other.isAcid);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
     return 0;
   }
 
@@ -633,6 +793,22 @@ public class LockComponent implements org.apache.thrift.TBase<LockComponent, Loc
       }
       first = false;
     }
+    if (isSetOperationType()) {
+      if (!first) sb.append(", ");
+      sb.append("operationType:");
+      if (this.operationType == null) {
+        sb.append("null");
+      } else {
+        sb.append(this.operationType);
+      }
+      first = false;
+    }
+    if (isSetIsAcid()) {
+      if (!first) sb.append(", ");
+      sb.append("isAcid:");
+      sb.append(this.isAcid);
+      first = false;
+    }
     sb.append(")");
     return sb.toString();
   }
@@ -664,6 +840,8 @@ public class LockComponent implements org.apache.thrift.TBase<LockComponent, Loc
 
   private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
     try {
+      // it doesn't seem like you should have to do this, but java serialization is wacky, and doesn't call the default constructor.
+      __isset_bitfield = 0;
       read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
     } catch (org.apache.thrift.TException te) {
       throw new java.io.IOException(te);
@@ -728,6 +906,22 @@ public class LockComponent implements org.apache.thrift.TBase<LockComponent, Loc
               org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
             }
             break;
+          case 6: // OPERATION_TYPE
+            if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
+              struct.operationType = org.apache.hadoop.hive.metastore.api.DataOperationType.findByValue(iprot.readI32());
+              struct.setOperationTypeIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 7: // IS_ACID
+            if (schemeField.type == org.apache.thrift.protocol.TType.BOOL) {
+              struct.isAcid = iprot.readBool();
+              struct.setIsAcidIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
           default:
             org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
         }
@@ -770,6 +964,18 @@ public class LockComponent implements org.apache.thrift.TBase<LockComponent, Loc
           oprot.writeFieldEnd();
         }
       }
+      if (struct.operationType != null) {
+        if (struct.isSetOperationType()) {
+          oprot.writeFieldBegin(OPERATION_TYPE_FIELD_DESC);
+          oprot.writeI32(struct.operationType.getValue());
+          oprot.writeFieldEnd();
+        }
+      }
+      if (struct.isSetIsAcid()) {
+        oprot.writeFieldBegin(IS_ACID_FIELD_DESC);
+        oprot.writeBool(struct.isAcid);
+        oprot.writeFieldEnd();
+      }
       oprot.writeFieldStop();
       oprot.writeStructEnd();
     }
@@ -797,13 +1003,25 @@ public class LockComponent implements org.apache.thrift.TBase<LockComponent, Loc
       if (struct.isSetPartitionname()) {
         optionals.set(1);
       }
-      oprot.writeBitSet(optionals, 2);
+      if (struct.isSetOperationType()) {
+        optionals.set(2);
+      }
+      if (struct.isSetIsAcid()) {
+        optionals.set(3);
+      }
+      oprot.writeBitSet(optionals, 4);
       if (struct.isSetTablename()) {
         oprot.writeString(struct.tablename);
       }
       if (struct.isSetPartitionname()) {
         oprot.writeString(struct.partitionname);
       }
+      if (struct.isSetOperationType()) {
+        oprot.writeI32(struct.operationType.getValue());
+      }
+      if (struct.isSetIsAcid()) {
+        oprot.writeBool(struct.isAcid);
+      }
     }
 
     @Override
@@ -815,7 +1033,7 @@ public class LockComponent implements org.apache.thrift.TBase<LockComponent, Loc
       struct.setLevelIsSet(true);
       struct.dbname = iprot.readString();
       struct.setDbnameIsSet(true);
-      BitSet incoming = iprot.readBitSet(2);
+      BitSet incoming = iprot.readBitSet(4);
       if (incoming.get(0)) {
         struct.tablename = iprot.readString();
         struct.setTablenameIsSet(true);
@@ -824,6 +1042,14 @@ public class LockComponent implements org.apache.thrift.TBase<LockComponent, Loc
         struct.partitionname = iprot.readString();
         struct.setPartitionnameIsSet(true);
       }
+      if (incoming.get(2)) {
+        struct.operationType = org.apache.hadoop.hive.metastore.api.DataOperationType.findByValue(iprot.readI32());
+        struct.setOperationTypeIsSet(true);
+      }
+      if (incoming.get(3)) {
+        struct.isAcid = iprot.readBool();
+        struct.setIsAcidIsSet(true);
+      }
     }
   }
 

http://git-wip-us.apache.org/repos/asf/hive/blob/f25b8652/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 189894d..5aef35c 100644
--- a/metastore/src/gen/thrift/gen-php/metastore/Types.php
+++ b/metastore/src/gen/thrift/gen-php/metastore/Types.php
@@ -114,6 +114,23 @@ final class GrantRevokeType {
   );
 }
 
+final class DataOperationType {
+  const SELECT = 1;
+  const INSERT = 2;
+  const UPDATE = 3;
+  const DELETE = 4;
+  const UNSET = 5;
+  const NO_TXN = 6;
+  static public $__names = array(
+    1 => 'SELECT',
+    2 => 'INSERT',
+    3 => 'UPDATE',
+    4 => 'DELETE',
+    5 => 'UNSET',
+    6 => 'NO_TXN',
+  );
+}
+
 final class EventRequestType {
   const INSERT = 1;
   const UPDATE = 2;
@@ -12625,6 +12642,14 @@ class LockComponent {
    * @var string
    */
   public $partitionname = null;
+  /**
+   * @var int
+   */
+  public $operationType =   5;
+  /**
+   * @var bool
+   */
+  public $isAcid = false;
 
   public function __construct($vals=null) {
     if (!isset(self::$_TSPEC)) {
@@ -12649,6 +12674,14 @@ class LockComponent {
           'var' => 'partitionname',
           'type' => TType::STRING,
           ),
+        6 => array(
+          'var' => 'operationType',
+          'type' => TType::I32,
+          ),
+        7 => array(
+          'var' => 'isAcid',
+          'type' => TType::BOOL,
+          ),
         );
     }
     if (is_array($vals)) {
@@ -12667,6 +12700,12 @@ class LockComponent {
       if (isset($vals['partitionname'])) {
         $this->partitionname = $vals['partitionname'];
       }
+      if (isset($vals['operationType'])) {
+        $this->operationType = $vals['operationType'];
+      }
+      if (isset($vals['isAcid'])) {
+        $this->isAcid = $vals['isAcid'];
+      }
     }
   }
 
@@ -12724,6 +12763,20 @@ class LockComponent {
             $xfer += $input->skip($ftype);
           }
           break;
+        case 6:
+          if ($ftype == TType::I32) {
+            $xfer += $input->readI32($this->operationType);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
+        case 7:
+          if ($ftype == TType::BOOL) {
+            $xfer += $input->readBool($this->isAcid);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
         default:
           $xfer += $input->skip($ftype);
           break;
@@ -12762,6 +12815,16 @@ class LockComponent {
       $xfer += $output->writeString($this->partitionname);
       $xfer += $output->writeFieldEnd();
     }
+    if ($this->operationType !== null) {
+      $xfer += $output->writeFieldBegin('operationType', TType::I32, 6);
+      $xfer += $output->writeI32($this->operationType);
+      $xfer += $output->writeFieldEnd();
+    }
+    if ($this->isAcid !== null) {
+      $xfer += $output->writeFieldBegin('isAcid', TType::BOOL, 7);
+      $xfer += $output->writeBool($this->isAcid);
+      $xfer += $output->writeFieldEnd();
+    }
     $xfer += $output->writeFieldStop();
     $xfer += $output->writeStructEnd();
     return $xfer;
@@ -14954,6 +15017,10 @@ class AddDynamicPartitions {
    * @var string[]
    */
   public $partitionnames = null;
+  /**
+   * @var int
+   */
+  public $operationType =   5;
 
   public function __construct($vals=null) {
     if (!isset(self::$_TSPEC)) {
@@ -14978,6 +15045,10 @@ class AddDynamicPartitions {
             'type' => TType::STRING,
             ),
           ),
+        5 => array(
+          'var' => 'operationType',
+          'type' => TType::I32,
+          ),
         );
     }
     if (is_array($vals)) {
@@ -14993,6 +15064,9 @@ class AddDynamicPartitions {
       if (isset($vals['partitionnames'])) {
         $this->partitionnames = $vals['partitionnames'];
       }
+      if (isset($vals['operationType'])) {
+        $this->operationType = $vals['operationType'];
+      }
     }
   }
 
@@ -15053,6 +15127,13 @@ class AddDynamicPartitions {
             $xfer += $input->skip($ftype);
           }
           break;
+        case 5:
+          if ($ftype == TType::I32) {
+            $xfer += $input->readI32($this->operationType);
+          } else {
+            $xfer += $input->skip($ftype);
+          }
+          break;
         default:
           $xfer += $input->skip($ftype);
           break;
@@ -15098,6 +15179,11 @@ class AddDynamicPartitions {
       }
       $xfer += $output->writeFieldEnd();
     }
+    if ($this->operationType !== null) {
+      $xfer += $output->writeFieldBegin('operationType', TType::I32, 5);
+      $xfer += $output->writeI32($this->operationType);
+      $xfer += $output->writeFieldEnd();
+    }
     $xfer += $output->writeFieldStop();
     $xfer += $output->writeStructEnd();
     return $xfer;

http://git-wip-us.apache.org/repos/asf/hive/blob/f25b8652/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 6366a81..4db9680 100644
--- a/metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py
+++ b/metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py
@@ -168,6 +168,32 @@ class GrantRevokeType:
     "REVOKE": 2,
   }
 
+class DataOperationType:
+  SELECT = 1
+  INSERT = 2
+  UPDATE = 3
+  DELETE = 4
+  UNSET = 5
+  NO_TXN = 6
+
+  _VALUES_TO_NAMES = {
+    1: "SELECT",
+    2: "INSERT",
+    3: "UPDATE",
+    4: "DELETE",
+    5: "UNSET",
+    6: "NO_TXN",
+  }
+
+  _NAMES_TO_VALUES = {
+    "SELECT": 1,
+    "INSERT": 2,
+    "UPDATE": 3,
+    "DELETE": 4,
+    "UNSET": 5,
+    "NO_TXN": 6,
+  }
+
 class EventRequestType:
   INSERT = 1
   UPDATE = 2
@@ -8725,6 +8751,8 @@ class LockComponent:
    - dbname
    - tablename
    - partitionname
+   - operationType
+   - isAcid
   """
 
   thrift_spec = (
@@ -8734,14 +8762,18 @@ class LockComponent:
     (3, TType.STRING, 'dbname', None, None, ), # 3
     (4, TType.STRING, 'tablename', None, None, ), # 4
     (5, TType.STRING, 'partitionname', None, None, ), # 5
+    (6, TType.I32, 'operationType', None,     5, ), # 6
+    (7, TType.BOOL, 'isAcid', None, False, ), # 7
   )
 
-  def __init__(self, type=None, level=None, dbname=None, tablename=None, partitionname=None,):
+  def __init__(self, type=None, level=None, dbname=None, tablename=None, partitionname=None, operationType=thrift_spec[6][4], isAcid=thrift_spec[7][4],):
     self.type = type
     self.level = level
     self.dbname = dbname
     self.tablename = tablename
     self.partitionname = partitionname
+    self.operationType = operationType
+    self.isAcid = isAcid
 
   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:
@@ -8777,6 +8809,16 @@ class LockComponent:
           self.partitionname = iprot.readString()
         else:
           iprot.skip(ftype)
+      elif fid == 6:
+        if ftype == TType.I32:
+          self.operationType = iprot.readI32()
+        else:
+          iprot.skip(ftype)
+      elif fid == 7:
+        if ftype == TType.BOOL:
+          self.isAcid = iprot.readBool()
+        else:
+          iprot.skip(ftype)
       else:
         iprot.skip(ftype)
       iprot.readFieldEnd()
@@ -8807,6 +8849,14 @@ class LockComponent:
       oprot.writeFieldBegin('partitionname', TType.STRING, 5)
       oprot.writeString(self.partitionname)
       oprot.writeFieldEnd()
+    if self.operationType is not None:
+      oprot.writeFieldBegin('operationType', TType.I32, 6)
+      oprot.writeI32(self.operationType)
+      oprot.writeFieldEnd()
+    if self.isAcid is not None:
+      oprot.writeFieldBegin('isAcid', TType.BOOL, 7)
+      oprot.writeBool(self.isAcid)
+      oprot.writeFieldEnd()
     oprot.writeFieldStop()
     oprot.writeStructEnd()
 
@@ -8827,6 +8877,8 @@ class LockComponent:
     value = (value * 31) ^ hash(self.dbname)
     value = (value * 31) ^ hash(self.tablename)
     value = (value * 31) ^ hash(self.partitionname)
+    value = (value * 31) ^ hash(self.operationType)
+    value = (value * 31) ^ hash(self.isAcid)
     return value
 
   def __repr__(self):
@@ -10392,6 +10444,7 @@ class AddDynamicPartitions:
    - dbname
    - tablename
    - partitionnames
+   - operationType
   """
 
   thrift_spec = (
@@ -10400,13 +10453,15 @@ class AddDynamicPartitions:
     (2, TType.STRING, 'dbname', None, None, ), # 2
     (3, TType.STRING, 'tablename', None, None, ), # 3
     (4, TType.LIST, 'partitionnames', (TType.STRING,None), None, ), # 4
+    (5, TType.I32, 'operationType', None,     5, ), # 5
   )
 
-  def __init__(self, txnid=None, dbname=None, tablename=None, partitionnames=None,):
+  def __init__(self, txnid=None, dbname=None, tablename=None, partitionnames=None, operationType=thrift_spec[5][4],):
     self.txnid = txnid
     self.dbname = dbname
     self.tablename = tablename
     self.partitionnames = partitionnames
+    self.operationType = operationType
 
   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:
@@ -10442,6 +10497,11 @@ class AddDynamicPartitions:
           iprot.readListEnd()
         else:
           iprot.skip(ftype)
+      elif fid == 5:
+        if ftype == TType.I32:
+          self.operationType = iprot.readI32()
+        else:
+          iprot.skip(ftype)
       else:
         iprot.skip(ftype)
       iprot.readFieldEnd()
@@ -10471,6 +10531,10 @@ class AddDynamicPartitions:
         oprot.writeString(iter475)
       oprot.writeListEnd()
       oprot.writeFieldEnd()
+    if self.operationType is not None:
+      oprot.writeFieldBegin('operationType', TType.I32, 5)
+      oprot.writeI32(self.operationType)
+      oprot.writeFieldEnd()
     oprot.writeFieldStop()
     oprot.writeStructEnd()
 
@@ -10492,6 +10556,7 @@ class AddDynamicPartitions:
     value = (value * 31) ^ hash(self.dbname)
     value = (value * 31) ^ hash(self.tablename)
     value = (value * 31) ^ hash(self.partitionnames)
+    value = (value * 31) ^ hash(self.operationType)
     return value
 
   def __repr__(self):

http://git-wip-us.apache.org/repos/asf/hive/blob/f25b8652/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 e8d60d7..c7e7cb4 100644
--- a/metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb
+++ b/metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb
@@ -79,6 +79,17 @@ module GrantRevokeType
   VALID_VALUES = Set.new([GRANT, REVOKE]).freeze
 end
 
+module DataOperationType
+  SELECT = 1
+  INSERT = 2
+  UPDATE = 3
+  DELETE = 4
+  UNSET = 5
+  NO_TXN = 6
+  VALUE_MAP = {1 => "SELECT", 2 => "INSERT", 3 => "UPDATE", 4 => "DELETE", 5 => "UNSET", 6 => "NO_TXN"}
+  VALID_VALUES = Set.new([SELECT, INSERT, UPDATE, DELETE, UNSET, NO_TXN]).freeze
+end
+
 module EventRequestType
   INSERT = 1
   UPDATE = 2
@@ -1948,13 +1959,17 @@ class LockComponent
   DBNAME = 3
   TABLENAME = 4
   PARTITIONNAME = 5
+  OPERATIONTYPE = 6
+  ISACID = 7
 
   FIELDS = {
     TYPE => {:type => ::Thrift::Types::I32, :name => 'type', :enum_class => ::LockType},
     LEVEL => {:type => ::Thrift::Types::I32, :name => 'level', :enum_class => ::LockLevel},
     DBNAME => {:type => ::Thrift::Types::STRING, :name => 'dbname'},
     TABLENAME => {:type => ::Thrift::Types::STRING, :name => 'tablename', :optional => true},
-    PARTITIONNAME => {:type => ::Thrift::Types::STRING, :name => 'partitionname', :optional => true}
+    PARTITIONNAME => {:type => ::Thrift::Types::STRING, :name => 'partitionname', :optional => true},
+    OPERATIONTYPE => {:type => ::Thrift::Types::I32, :name => 'operationType', :default =>     5, :optional => true, :enum_class => ::DataOperationType},
+    ISACID => {:type => ::Thrift::Types::BOOL, :name => 'isAcid', :default => false, :optional => true}
   }
 
   def struct_fields; FIELDS; end
@@ -1969,6 +1984,9 @@ class LockComponent
     unless @level.nil? || ::LockLevel::VALID_VALUES.include?(@level)
       raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field level!')
     end
+    unless @operationType.nil? || ::DataOperationType::VALID_VALUES.include?(@operationType)
+      raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field operationType!')
+    end
   end
 
   ::Thrift::Struct.generate_accessors self
@@ -2330,12 +2348,14 @@ class AddDynamicPartitions
   DBNAME = 2
   TABLENAME = 3
   PARTITIONNAMES = 4
+  OPERATIONTYPE = 5
 
   FIELDS = {
     TXNID => {:type => ::Thrift::Types::I64, :name => 'txnid'},
     DBNAME => {:type => ::Thrift::Types::STRING, :name => 'dbname'},
     TABLENAME => {:type => ::Thrift::Types::STRING, :name => 'tablename'},
-    PARTITIONNAMES => {:type => ::Thrift::Types::LIST, :name => 'partitionnames', :element => {:type => ::Thrift::Types::STRING}}
+    PARTITIONNAMES => {:type => ::Thrift::Types::LIST, :name => 'partitionnames', :element => {:type => ::Thrift::Types::STRING}},
+    OPERATIONTYPE => {:type => ::Thrift::Types::I32, :name => 'operationType', :default =>     5, :optional => true, :enum_class => ::DataOperationType}
   }
 
   def struct_fields; FIELDS; end
@@ -2345,6 +2365,9 @@ class AddDynamicPartitions
     raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field dbname is unset!') unless @dbname
     raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field tablename is unset!') unless @tablename
     raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field partitionnames is unset!') unless @partitionnames
+    unless @operationType.nil? || ::DataOperationType::VALID_VALUES.include?(@operationType)
+      raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field operationType!')
+    end
   end
 
   ::Thrift::Struct.generate_accessors self

http://git-wip-us.apache.org/repos/asf/hive/blob/f25b8652/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
index 2e83ee0..7d5ddee 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
@@ -46,6 +46,7 @@ import org.apache.hadoop.hive.metastore.api.CompactionRequest;
 import org.apache.hadoop.hive.metastore.api.CompactionType;
 import org.apache.hadoop.hive.metastore.api.ConfigValSecurityException;
 import org.apache.hadoop.hive.metastore.api.CurrentNotificationEventId;
+import org.apache.hadoop.hive.metastore.api.DataOperationType;
 import org.apache.hadoop.hive.metastore.api.Database;
 import org.apache.hadoop.hive.metastore.api.DropConstraintRequest;
 import org.apache.hadoop.hive.metastore.api.DropPartitionsExpr;
@@ -2161,10 +2162,18 @@ public class HiveMetaStoreClient implements IMetaStoreClient {
     return client.show_compact(new ShowCompactRequest());
   }
 
+  @Deprecated
   @Override
   public void addDynamicPartitions(long txnId, String dbName, String tableName,
                                    List<String> partNames) throws TException {
     client.add_dynamic_partitions(new AddDynamicPartitions(txnId, dbName, tableName, partNames));
+  }  
+  @Override
+  public void addDynamicPartitions(long txnId, String dbName, String tableName,
+                                   List<String> partNames, DataOperationType operationType) throws TException {
+    AddDynamicPartitions adp = new AddDynamicPartitions(txnId, dbName, tableName, partNames);
+    adp.setOperationType(operationType);
+    client.add_dynamic_partitions(adp);
   }
 
   @InterfaceAudience.LimitedPrivate({"HCatalog"})

http://git-wip-us.apache.org/repos/asf/hive/blob/f25b8652/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java b/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java
index f6ec596..06a1b58 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java
@@ -32,6 +32,7 @@ import org.apache.hadoop.hive.metastore.api.ColumnStatisticsObj;
 import org.apache.hadoop.hive.metastore.api.CompactionType;
 import org.apache.hadoop.hive.metastore.api.ConfigValSecurityException;
 import org.apache.hadoop.hive.metastore.api.CurrentNotificationEventId;
+import org.apache.hadoop.hive.metastore.api.DataOperationType;
 import org.apache.hadoop.hive.metastore.api.Database;
 import org.apache.hadoop.hive.metastore.api.EnvironmentContext;
 import org.apache.hadoop.hive.metastore.api.FieldSchema;
@@ -1447,6 +1448,12 @@ public interface IMetaStoreClient {
   ShowCompactResponse showCompactions() throws TException;
 
   /**
+   * @deprecated in Hive 1.3.0/2.1.0 - will be removed in 2 releases
+   */
+  @Deprecated
+  void addDynamicPartitions(long txnId, String dbName, String tableName, List<String> partNames)
+    throws TException;
+  /**
    * Send a list of partitions to the metastore to indicate which partitions were loaded
    * dynamically.
    * @param txnId id of the transaction
@@ -1455,7 +1462,8 @@ public interface IMetaStoreClient {
    * @param partNames partition name, as constructed by Warehouse.makePartName
    * @throws TException
    */
-  void addDynamicPartitions(long txnId, String dbName, String tableName, List<String> partNames)
+  void addDynamicPartitions(long txnId, String dbName, String tableName, List<String> partNames,
+                            DataOperationType operationType)
     throws TException;
 
   /**

http://git-wip-us.apache.org/repos/asf/hive/blob/f25b8652/metastore/src/java/org/apache/hadoop/hive/metastore/LockComponentBuilder.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/LockComponentBuilder.java b/metastore/src/java/org/apache/hadoop/hive/metastore/LockComponentBuilder.java
index acd4653..3e8f193 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/LockComponentBuilder.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/LockComponentBuilder.java
@@ -17,6 +17,7 @@
  */
 package org.apache.hadoop.hive.metastore;
 
+import org.apache.hadoop.hive.metastore.api.DataOperationType;
 import org.apache.hadoop.hive.metastore.api.LockComponent;
 import org.apache.hadoop.hive.metastore.api.LockLevel;
 import org.apache.hadoop.hive.metastore.api.LockType;
@@ -70,7 +71,16 @@ public class LockComponentBuilder {
     component.setDbname(dbName);
     return this;
   }
+  
+  public LockComponentBuilder setOperationType(DataOperationType dop) {
+    component.setOperationType(dop);
+    return this;
+  }
 
+  public LockComponentBuilder setIsAcid(boolean t) {
+    component.setIsAcid(t);
+    return this;
+  }
   /**
    * Set the table name.
    * @param tableName table name

http://git-wip-us.apache.org/repos/asf/hive/blob/f25b8652/metastore/src/java/org/apache/hadoop/hive/metastore/LockRequestBuilder.java
----------------------------------------------------------------------
diff --git a/metastore/src/java/org/apache/hadoop/hive/metastore/LockRequestBuilder.java b/metastore/src/java/org/apache/hadoop/hive/metastore/LockRequestBuilder.java
index 2fa7e07..6317a96 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/LockRequestBuilder.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/LockRequestBuilder.java
@@ -35,10 +35,19 @@ public class LockRequestBuilder {
   private LockTrie trie;
   private boolean userSet;
 
+  /**
+   * @deprecated 
+   */
   public LockRequestBuilder() {
+    this(null);
+  }
+  public LockRequestBuilder(String agentInfo) {
     req = new LockRequest();
     trie = new LockTrie();
     userSet = false;
+    if(agentInfo != null) {
+      req.setAgentInfo(agentInfo);
+    }
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/hive/blob/f25b8652/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 bc818e0..abaff34 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
@@ -129,7 +129,7 @@ abstract class TxnHandler implements TxnStore, TxnStore.MutexAPI {
   static private boolean doRetryOnConnPool = false;
   
   private enum OpertaionType {
-    INSERT('i'), UPDATE('u'), DELETE('d');
+    SELECT('s'), INSERT('i'), UPDATE('u'), DELETE('d');
     private final char sqlConst;
     OpertaionType(char sqlConst) {
       this.sqlConst = sqlConst;
@@ -139,6 +139,8 @@ abstract class TxnHandler implements TxnStore, TxnStore.MutexAPI {
     }
     public static OpertaionType fromString(char sqlConst) {
       switch (sqlConst) {
+        case 's':
+          return SELECT;
         case 'i':
           return INSERT;
         case 'u':
@@ -149,16 +151,18 @@ abstract class TxnHandler implements TxnStore, TxnStore.MutexAPI {
           throw new IllegalArgumentException(quoteChar(sqlConst));
       }
     }
-    //we should instead just pass in OpertaionType from client (HIVE-13622)
-    @Deprecated
-    public static OpertaionType fromLockType(LockType lockType) {
-      switch (lockType) {
-        case SHARED_READ:
-          return INSERT;
-        case SHARED_WRITE:
-          return UPDATE;
+    public static OpertaionType fromDataOperationType(DataOperationType dop) {
+      switch (dop) {
+        case SELECT:
+          return OpertaionType.SELECT;
+        case INSERT:
+          return OpertaionType.INSERT;
+        case UPDATE:
+          return OpertaionType.UPDATE;
+        case DELETE:
+          return OpertaionType.DELETE;
         default:
-          throw new IllegalArgumentException("Unexpected lock type: " + lockType);
+          throw new IllegalArgumentException("Unexpected value: " + dop);
       }
     }
   }
@@ -653,20 +657,21 @@ abstract class TxnHandler implements TxnStore, TxnStore.MutexAPI {
         String s = "insert into COMPLETED_TXN_COMPONENTS select tc_txnid, tc_database, tc_table, " +
           "tc_partition from TXN_COMPONENTS where tc_txnid = " + txnid;
         LOG.debug("Going to execute insert <" + s + ">");
-        if (stmt.executeUpdate(s) < 1) {
+        int modCount = 0;
+        if ((modCount = stmt.executeUpdate(s)) < 1) {
           //this can be reasonable for an empty txn START/COMMIT or read-only txn
           LOG.info("Expected to move at least one record from txn_components to " +
             "completed_txn_components when committing txn! " + JavaUtils.txnIdToString(txnid));
         }
         s = "delete from TXN_COMPONENTS where tc_txnid = " + txnid;
         LOG.debug("Going to execute update <" + s + ">");
-        stmt.executeUpdate(s);
+        modCount = stmt.executeUpdate(s);
         s = "delete from HIVE_LOCKS where hl_txnid = " + txnid;
         LOG.debug("Going to execute update <" + s + ">");
-        stmt.executeUpdate(s);
+        modCount = stmt.executeUpdate(s);
         s = "delete from TXNS where txn_id = " + txnid;
         LOG.debug("Going to execute update <" + s + ">");
-        stmt.executeUpdate(s);
+        modCount = stmt.executeUpdate(s);
         LOG.debug("Going to commit");
         dbConn.commit();
       } catch (SQLException e) {
@@ -808,7 +813,7 @@ abstract class TxnHandler implements TxnStore, TxnStore.MutexAPI {
         /** Get the next lock id.
          * This has to be atomic with adding entries to HIVE_LOCK entries (1st add in W state) to prevent a race.
          * Suppose ID gen is a separate txn and 2 concurrent lock() methods are running.  1st one generates nl_next=7,
-         * 2nd nl_next=8.  Then 8 goes first to insert into HIVE_LOCKS and aquires the locks.  Then 7 unblocks,
+         * 2nd nl_next=8.  Then 8 goes first to insert into HIVE_LOCKS and acquires the locks.  Then 7 unblocks,
          * and add it's W locks but it won't see locks from 8 since to be 'fair' {@link #checkLock(java.sql.Connection, long)}
          * doesn't block on locks acquired later than one it's checking*/
         String s = addForUpdateClause("select nl_next from NEXT_LOCK_ID");
@@ -826,13 +831,8 @@ abstract class TxnHandler implements TxnStore, TxnStore.MutexAPI {
         stmt.executeUpdate(s);
 
         if (txnid > 0) {
-          /**DBTxnManager#acquireLocks() knows if it's I/U/D (that's how it decides what lock to get)
-           * So if we add that to LockRequest we'll know that here 
-           * Should probably add it to LockComponent so that if in the future we decide wo allow 1 LockRequest
-           * to contain LockComponent for multiple operations.
-           * Deriving it from lock info doesn't distinguish between Update and Delete
-           * 
-           * QueryPlan has BaseSemanticAnalyzer which has acidFileSinks list of FileSinkDesc
+          /**
+           * todo QueryPlan has BaseSemanticAnalyzer which has acidFileSinks list of FileSinkDesc
            * FileSinkDesc.table is ql.metadata.Table
            * Table.tableSpec which is TableSpec, which has specType which is SpecType
            * So maybe this can work to know that this is part of dynamic partition insert in which case
@@ -841,8 +841,35 @@ abstract class TxnHandler implements TxnStore, TxnStore.MutexAPI {
            */
           // For each component in this lock request,
           // add an entry to the txn_components table
-          // This must be done before HIVE_LOCKS is accessed
           for (LockComponent lc : rqst.getComponent()) {
+            if(lc.isSetIsAcid() && !lc.isIsAcid()) {
+              //we don't prevent using non-acid resources in a txn but we do lock them
+              continue;
+            }
+            boolean updateTxnComponents;
+            if(!lc.isSetOperationType()) {
+              //request came from old version of the client
+              updateTxnComponents = true;//this matches old behavior
+            }
+            else {
+              switch (lc.getOperationType()) {
+                case INSERT:
+                case UPDATE:
+                case DELETE:
+                  updateTxnComponents = true;
+                  break;
+                case SELECT:
+                  updateTxnComponents = false;
+                  break;
+                default:
+                  //since we have an open transaction, only 4 values above are expected 
+                  throw new IllegalStateException("Unexpected DataOperationType: " + lc.getOperationType()
+                    + " agentInfo=" + rqst.getAgentInfo() + " " + JavaUtils.txnIdToString(txnid));
+              }
+            }
+            if(!updateTxnComponents) {
+              continue;
+            }
             String dbName = lc.getDbname();
             String tblName = lc.getTablename();
             String partName = lc.getPartitionname();
@@ -851,14 +878,19 @@ abstract class TxnHandler implements TxnStore, TxnStore.MutexAPI {
               "values (" + txnid + ", '" + dbName + "', " +
               (tblName == null ? "null" : "'" + tblName + "'") + ", " +
               (partName == null ? "null" : "'" + partName + "'")+ "," +
-              quoteString(OpertaionType.fromLockType(lc.getType()).toString()) + ")";
+              quoteString(OpertaionType.fromDataOperationType(lc.getOperationType()).toString()) + ")";
             LOG.debug("Going to execute update <" + s + ">");
-            stmt.executeUpdate(s);
+            int modCount = stmt.executeUpdate(s);
           }
         }
 
         long intLockId = 0;
         for (LockComponent lc : rqst.getComponent()) {
+          if(lc.isSetOperationType() && lc.getOperationType() == DataOperationType.UNSET) {
+            //old version of thrift client should have (lc.isSetOperationType() == false)
+            throw new IllegalStateException("Bug: operationType=" + lc.getOperationType() + " for component "
+              + lc + " agentInfo=" + rqst.getAgentInfo());
+          }
           intLockId++;
           String dbName = lc.getDbname();
           String tblName = lc.getTablename();
@@ -1433,21 +1465,13 @@ abstract class TxnHandler implements TxnStore, TxnStore.MutexAPI {
           ensureValidTxn(dbConn, rqst.getTxnid(), stmt);
           shouldNeverHappen(rqst.getTxnid());
         }
-        //we should be able to get this from AddDynamicPartitions object longer term; in fact we'd have to
-        //for multi stmt txns if same table is written more than once per tx
-        // MoveTask knows if it's I/U/D
-        // MoveTask calls Hive.loadDynamicPartitions() which calls HiveMetaStoreClient.addDynamicPartitions()
-        // which ends up here so we'd need to add a field to AddDynamicPartitions.
-        String findOperationType = " tc_operation_type from TXN_COMPONENTS where tc_txnid=" + rqst.getTxnid()
-          + " and tc_database=" + quoteString(rqst.getDbname()) + " and tc_table=" + quoteString(rqst.getTablename());
-        //do limit 1 on this; currently they will all have the same operations
-        rs = stmt.executeQuery(addLimitClause(1, findOperationType));
-        if(!rs.next()) {
-          throw new IllegalStateException("Unable to determine tc_operation_type for " + JavaUtils.txnIdToString(rqst.getTxnid()));
+        //for RU this may be null so we should default it to 'u' which is most restrictive
+        OpertaionType ot = OpertaionType.UPDATE;
+        if(rqst.isSetOperationType()) {
+          ot = OpertaionType.fromDataOperationType(rqst.getOperationType());
         }
-        OpertaionType ot = OpertaionType.fromString(rs.getString(1).charAt(0));
         
-        //what if a txn writes the same table > 1 time... let's go with this for now, but really
+        //what if a txn writes the same table > 1 time...(HIVE-9675) let's go with this for now, but really
         //need to not write this in the first place, i.e. make this delete not needed
         //see enqueueLockWithRetry() - that's where we write to TXN_COMPONENTS
         String deleteSql = "delete from TXN_COMPONENTS where tc_txnid=" + rqst.getTxnid() + " and tc_database=" +
@@ -1456,14 +1480,14 @@ abstract class TxnHandler implements TxnStore, TxnStore.MutexAPI {
         //much "wider" than necessary in a lot of cases.  Here on the other hand, we know exactly which
         //partitions have been written to.  w/o this WRITE_SET would contain entries for partitions not actually
         //written to
-        stmt.executeUpdate(deleteSql);
+        int modCount = stmt.executeUpdate(deleteSql);
         for (String partName : rqst.getPartitionnames()) {
           String s =
             "insert into TXN_COMPONENTS (tc_txnid, tc_database, tc_table, tc_partition, tc_operation_type) values (" +
               rqst.getTxnid() + "," + quoteString(rqst.getDbname()) + "," + quoteString(rqst.getTablename()) +
               "," + quoteString(partName) + "," + quoteChar(ot.sqlConst) + ")";
           LOG.debug("Going to execute update <" + s + ">");
-          stmt.executeUpdate(s);
+          modCount = stmt.executeUpdate(s);
         }
         LOG.debug("Going to commit");
         dbConn.commit();
@@ -1483,8 +1507,8 @@ abstract class TxnHandler implements TxnStore, TxnStore.MutexAPI {
   }
 
   /**
-   * Clean up corresponding records in metastore tables, specifically:
-   * TXN_COMPONENTS, COMPLETED_TXN_COMPONENTS, COMPACTION_QUEUE, COMPLETED_COMPACTIONS
+   * Clean up corresponding records in metastore tables when corresponding object is dropped,
+   * specifically: TXN_COMPONENTS, COMPLETED_TXN_COMPONENTS, COMPACTION_QUEUE, COMPLETED_COMPACTIONS
    */
   public void cleanupRecords(HiveObjectType type, Database db, Table table,
                              Iterator<Partition> partitionIterator) throws MetaException {