Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

All other components invoking HMS API directly (bypass Hive.java) will be changed to invoke the newer HMS API. This includes HCatalog, Hive streaming, etc, and other projects using HMS client such as Impala.

For every read/write request involving table/partitions, HMS client need to pass a validWriteIdList string in addition to the existing arguments. validWriteIdList is a serialized form of ValidReaderWriteIdList (https://github.com/apache/hive/blob/master/storage-api/src/java/org/apache/hadoop/hive/common/ValidReaderWriteIdList.java#L119). Usually ValidReaderWriteIdList can be obtained from HiveTxnManager(https://github.com/apache/hive/blob/master/ql/src/java/org/apache/hadoop/hive/ql/lockmgr/HiveTxnManager.java) using the following code snippet:

ValidTxnList txnIds = txnMgr.getValidTxns(); // get global transaction state

txnWriteIds = txnMgr.getValidWriteIds(txnTables, txnString); // map global transaction state to table specific write id

Use cases

Write

Hive needs to pass a ValidWriteIdList for every metastore write operation (table/partition). CachedStore will store ValidWriteIdList along with the entry in cache. Every Hive query (either DDL or DML) will retrieve a ValidWriteIdList at the beginning of the query. Let’s look at some examples.

...