Hive supports transactions by setting the correct parameters.

To enable transactions, the following configurations need to be set.

These configuration parameters must be set appropriately to turn on transaction support in Hive:

  • hive.support.concurrency – true
  • hive.enforce.bucketing – true
  • hive.exec.dynamic.partition.mode – nonstrict
  • hive.txn.manager – org.apache.hadoop.hive.ql.lockmgr.DbTxnManager
  • hive.compactor.initiator.on – true on thrift metastore instance
  • hive.compactor.worker.threads – 10 for thrift metastore instance

Use this specific table format:

 CREATE TABLE table_one (
keyField
valueFieldOne
valueFieldTwo
int,
string,
string
)
CLUSTERED BY (keyField) INTO x BUCKETS
STORED AS orc
TBLPROPERTIES('transactional' = 'true');