Versions Compared

Key

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

...

For every read request involving table/partitions, HMS client need to pass a validWriteIdList string in addition to the existing arguments. validWriteIdList can be null if it is external table, as HMS will return whatever in the cache for external table using eventual consistency. But if validWriteIdList=null for managed table, HMS will throw exception. 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:


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

...


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


Optionally, HMS client can set readonly flag in commit transaction request if this is a readonly transaction. This will save a db fetch for HMS for readonly query.