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.

How to Update records in a Hive table concurrently?

Solved Go to solution

How to Update records in a Hive table concurrently?

New Contributor

I am trying to update two different records of an ACID transaction enabled hive table in two different sessions but getting a lockException showing write conflict. Is there any configuration parameter in Hive.

1 ACCEPTED SOLUTION

Accepted Solutions

Re: How to Update records in a Hive table concurrently?

@Harish Nerella

This scenario on updating a table (even two different rows) by two different processes at the same time is not possible at the moment for ACID tables.

Currently, ACID concurrency management mechanism works at a partition level for partitioned tables and table level for non partitioned (which I believe is our case). Basically what the system wants to prevent is 2 parallel transactions updating the same row. Unfortunately, it can't keep track of this at individual row level, it does it at partition and table level respectively.

Refer Jira HIVE-13395 for more details.

4 REPLIES 4

Re: How to Update records in a Hive table concurrently?

Contributor

@Harish Nerella

If a table is to be used in ACID writes (insert, update, delete) then the table property "transactional=true" must be set on that table.Also, hive.txn.manager must be set to org.apache.hadoop.hive.ql.lockmgr.DbTxnManager either in hive-site.xml or in the beginning of the session before any query is run.

Refer https://cwiki.apache.org/confluence/display/Hive/Hive+Transactions for more details.

Re: How to Update records in a Hive table concurrently?

New Contributor

Thank you for your answer.

I did set all the ACID Transaction related configurations in both the sessions but still I am getting a write conflict. And caveat is if I am executing the update statement in sequential way (after completion of a query which is running in other session) it is allowing me to update.

Re: How to Update records in a Hive table concurrently?

@Harish Nerella

This scenario on updating a table (even two different rows) by two different processes at the same time is not possible at the moment for ACID tables.

Currently, ACID concurrency management mechanism works at a partition level for partitioned tables and table level for non partitioned (which I believe is our case). Basically what the system wants to prevent is 2 parallel transactions updating the same row. Unfortunately, it can't keep track of this at individual row level, it does it at partition and table level respectively.

Refer Jira HIVE-13395 for more details.

Re: How to Update records in a Hive table concurrently?

New Contributor

Thank You. This helped.