Hive Transaction

Posted on 2018-07-11 21:57:00

Hive Transaction

http://www.aboutyun.com/thread-21615-1-1.html

好文章

Hive从0.13开始加入了事务支持,在行级别提供完整的ACID特性,Hive在0.14时加入了对INSERT...VALUES,UPDATE,and DELETE的支持。对于在Hive中使用ACID和Transactions,主要有以下限制:

为了使Hive支持事务操作,需将以下参数加入到hive-site.xml文件中。

<property>

<name>hive.support.concurrency</name>

<value>true</value>

</property>

<property>

<name>hive.enforce.bucketing</name>

<value>true</value>

</property>

<property>

<name>hive.exec.dynamic.partition.mode</name>

<value>nonstrict</value>

</property>

<property>

<name>hive.txn.manager</name>

<value>org.apache.hadoop.hive.ql.lockmgr.DbTxnManager</value>

</property>

<property>

<name>hive.compactor.initiator.on</name>

<value>true</value>

</property>

<property>

<name>hive.compactor.worker.threads </name>

<value>1</value>

</property>

当hive.support.concurrency=True,就会共享锁和排它锁出现干预查询

hive未配置Transaction和ACID,不支持delete和update操作

create table test_trancaction
(user_id Int,name String)
clustered by (user_id) into 3 buckets stored as orc TBLPROPERTIES ('transactional'='true');