Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

ACID TRANSACTIONS HIVE

ACID TRANSACTIONS HIVE

New Contributor

Good Morning. I am doing a small example with ACID TRANSACTIONS HIVE. My environment is Oracle VM virtual Box 6.0 Hive 1.1.0-cdh5.13.0 I indicate the steps I have taken: 

 

1.JPG


I create the 'scenariox2' table as follows:

 

2.JPG



I insert data correctly: INSERT INTO scenariox2 values ​​(1, 'hello'); I make an alter table to allow transactions And I query correctly

 

3.JPG

 


The problem is: It doesn't let me update data. The update statement gives me the error 10294

 

 

4.JPG

 

Can anyone help me? Thank you very much for your time
2 REPLIES 2
Highlighted

Re: ACID TRANSACTIONS HIVE

Super Guru

Change the transaction manager to org.apache.hadoop.hive.ql.lockmgr.DbTxnManager then try to run your update query.

 

Run this command in hive shell:

 

--creating hive table with transaction enabled.
CREATE TABLE table_name (
  id                int,
  name              string
)
CLUSTERED BY (id) INTO 2 BUCKETS STORED AS ORC
TBLPROPERTIES ("transactional"="true");

--changing transaction manager
set hive.txn.manager =org.apache.hadoop.hive.ql.lockmgr.DbTxnManager;

--insert data into table
insert into table_name values(1,"a"),(2,"b");

--update data in the table
update table_name set name="c" where id =1;

--delete specific id from table
delete from table_name where id=1;

 

 

Refer to this link for more details about transaction hive tables.

Re: ACID TRANSACTIONS HIVE

Contributor

Hi @Gerva,

 

You need to have below properties set to be able to use Hive ACID functionality:

 

hive>set hive.support.concurrency = true;
hive>set hive.enforce.bucketing = true;
hive>set hive.exec.dynamic.partition.mode = nonstrict;
hive>set hive.txn.manager = org.apache.hadoop.hive.ql.lockmgr.DbTxnManager;
hive>set hive.compactor.initiator.on = true;
hive>set hive.compactor.worker.threads = a positive number on at least one instance of the Thrift metastore service;

 

Don't have an account?
Coming from Hortonworks? Activate your account here