Repository: hive
Updated Branches:
  refs/heads/branch-1 f1950fc8a -> aecb0c02e


http://git-wip-us.apache.org/repos/asf/hive/blob/aecb0c02/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 596fdf5..c59fa3e 100644
--- a/metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py
+++ b/metastore/src/gen/thrift/gen-py/hive_metastore/ttypes.py
@@ -7483,6 +7483,81 @@ class AbortTxnRequest:
   def __ne__(self, other):
     return not (self == other)
 
+class AbortTxnsRequest:
+  """
+  Attributes:
+   - txn_ids
+  """
+
+  thrift_spec = (
+    None, # 0
+    (1, TType.LIST, 'txn_ids', (TType.I64,None), None, ), # 1
+  )
+
+  def __init__(self, txn_ids=None,):
+    self.txn_ids = txn_ids
+
+  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:
+      fastbinary.decode_binary(self, iprot.trans, (self.__class__, 
self.thrift_spec))
+      return
+    iprot.readStructBegin()
+    while True:
+      (fname, ftype, fid) = iprot.readFieldBegin()
+      if ftype == TType.STOP:
+        break
+      if fid == 1:
+        if ftype == TType.LIST:
+          self.txn_ids = []
+          (_etype402, _size399) = iprot.readListBegin()
+          for _i403 in xrange(_size399):
+            _elem404 = iprot.readI64()
+            self.txn_ids.append(_elem404)
+          iprot.readListEnd()
+        else:
+          iprot.skip(ftype)
+      else:
+        iprot.skip(ftype)
+      iprot.readFieldEnd()
+    iprot.readStructEnd()
+
+  def write(self, oprot):
+    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and 
self.thrift_spec is not None and fastbinary is not None:
+      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, 
self.thrift_spec)))
+      return
+    oprot.writeStructBegin('AbortTxnsRequest')
+    if self.txn_ids is not None:
+      oprot.writeFieldBegin('txn_ids', TType.LIST, 1)
+      oprot.writeListBegin(TType.I64, len(self.txn_ids))
+      for iter405 in self.txn_ids:
+        oprot.writeI64(iter405)
+      oprot.writeListEnd()
+      oprot.writeFieldEnd()
+    oprot.writeFieldStop()
+    oprot.writeStructEnd()
+
+  def validate(self):
+    if self.txn_ids is None:
+      raise TProtocol.TProtocolException(message='Required field txn_ids is 
unset!')
+    return
+
+
+  def __hash__(self):
+    value = 17
+    value = (value * 31) ^ hash(self.txn_ids)
+    return value
+
+  def __repr__(self):
+    L = ['%s=%r' % (key, value)
+      for key, value in self.__dict__.iteritems()]
+    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
+
+  def __eq__(self, other):
+    return isinstance(other, self.__class__) and self.__dict__ == 
other.__dict__
+
+  def __ne__(self, other):
+    return not (self == other)
+
 class CommitTxnRequest:
   """
   Attributes:
@@ -7711,11 +7786,11 @@ class LockRequest:
       if fid == 1:
         if ftype == TType.LIST:
           self.component = []
-          (_etype402, _size399) = iprot.readListBegin()
-          for _i403 in xrange(_size399):
-            _elem404 = LockComponent()
-            _elem404.read(iprot)
-            self.component.append(_elem404)
+          (_etype409, _size406) = iprot.readListBegin()
+          for _i410 in xrange(_size406):
+            _elem411 = LockComponent()
+            _elem411.read(iprot)
+            self.component.append(_elem411)
           iprot.readListEnd()
         else:
           iprot.skip(ftype)
@@ -7752,8 +7827,8 @@ class LockRequest:
     if self.component is not None:
       oprot.writeFieldBegin('component', TType.LIST, 1)
       oprot.writeListBegin(TType.STRUCT, len(self.component))
-      for iter405 in self.component:
-        iter405.write(oprot)
+      for iter412 in self.component:
+        iter412.write(oprot)
       oprot.writeListEnd()
       oprot.writeFieldEnd()
     if self.txnid is not None:
@@ -8451,11 +8526,11 @@ class ShowLocksResponse:
       if fid == 1:
         if ftype == TType.LIST:
           self.locks = []
-          (_etype409, _size406) = iprot.readListBegin()
-          for _i410 in xrange(_size406):
-            _elem411 = ShowLocksResponseElement()
-            _elem411.read(iprot)
-            self.locks.append(_elem411)
+          (_etype416, _size413) = iprot.readListBegin()
+          for _i417 in xrange(_size413):
+            _elem418 = ShowLocksResponseElement()
+            _elem418.read(iprot)
+            self.locks.append(_elem418)
           iprot.readListEnd()
         else:
           iprot.skip(ftype)
@@ -8472,8 +8547,8 @@ class ShowLocksResponse:
     if self.locks is not None:
       oprot.writeFieldBegin('locks', TType.LIST, 1)
       oprot.writeListBegin(TType.STRUCT, len(self.locks))
-      for iter412 in self.locks:
-        iter412.write(oprot)
+      for iter419 in self.locks:
+        iter419.write(oprot)
       oprot.writeListEnd()
       oprot.writeFieldEnd()
     oprot.writeFieldStop()
@@ -8688,20 +8763,20 @@ class HeartbeatTxnRangeResponse:
       if fid == 1:
         if ftype == TType.SET:
           self.aborted = set()
-          (_etype416, _size413) = iprot.readSetBegin()
-          for _i417 in xrange(_size413):
-            _elem418 = iprot.readI64()
-            self.aborted.add(_elem418)
+          (_etype423, _size420) = iprot.readSetBegin()
+          for _i424 in xrange(_size420):
+            _elem425 = iprot.readI64()
+            self.aborted.add(_elem425)
           iprot.readSetEnd()
         else:
           iprot.skip(ftype)
       elif fid == 2:
         if ftype == TType.SET:
           self.nosuch = set()
-          (_etype422, _size419) = iprot.readSetBegin()
-          for _i423 in xrange(_size419):
-            _elem424 = iprot.readI64()
-            self.nosuch.add(_elem424)
+          (_etype429, _size426) = iprot.readSetBegin()
+          for _i430 in xrange(_size426):
+            _elem431 = iprot.readI64()
+            self.nosuch.add(_elem431)
           iprot.readSetEnd()
         else:
           iprot.skip(ftype)
@@ -8718,15 +8793,15 @@ class HeartbeatTxnRangeResponse:
     if self.aborted is not None:
       oprot.writeFieldBegin('aborted', TType.SET, 1)
       oprot.writeSetBegin(TType.I64, len(self.aborted))
-      for iter425 in self.aborted:
-        oprot.writeI64(iter425)
+      for iter432 in self.aborted:
+        oprot.writeI64(iter432)
       oprot.writeSetEnd()
       oprot.writeFieldEnd()
     if self.nosuch is not None:
       oprot.writeFieldBegin('nosuch', TType.SET, 2)
       oprot.writeSetBegin(TType.I64, len(self.nosuch))
-      for iter426 in self.nosuch:
-        oprot.writeI64(iter426)
+      for iter433 in self.nosuch:
+        oprot.writeI64(iter433)
       oprot.writeSetEnd()
       oprot.writeFieldEnd()
     oprot.writeFieldStop()
@@ -9168,11 +9243,11 @@ class ShowCompactResponse:
       if fid == 1:
         if ftype == TType.LIST:
           self.compacts = []
-          (_etype430, _size427) = iprot.readListBegin()
-          for _i431 in xrange(_size427):
-            _elem432 = ShowCompactResponseElement()
-            _elem432.read(iprot)
-            self.compacts.append(_elem432)
+          (_etype437, _size434) = iprot.readListBegin()
+          for _i438 in xrange(_size434):
+            _elem439 = ShowCompactResponseElement()
+            _elem439.read(iprot)
+            self.compacts.append(_elem439)
           iprot.readListEnd()
         else:
           iprot.skip(ftype)
@@ -9189,8 +9264,8 @@ class ShowCompactResponse:
     if self.compacts is not None:
       oprot.writeFieldBegin('compacts', TType.LIST, 1)
       oprot.writeListBegin(TType.STRUCT, len(self.compacts))
-      for iter433 in self.compacts:
-        iter433.write(oprot)
+      for iter440 in self.compacts:
+        iter440.write(oprot)
       oprot.writeListEnd()
       oprot.writeFieldEnd()
     oprot.writeFieldStop()
@@ -9268,10 +9343,10 @@ class AddDynamicPartitions:
       elif fid == 4:
         if ftype == TType.LIST:
           self.partitionnames = []
-          (_etype437, _size434) = iprot.readListBegin()
-          for _i438 in xrange(_size434):
-            _elem439 = iprot.readString()
-            self.partitionnames.append(_elem439)
+          (_etype444, _size441) = iprot.readListBegin()
+          for _i445 in xrange(_size441):
+            _elem446 = iprot.readString()
+            self.partitionnames.append(_elem446)
           iprot.readListEnd()
         else:
           iprot.skip(ftype)
@@ -9300,8 +9375,8 @@ class AddDynamicPartitions:
     if self.partitionnames is not None:
       oprot.writeFieldBegin('partitionnames', TType.LIST, 4)
       oprot.writeListBegin(TType.STRING, len(self.partitionnames))
-      for iter440 in self.partitionnames:
-        oprot.writeString(iter440)
+      for iter447 in self.partitionnames:
+        oprot.writeString(iter447)
       oprot.writeListEnd()
       oprot.writeFieldEnd()
     oprot.writeFieldStop()
@@ -9582,11 +9657,11 @@ class NotificationEventResponse:
       if fid == 1:
         if ftype == TType.LIST:
           self.events = []
-          (_etype444, _size441) = iprot.readListBegin()
-          for _i445 in xrange(_size441):
-            _elem446 = NotificationEvent()
-            _elem446.read(iprot)
-            self.events.append(_elem446)
+          (_etype451, _size448) = iprot.readListBegin()
+          for _i452 in xrange(_size448):
+            _elem453 = NotificationEvent()
+            _elem453.read(iprot)
+            self.events.append(_elem453)
           iprot.readListEnd()
         else:
           iprot.skip(ftype)
@@ -9603,8 +9678,8 @@ class NotificationEventResponse:
     if self.events is not None:
       oprot.writeFieldBegin('events', TType.LIST, 1)
       oprot.writeListBegin(TType.STRUCT, len(self.events))
-      for iter447 in self.events:
-        iter447.write(oprot)
+      for iter454 in self.events:
+        iter454.write(oprot)
       oprot.writeListEnd()
       oprot.writeFieldEnd()
     oprot.writeFieldStop()
@@ -9725,10 +9800,10 @@ class InsertEventRequestData:
       if fid == 1:
         if ftype == TType.LIST:
           self.filesAdded = []
-          (_etype451, _size448) = iprot.readListBegin()
-          for _i452 in xrange(_size448):
-            _elem453 = iprot.readString()
-            self.filesAdded.append(_elem453)
+          (_etype458, _size455) = iprot.readListBegin()
+          for _i459 in xrange(_size455):
+            _elem460 = iprot.readString()
+            self.filesAdded.append(_elem460)
           iprot.readListEnd()
         else:
           iprot.skip(ftype)
@@ -9745,8 +9820,8 @@ class InsertEventRequestData:
     if self.filesAdded is not None:
       oprot.writeFieldBegin('filesAdded', TType.LIST, 1)
       oprot.writeListBegin(TType.STRING, len(self.filesAdded))
-      for iter454 in self.filesAdded:
-        oprot.writeString(iter454)
+      for iter461 in self.filesAdded:
+        oprot.writeString(iter461)
       oprot.writeListEnd()
       oprot.writeFieldEnd()
     oprot.writeFieldStop()
@@ -9899,10 +9974,10 @@ class FireEventRequest:
       elif fid == 5:
         if ftype == TType.LIST:
           self.partitionVals = []
-          (_etype458, _size455) = iprot.readListBegin()
-          for _i459 in xrange(_size455):
-            _elem460 = iprot.readString()
-            self.partitionVals.append(_elem460)
+          (_etype465, _size462) = iprot.readListBegin()
+          for _i466 in xrange(_size462):
+            _elem467 = iprot.readString()
+            self.partitionVals.append(_elem467)
           iprot.readListEnd()
         else:
           iprot.skip(ftype)
@@ -9935,8 +10010,8 @@ class FireEventRequest:
     if self.partitionVals is not None:
       oprot.writeFieldBegin('partitionVals', TType.LIST, 5)
       oprot.writeListBegin(TType.STRING, len(self.partitionVals))
-      for iter461 in self.partitionVals:
-        oprot.writeString(iter461)
+      for iter468 in self.partitionVals:
+        oprot.writeString(iter468)
       oprot.writeListEnd()
       oprot.writeFieldEnd()
     oprot.writeFieldStop()
@@ -10042,11 +10117,11 @@ class GetAllFunctionsResponse:
       if fid == 1:
         if ftype == TType.LIST:
           self.functions = []
-          (_etype465, _size462) = iprot.readListBegin()
-          for _i466 in xrange(_size462):
-            _elem467 = Function()
-            _elem467.read(iprot)
-            self.functions.append(_elem467)
+          (_etype472, _size469) = iprot.readListBegin()
+          for _i473 in xrange(_size469):
+            _elem474 = Function()
+            _elem474.read(iprot)
+            self.functions.append(_elem474)
           iprot.readListEnd()
         else:
           iprot.skip(ftype)
@@ -10063,8 +10138,8 @@ class GetAllFunctionsResponse:
     if self.functions is not None:
       oprot.writeFieldBegin('functions', TType.LIST, 1)
       oprot.writeListBegin(TType.STRUCT, len(self.functions))
-      for iter468 in self.functions:
-        iter468.write(oprot)
+      for iter475 in self.functions:
+        iter475.write(oprot)
       oprot.writeListEnd()
       oprot.writeFieldEnd()
     oprot.writeFieldStop()

http://git-wip-us.apache.org/repos/asf/hive/blob/aecb0c02/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 0028f48..2874308 100644
--- a/metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb
+++ b/metastore/src/gen/thrift/gen-rb/hive_metastore_types.rb
@@ -1680,6 +1680,23 @@ class AbortTxnRequest
   ::Thrift::Struct.generate_accessors self
 end
 
+class AbortTxnsRequest
+  include ::Thrift::Struct, ::Thrift::Struct_Union
+  TXN_IDS = 1
+
+  FIELDS = {
+    TXN_IDS => {:type => ::Thrift::Types::LIST, :name => 'txn_ids', :element 
=> {:type => ::Thrift::Types::I64}}
+  }
+
+  def struct_fields; FIELDS; end
+
+  def validate
+    raise 
::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required 
field txn_ids is unset!') unless @txn_ids
+  end
+
+  ::Thrift::Struct.generate_accessors self
+end
+
 class CommitTxnRequest
   include ::Thrift::Struct, ::Thrift::Struct_Union
   TXNID = 1

http://git-wip-us.apache.org/repos/asf/hive/blob/aecb0c02/metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb
----------------------------------------------------------------------
diff --git a/metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb 
b/metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb
index 45f43f6..3a4974b 100644
--- a/metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb
+++ b/metastore/src/gen/thrift/gen-rb/thrift_hive_metastore.rb
@@ -1905,6 +1905,21 @@ module ThriftHiveMetastore
       return
     end
 
+    def abort_txns(rqst)
+      send_abort_txns(rqst)
+      recv_abort_txns()
+    end
+
+    def send_abort_txns(rqst)
+      send_message('abort_txns', Abort_txns_args, :rqst => rqst)
+    end
+
+    def recv_abort_txns()
+      result = receive_message(Abort_txns_result)
+      raise result.o1 unless result.o1.nil?
+      return
+    end
+
     def commit_txn(rqst)
       send_commit_txn(rqst)
       recv_commit_txn()
@@ -3586,6 +3601,17 @@ module ThriftHiveMetastore
       write_result(result, oprot, 'abort_txn', seqid)
     end
 
+    def process_abort_txns(seqid, iprot, oprot)
+      args = read_args(iprot, Abort_txns_args)
+      result = Abort_txns_result.new()
+      begin
+        @handler.abort_txns(args.rqst)
+      rescue ::NoSuchTxnException => o1
+        result.o1 = o1
+      end
+      write_result(result, oprot, 'abort_txns', seqid)
+    end
+
     def process_commit_txn(seqid, iprot, oprot)
       args = read_args(iprot, Commit_txn_args)
       result = Commit_txn_result.new()
@@ -8065,6 +8091,38 @@ module ThriftHiveMetastore
     ::Thrift::Struct.generate_accessors self
   end
 
+  class Abort_txns_args
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    RQST = 1
+
+    FIELDS = {
+      RQST => {:type => ::Thrift::Types::STRUCT, :name => 'rqst', :class => 
::AbortTxnsRequest}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
+  class Abort_txns_result
+    include ::Thrift::Struct, ::Thrift::Struct_Union
+    O1 = 1
+
+    FIELDS = {
+      O1 => {:type => ::Thrift::Types::STRUCT, :name => 'o1', :class => 
::NoSuchTxnException}
+    }
+
+    def struct_fields; FIELDS; end
+
+    def validate
+    end
+
+    ::Thrift::Struct.generate_accessors self
+  end
+
   class Commit_txn_args
     include ::Thrift::Struct, ::Thrift::Struct_Union
     RQST = 1

http://git-wip-us.apache.org/repos/asf/hive/blob/aecb0c02/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
----------------------------------------------------------------------
diff --git 
a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java 
b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
index 73422c8..7a2333d 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStore.java
@@ -45,6 +45,7 @@ import 
org.apache.hadoop.hive.common.metrics.common.MetricsFactory;
 import org.apache.hadoop.hive.conf.HiveConf;
 import org.apache.hadoop.hive.conf.HiveConf.ConfVars;
 import org.apache.hadoop.hive.metastore.api.AbortTxnRequest;
+import org.apache.hadoop.hive.metastore.api.AbortTxnsRequest;
 import org.apache.hadoop.hive.metastore.api.AddDynamicPartitions;
 import org.apache.hadoop.hive.metastore.api.AddPartitionsRequest;
 import org.apache.hadoop.hive.metastore.api.AddPartitionsResult;
@@ -5619,6 +5620,11 @@ public class HiveMetaStore extends ThriftHiveMetastore {
     }
 
     @Override
+    public void abort_txns(AbortTxnsRequest rqst) throws NoSuchTxnException, 
TException {
+      getTxnHandler().abortTxns(rqst);
+    }
+
+    @Override
     public void commit_txn(CommitTxnRequest rqst)
         throws NoSuchTxnException, TxnAbortedException, TException {
       getTxnHandler().commitTxn(rqst);

http://git-wip-us.apache.org/repos/asf/hive/blob/aecb0c02/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 50bf43c..6bef3f5 100644
--- 
a/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
+++ 
b/metastore/src/java/org/apache/hadoop/hive/metastore/HiveMetaStoreClient.java
@@ -55,6 +55,7 @@ import org.apache.hadoop.hive.conf.HiveConf;
 import org.apache.hadoop.hive.conf.HiveConf.ConfVars;
 import org.apache.hadoop.hive.conf.HiveConfUtil;
 import org.apache.hadoop.hive.metastore.api.AbortTxnRequest;
+import org.apache.hadoop.hive.metastore.api.AbortTxnsRequest;
 import org.apache.hadoop.hive.metastore.api.AddDynamicPartitions;
 import org.apache.hadoop.hive.metastore.api.AddPartitionsRequest;
 import org.apache.hadoop.hive.metastore.api.AddPartitionsResult;
@@ -1889,6 +1890,11 @@ public class HiveMetaStoreClient implements 
IMetaStoreClient {
   }
 
   @Override
+  public void abortTxns(List<Long> txnids) throws NoSuchTxnException, 
TException {
+    client.abort_txns(new AbortTxnsRequest(txnids));
+  }
+
+  @Override
   public LockResponse lock(LockRequest request)
       throws NoSuchTxnException, TxnAbortedException, TException {
     return client.lock(request);

http://git-wip-us.apache.org/repos/asf/hive/blob/aecb0c02/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 2de2cdb..da3d7bc 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/IMetaStoreClient.java
@@ -1240,6 +1240,12 @@ public interface IMetaStoreClient {
       throws NoSuchTxnException, TxnAbortedException, TException;
 
   /**
+   * Abort a list of transactions. This is for use by "ABORT TRANSACTIONS" in 
the grammar.
+   * @throws TException
+   */
+  void abortTxns(List<Long> txnids) throws TException;
+
+  /**
    * Show the list of currently open transactions.  This is for use by "show 
transactions" in the
    * grammar, not for applications that want to find a list of current 
transactions to work with.
    * Those wishing the latter should call {@link #getValidTxns()}.

http://git-wip-us.apache.org/repos/asf/hive/blob/aecb0c02/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 ec60fa5..b1d330d 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
@@ -488,7 +488,7 @@ abstract class TxnHandler implements TxnStore, 
TxnStore.MutexAPI {
       try {
         lockInternal();
         dbConn = getDbConn(Connection.TRANSACTION_READ_COMMITTED);
-        if (abortTxns(dbConn, Collections.singletonList(txnid)) != 1) {
+        if (abortTxns(dbConn, Collections.singletonList(txnid), true) != 1) {
           LOG.debug("Going to rollback");
           dbConn.rollback();
           throw new NoSuchTxnException("No such transaction " + 
JavaUtils.txnIdToString(txnid));
@@ -511,6 +511,35 @@ abstract class TxnHandler implements TxnStore, 
TxnStore.MutexAPI {
     }
   }
 
+  public void abortTxns(AbortTxnsRequest rqst) throws NoSuchTxnException, 
MetaException {
+    List<Long> txnids = rqst.getTxn_ids();
+    try {
+      Connection dbConn = null;
+      try {
+        dbConn = getDbConn(Connection.TRANSACTION_READ_COMMITTED);
+        int numAborted = abortTxns(dbConn, txnids, false);
+        if (numAborted != txnids.size()) {
+          LOG.warn("Abort Transactions command only abort " + numAborted + " 
out of " +
+              txnids.size() + " transactions. It's possible that the other " +
+              (txnids.size() - numAborted) +
+              " transactions have been aborted or committed, or the 
transaction ids are invalid.");
+        }
+        LOG.debug("Going to commit");
+        dbConn.commit();
+      } catch (SQLException e) {
+        LOG.debug("Going to rollback");
+        rollbackDBConn(dbConn);
+        checkRetryable(dbConn, e, "abortTxns(" + rqst + ")");
+        throw new MetaException("Unable to update transaction database "
+            + StringUtils.stringifyException(e));
+      } finally {
+        closeDbConn(dbConn);
+      }
+    } catch (RetryException e) {
+      abortTxns(rqst);
+    }
+  }
+
   /**
    * Concurrency/isolation notes:
    * This is mutexed with {@link #openTxns(OpenTxnRequest)} and other {@link 
#commitTxn(CommitTxnRequest)}
@@ -629,7 +658,7 @@ abstract class TxnHandler implements TxnStore, 
TxnStore.MutexAPI {
             dbConn.rollback(undoWriteSetForCurrentTxn);
             LOG.info(msg);
             //todo: should make abortTxns() write something into 
TXNS.TXN_META_INFO about this
-            if(abortTxns(dbConn, Collections.singletonList(txnid)) != 1) {
+            if(abortTxns(dbConn, Collections.singletonList(txnid), true) != 1) 
{
               throw new IllegalStateException(msg + " FAILED!");
             }
             dbConn.commit();
@@ -2078,8 +2107,8 @@ abstract class TxnHandler implements TxnStore, 
TxnStore.MutexAPI {
     }
   }
 
-  private int abortTxns(Connection dbConn, List<Long> txnids) throws 
SQLException {
-    return abortTxns(dbConn, txnids, -1);
+  private int abortTxns(Connection dbConn, List<Long> txnids, boolean 
isStrict) throws SQLException {
+    return abortTxns(dbConn, txnids, -1, isStrict);
   }
   /**
    * TODO: expose this as an operation to client.  Useful for streaming API to 
abort all remaining
@@ -2091,10 +2120,15 @@ abstract class TxnHandler implements TxnStore, 
TxnStore.MutexAPI {
    * @param txnids list of transactions to abort
    * @param max_heartbeat value used by {@link #performTimeOuts()} to ensure 
this doesn't Abort txn which were
    *                      hearbetated after #performTimeOuts() select and this 
operation.
+   * @param isStrict true for strict mode, false for best-effort mode.
+   *                 In strict mode, if all txns are not successfully aborted, 
then the count of
+   *                 updated ones will be returned and the caller will roll 
back.
+   *                 In best-effort mode, we will ignore that fact and 
continue deleting the locks.
    * @return Number of aborted transactions
    * @throws SQLException
    */
-  private int abortTxns(Connection dbConn, List<Long> txnids, long 
max_heartbeat) throws SQLException {
+  private int abortTxns(Connection dbConn, List<Long> txnids, long 
max_heartbeat, boolean isStrict)
+      throws SQLException {
     Statement stmt = null;
     int updateCnt = 0;
     if (txnids.isEmpty()) {
@@ -2121,16 +2155,17 @@ abstract class TxnHandler implements TxnStore, 
TxnStore.MutexAPI {
 
       for (String query : queries) {
         LOG.debug("Going to execute update <" + query + ">");
-        updateCnt = stmt.executeUpdate(query);
-        if (updateCnt < txnids.size()) {
-          /**
-           * have to bail in this case since we don't know which transactions 
were not Aborted and
-           * thus don't know which locks to delete
-           * This may happen due to a race between {@link 
#heartbeat(HeartbeatRequest)}  operation and
-           * {@link #performTimeOuts()}
-           */
-          return updateCnt;
-        }
+        updateCnt += stmt.executeUpdate(query);
+      }
+
+      if (updateCnt < txnids.size() && isStrict) {
+        /**
+         * have to bail in this case since we don't know which transactions 
were not Aborted and
+         * thus don't know which locks to delete
+         * This may happen due to a race between {@link 
#heartbeat(HeartbeatRequest)}  operation and
+         * {@link #performTimeOuts()}
+         */
+        return updateCnt;
       }
 
       queries.clear();
@@ -2254,7 +2289,7 @@ abstract class TxnHandler implements TxnStore, 
TxnStore.MutexAPI {
             " since a concurrent committed transaction [" + 
JavaUtils.txnIdToString(rs.getLong(4)) + "," + rs.getLong(5) +
             "] has already updated resouce '" + resourceName + "'";
           LOG.info(msg);
-          if(abortTxns(dbConn, 
Collections.singletonList(writeSet.get(0).txnId)) != 1) {
+          if(abortTxns(dbConn, 
Collections.singletonList(writeSet.get(0).txnId), true) != 1) {
             throw new IllegalStateException(msg + " FAILED!");
           }
           dbConn.commit();
@@ -2774,7 +2809,7 @@ abstract class TxnHandler implements TxnStore, 
TxnStore.MutexAPI {
         close(rs, stmt, null);
         int numTxnsAborted = 0;
         for(List<Long> batchToAbort : timedOutTxns) {
-          if(abortTxns(dbConn, batchToAbort, now - timeout) == 
batchToAbort.size()) {
+          if(abortTxns(dbConn, batchToAbort, now - timeout, true) == 
batchToAbort.size()) {
             dbConn.commit();
             numTxnsAborted += batchToAbort.size();
             //todo: add TXNS.COMMENT filed and set it to 'aborted by system 
due to timeout'

http://git-wip-us.apache.org/repos/asf/hive/blob/aecb0c02/metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnStore.java
----------------------------------------------------------------------
diff --git 
a/metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnStore.java 
b/metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnStore.java
index bd274ee..dc807df 100644
--- a/metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnStore.java
+++ b/metastore/src/java/org/apache/hadoop/hive/metastore/txn/TxnStore.java
@@ -22,6 +22,7 @@ import 
org.apache.hadoop.hive.common.classification.InterfaceAudience;
 import org.apache.hadoop.hive.common.classification.InterfaceStability;
 import org.apache.hadoop.hive.conf.HiveConf;
 import org.apache.hadoop.hive.metastore.api.AbortTxnRequest;
+import org.apache.hadoop.hive.metastore.api.AbortTxnsRequest;
 import org.apache.hadoop.hive.metastore.api.AddDynamicPartitions;
 import org.apache.hadoop.hive.metastore.api.CheckLockRequest;
 import org.apache.hadoop.hive.metastore.api.CommitTxnRequest;
@@ -120,6 +121,14 @@ public interface TxnStore {
   public void abortTxn(AbortTxnRequest rqst) throws NoSuchTxnException, 
MetaException;
 
   /**
+   * Abort (rollback) a list of transactions in one request.
+   * @param rqst info on transactions to abort
+   * @throws NoSuchTxnException
+   * @throws MetaException
+   */
+  public void abortTxns(AbortTxnsRequest rqst) throws NoSuchTxnException, 
MetaException;
+
+  /**
    * Commit a transaction
    * @param rqst info on transaction to commit
    * @throws NoSuchTxnException

http://git-wip-us.apache.org/repos/asf/hive/blob/aecb0c02/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java 
b/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java
index 816d8d4..7818043 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/exec/DDLTask.java
@@ -130,6 +130,7 @@ import 
org.apache.hadoop.hive.ql.parse.AlterTablePartMergeFilesDesc;
 import org.apache.hadoop.hive.ql.parse.BaseSemanticAnalyzer;
 import org.apache.hadoop.hive.ql.parse.DDLSemanticAnalyzer;
 import org.apache.hadoop.hive.ql.parse.ReplicationSpec;
+import org.apache.hadoop.hive.ql.plan.AbortTxnsDesc;
 import org.apache.hadoop.hive.ql.plan.AddPartitionDesc;
 import org.apache.hadoop.hive.ql.plan.AlterDatabaseDesc;
 import org.apache.hadoop.hive.ql.plan.AlterIndexDesc;
@@ -437,7 +438,12 @@ public class DDLTask extends Task<DDLWork> implements 
Serializable {
         return showTxns(txnsDesc);
       }
 
-       LockTableDesc lockTbl = work.getLockTblDesc();
+      AbortTxnsDesc abortTxnsDesc = work.getAbortTxnsDesc();
+      if (abortTxnsDesc != null) {
+        return abortTxns(db, abortTxnsDesc);
+      }
+
+      LockTableDesc lockTbl = work.getLockTblDesc();
       if (lockTbl != null) {
         return lockTable(lockTbl);
       }
@@ -2701,6 +2707,11 @@ public class DDLTask extends Task<DDLWork> implements 
Serializable {
     return 0;
   }
 
+  private int abortTxns(Hive db, AbortTxnsDesc desc) throws HiveException {
+    db.abortTransactions(desc.getTxnids());
+    return 0;
+  }
+
    /**
    * Lock the table/partition specified
    *

http://git-wip-us.apache.org/repos/asf/hive/blob/aecb0c02/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java 
b/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
index 2467520..20e1ef6 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/metadata/Hive.java
@@ -3272,6 +3272,15 @@ private void constructOneLBLocationMap(FileStatus fSta,
     }
   }
 
+  public void abortTransactions(List<Long> txnids) throws HiveException {
+    try {
+      getMSC().abortTxns(txnids);
+    } catch (Exception e) {
+      LOG.error(StringUtils.stringifyException(e));
+      throw new HiveException(e);
+    }
+  }
+
   public void createFunction(Function func) throws HiveException {
     try {
       getMSC().createFunction(func);

http://git-wip-us.apache.org/repos/asf/hive/blob/aecb0c02/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java
----------------------------------------------------------------------
diff --git 
a/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java 
b/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java
index 731bdf2..f7cd167 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/DDLSemanticAnalyzer.java
@@ -91,6 +91,7 @@ import org.apache.hadoop.hive.ql.metadata.Table;
 import org.apache.hadoop.hive.ql.parse.authorization.AuthorizationParseUtils;
 import 
org.apache.hadoop.hive.ql.parse.authorization.HiveAuthorizationTaskFactory;
 import 
org.apache.hadoop.hive.ql.parse.authorization.HiveAuthorizationTaskFactoryImpl;
+import org.apache.hadoop.hive.ql.plan.AbortTxnsDesc;
 import org.apache.hadoop.hive.ql.plan.AddPartitionDesc;
 import org.apache.hadoop.hive.ql.plan.AlterDatabaseDesc;
 import org.apache.hadoop.hive.ql.plan.AlterIndexDesc;
@@ -372,6 +373,9 @@ public class DDLSemanticAnalyzer extends 
BaseSemanticAnalyzer {
       ctx.setResFile(ctx.getLocalTmpPath());
       analyzeShowTxns(ast);
       break;
+    case HiveParser.TOK_ABORT_TRANSACTIONS:
+      analyzeAbortTxns(ast);
+      break;
     case HiveParser.TOK_SHOWCONF:
       ctx.setResFile(ctx.getLocalTmpPath());
       analyzeShowConf(ast);
@@ -2451,6 +2455,21 @@ public class DDLSemanticAnalyzer extends 
BaseSemanticAnalyzer {
     setFetchTask(createFetchTask(desc.getSchema()));
   }
 
+  /**
+   * Add a task to execute "ABORT TRANSACTIONS"
+   * @param ast The parsed command tree
+   * @throws SemanticException Parsing failed
+   */
+  private void analyzeAbortTxns(ASTNode ast) throws SemanticException {
+    List<Long> txnids = new ArrayList<Long>();
+    int numChildren = ast.getChildCount();
+    for (int i = 0; i < numChildren; i++) {
+      txnids.add(Long.parseLong(ast.getChild(i).getText()));
+    }
+    AbortTxnsDesc desc = new AbortTxnsDesc(txnids);
+    rootTasks.add(TaskFactory.get(new DDLWork(getInputs(), getOutputs(), 
desc), conf));
+  }
+
    /**
    * Add the task according to the parsed command tree. This is used for the 
CLI
    * command "UNLOCK TABLE ..;".

http://git-wip-us.apache.org/repos/asf/hive/blob/aecb0c02/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveLexer.g
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveLexer.g 
b/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveLexer.g
index c080124..428e089 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveLexer.g
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveLexer.g
@@ -317,6 +317,7 @@ KW_ISOLATION: 'ISOLATION';
 KW_LEVEL: 'LEVEL';
 KW_SNAPSHOT: 'SNAPSHOT';
 KW_AUTOCOMMIT: 'AUTOCOMMIT';
+KW_ABORT: 'ABORT';
 
 // Operators
 // NOTE: if you add a new function/operator, add it to sysFuncNames so that 
describe function _FUNC_ will work.

http://git-wip-us.apache.org/repos/asf/hive/blob/aecb0c02/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g 
b/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
index c62edbf..6c3d42a 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/HiveParser.g
@@ -365,6 +365,7 @@ TOK_TXN_READ_WRITE;
 TOK_COMMIT;
 TOK_ROLLBACK;
 TOK_SET_AUTOCOMMIT;
+TOK_ABORT_TRANSACTIONS;
 }
 
 
@@ -509,6 +510,8 @@ import org.apache.hadoop.hive.conf.HiveConf;
     xlateMap.put("KW_UPDATE", "UPDATE");
     xlateMap.put("KW_VALUES", "VALUES");
     xlateMap.put("KW_PURGE", "PURGE");
+    xlateMap.put("KW_ABORT", "ABORT");
+    xlateMap.put("KW_TRANSACTIONS", "TRANSACTIONS");
 
 
     // Operators
@@ -781,6 +784,7 @@ ddlStatement
     | revokeRole
     | setRole
     | showCurrentRole
+    | abortTransactionStatement
     ;
 
 ifExists
@@ -2467,3 +2471,10 @@ setAutoCommitStatement
 /*
 END user defined transaction boundaries
 */
+
+abortTransactionStatement
+@init { pushMsg("abort transactions statement", state); }
+@after { popMsg(state); }
+  :
+  KW_ABORT KW_TRANSACTIONS ( Number )+ -> ^(TOK_ABORT_TRANSACTIONS ( Number )+)
+  ;

http://git-wip-us.apache.org/repos/asf/hive/blob/aecb0c02/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g 
b/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g
index 64af7d1..28bf46b 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/IdentifiersParser.g
@@ -623,7 +623,7 @@ principalIdentifier
 //http://www.postgresql.org/docs/9.5/static/sql-keywords-appendix.html
 nonReserved
     :
-    KW_ADD | KW_ADMIN | KW_AFTER | KW_ANALYZE | KW_ARCHIVE | KW_ASC | 
KW_BEFORE | KW_BUCKET | KW_BUCKETS
+    KW_ABORT | KW_ADD | KW_ADMIN | KW_AFTER | KW_ANALYZE | KW_ARCHIVE | KW_ASC 
| KW_BEFORE | KW_BUCKET | KW_BUCKETS
     | KW_CASCADE | KW_CHANGE | KW_CLUSTER | KW_CLUSTERED | KW_CLUSTERSTATUS | 
KW_COLLECTION | KW_COLUMNS
     | KW_COMMENT | KW_COMPACT | KW_COMPACTIONS | KW_COMPUTE | KW_CONCATENATE | 
KW_CONTINUE | KW_DATA | KW_DAY
     | KW_DATABASES | KW_DATETIME | KW_DBPROPERTIES | KW_DEFERRED | KW_DEFINED 
| KW_DELIMITED | KW_DEPENDENCY 

http://git-wip-us.apache.org/repos/asf/hive/blob/aecb0c02/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzerFactory.java
----------------------------------------------------------------------
diff --git 
a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzerFactory.java 
b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzerFactory.java
index 4a3802d..2a1c377 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzerFactory.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzerFactory.java
@@ -112,6 +112,7 @@ public final class SemanticAnalyzerFactory {
     commandType.put(HiveParser.TOK_ALTERTABLE_PARTCOLTYPE, 
HiveOperation.ALTERTABLE_PARTCOLTYPE);
     commandType.put(HiveParser.TOK_SHOW_COMPACTIONS, 
HiveOperation.SHOW_COMPACTIONS);
     commandType.put(HiveParser.TOK_SHOW_TRANSACTIONS, 
HiveOperation.SHOW_TRANSACTIONS);
+    commandType.put(HiveParser.TOK_ABORT_TRANSACTIONS, 
HiveOperation.ABORT_TRANSACTIONS);
     commandType.put(HiveParser.TOK_START_TRANSACTION, 
HiveOperation.START_TRANSACTION);
     commandType.put(HiveParser.TOK_COMMIT, HiveOperation.COMMIT);
     commandType.put(HiveParser.TOK_ROLLBACK, HiveOperation.ROLLBACK);
@@ -239,6 +240,7 @@ public final class SemanticAnalyzerFactory {
       case HiveParser.TOK_SHOWDBLOCKS:
       case HiveParser.TOK_SHOW_COMPACTIONS:
       case HiveParser.TOK_SHOW_TRANSACTIONS:
+      case HiveParser.TOK_ABORT_TRANSACTIONS:
       case HiveParser.TOK_SHOWCONF:
       case HiveParser.TOK_CREATEINDEX:
       case HiveParser.TOK_DROPINDEX:

http://git-wip-us.apache.org/repos/asf/hive/blob/aecb0c02/ql/src/java/org/apache/hadoop/hive/ql/plan/AbortTxnsDesc.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/plan/AbortTxnsDesc.java 
b/ql/src/java/org/apache/hadoop/hive/ql/plan/AbortTxnsDesc.java
new file mode 100644
index 0000000..d82b134
--- /dev/null
+++ b/ql/src/java/org/apache/hadoop/hive/ql/plan/AbortTxnsDesc.java
@@ -0,0 +1,36 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hive.ql.plan;
+import java.io.Serializable;
+import java.util.List;
+/**
+ * Descriptor for aborting transactions.
+ */
+public class AbortTxnsDesc extends DDLDesc implements Serializable {
+  private static final long serialVersionUID = 1L;
+  private final List<Long> txnids;
+  /**
+   *  No arg constructor for serialization.
+   */
+  public AbortTxnsDesc(List<Long> txnids) {
+    this.txnids = txnids;
+  }
+  public List<Long> getTxnids() {
+    return txnids;
+  }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/hive/blob/aecb0c02/ql/src/java/org/apache/hadoop/hive/ql/plan/DDLWork.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/plan/DDLWork.java 
b/ql/src/java/org/apache/hadoop/hive/ql/plan/DDLWork.java
index 8dbb3c1..80dc940 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/plan/DDLWork.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/plan/DDLWork.java
@@ -55,6 +55,7 @@ public class DDLWork implements Serializable {
   private ShowLocksDesc showLocksDesc;
   private ShowCompactionsDesc showCompactionsDesc;
   private ShowTxnsDesc showTxnsDesc;
+  private AbortTxnsDesc abortTxnsDesc;
   private DescFunctionDesc descFunctionDesc;
   private ShowPartitionsDesc showPartsDesc;
   private ShowCreateTableDesc showCreateTblDesc;
@@ -346,6 +347,12 @@ public class DDLWork implements Serializable {
     this.showTxnsDesc = showTxnsDesc;
   }
 
+  public DDLWork(HashSet<ReadEntity> inputs, HashSet<WriteEntity> outputs,
+                 AbortTxnsDesc abortTxnsDesc) {
+    this(inputs, outputs);
+    this.abortTxnsDesc = abortTxnsDesc;
+  }
+
    /**
    * @param descFuncDesc
    */
@@ -744,6 +751,11 @@ public class DDLWork implements Serializable {
     return showTxnsDesc;
   }
 
+  @Explain(displayName = "Abort Transactions Operator", explainLevels = { 
Level.USER, Level.DEFAULT, Level.EXTENDED })
+  public AbortTxnsDesc getAbortTxnsDesc() {
+    return abortTxnsDesc;
+  }
+
   /**
    * @return the lockTblDesc
    */
@@ -792,6 +804,10 @@ public class DDLWork implements Serializable {
     this.showTxnsDesc = showTxnsDesc;
   }
 
+  public void setAbortTxnsDesc(AbortTxnsDesc abortTxnsDesc) {
+    this.abortTxnsDesc = abortTxnsDesc;
+  }
+
   /**
    * @param lockTblDesc
    *          the lockTblDesc to set

http://git-wip-us.apache.org/repos/asf/hive/blob/aecb0c02/ql/src/java/org/apache/hadoop/hive/ql/plan/HiveOperation.java
----------------------------------------------------------------------
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/plan/HiveOperation.java 
b/ql/src/java/org/apache/hadoop/hive/ql/plan/HiveOperation.java
index fc6be2b..fd279de 100644
--- a/ql/src/java/org/apache/hadoop/hive/ql/plan/HiveOperation.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/plan/HiveOperation.java
@@ -122,8 +122,8 @@ public enum HiveOperation {
   START_TRANSACTION("START TRANSACTION", null, null, false, false),
   COMMIT("COMMIT", null, null, true, true),
   ROLLBACK("ROLLBACK", null, null, true, true),
-  SET_AUTOCOMMIT("SET AUTOCOMMIT", null, null, true, false);
-  ;
+  SET_AUTOCOMMIT("SET AUTOCOMMIT", null, null, true, false),
+  ABORT_TRANSACTIONS("ABORT TRANSACTIONS", null, null, false, false);
 
   private String operationName;
 

http://git-wip-us.apache.org/repos/asf/hive/blob/aecb0c02/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/HiveOperationType.java
----------------------------------------------------------------------
diff --git 
a/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/HiveOperationType.java
 
b/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/HiveOperationType.java
index 71be469..6b3aa76 100644
--- 
a/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/HiveOperationType.java
+++ 
b/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/HiveOperationType.java
@@ -118,6 +118,7 @@ public enum HiveOperationType {
   ALTERTABLE_COMPACT,
   SHOW_COMPACTIONS,
   SHOW_TRANSACTIONS,
+  ABORT_TRANSACTIONS,
   // ==== Hive command operation types starts here ==== //
   SET,
   RESET,

http://git-wip-us.apache.org/repos/asf/hive/blob/aecb0c02/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/sqlstd/Operation2Privilege.java
----------------------------------------------------------------------
diff --git 
a/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/sqlstd/Operation2Privilege.java
 
b/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/sqlstd/Operation2Privilege.java
index a2aeafc..b8ee72a 100644
--- 
a/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/sqlstd/Operation2Privilege.java
+++ 
b/ql/src/java/org/apache/hadoop/hive/ql/security/authorization/plugin/sqlstd/Operation2Privilege.java
@@ -418,7 +418,8 @@ public class Operation2Privilege {
       (null, null));
     op2Priv.put(HiveOperationType.ALTERTABLE_EXCHANGEPARTITION,
       PrivRequirement.newIOPrivRequirement(null, null));
-
+    op2Priv.put(HiveOperationType.ABORT_TRANSACTIONS, 
PrivRequirement.newIOPrivRequirement
+      (null, null));
   }
 
   /**

http://git-wip-us.apache.org/repos/asf/hive/blob/aecb0c02/ql/src/test/queries/clientpositive/dbtxnmgr_abort.q
----------------------------------------------------------------------
diff --git a/ql/src/test/queries/clientpositive/dbtxnmgr_abort.q 
b/ql/src/test/queries/clientpositive/dbtxnmgr_abort.q
new file mode 100644
index 0000000..d923995
--- /dev/null
+++ b/ql/src/test/queries/clientpositive/dbtxnmgr_abort.q
@@ -0,0 +1,6 @@
+set hive.support.concurrency=true;
+set hive.txn.manager=org.apache.hadoop.hive.ql.lockmgr.DbTxnManager;
+
+abort transactions 1234 5678;
+
+abort transactions 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 
102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 
262 263 264 265 266 267 268 269 270 271 27
 2 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 
292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 
372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 
392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 
412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 
432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 
452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 
472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 
492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 
512 513 514 515 516 517 518 519 520 521
  522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 
541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 
561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 
581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 
601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 
621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 
641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 
661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 
681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 
701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 
721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 
741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 
761 762 763 764 765 766 767 768 769 770 
 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 
790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 
810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 
830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 
850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 
870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 
890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 
910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 
930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 
950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 
970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 
990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 
1008 1009 1010;

http://git-wip-us.apache.org/repos/asf/hive/blob/aecb0c02/ql/src/test/results/clientpositive/dbtxnmgr_abort.q.out
----------------------------------------------------------------------
diff --git a/ql/src/test/results/clientpositive/dbtxnmgr_abort.q.out 
b/ql/src/test/results/clientpositive/dbtxnmgr_abort.q.out
new file mode 100644
index 0000000..b1c808a
--- /dev/null
+++ b/ql/src/test/results/clientpositive/dbtxnmgr_abort.q.out
@@ -0,0 +1,8 @@
+PREHOOK: query: abort transactions 1234 5678
+PREHOOK: type: ABORT TRANSACTIONS
+POSTHOOK: query: abort transactions 1234 5678
+POSTHOOK: type: ABORT TRANSACTIONS
+PREHOOK: query: abort transactions 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 
257 258 259 260 261 262 263 264 265 266 267 26
 8 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 
348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 
388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 
428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 
448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 
488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 
508 509 510 511 512 513 514 515 516 517
  518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 
537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 
557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 
577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 
597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 
617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 
637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 
657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 
677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 
697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 
717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 
737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 
757 758 759 760 761 762 763 764 765 766 
 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 
786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 
806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 
826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 
846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 
866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 
886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 
906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 
926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 
946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 
966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 
986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 
1004 1005 1006 1007 1008 1009 1010
+PREHOOK: type: ABORT TRANSACTIONS
+POSTHOOK: query: abort transactions 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 
157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 
217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 
237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 
257 258 259 260 261 262 263 264 265 266 267 2
 68 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 
288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 
328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 
348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 
388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 
428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 
448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 
468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 
488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 
508 509 510 511 512 513 514 515 516 51
 7 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 
537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 
557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 
577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 
597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 
617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 
637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 
657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 
677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 
697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 
717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 
737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 
757 758 759 760 761 762 763 764 765 766
  767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 
786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 
806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 
826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 
846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 
866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 
886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 
906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 
926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 
946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 
966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 
986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 
1004 1005 1006 1007 1008 1009 1010
+POSTHOOK: type: ABORT TRANSACTIONS

Reply via email to