the logic to Abort transactions that have stopped heartbeating is in
This is only called when DbTxnManger.getValidTxns() is called.
So if there is a lot of txns that need to be timed out and the there are not SQL clients talking to the system, there is nothing to abort dead transactions, and thus compaction can't clean them up so garbage accumulates in the system.
Also, streaming api doesn't call DbTxnManager at all.
Need to move this logic into Initiator (or some other metastore side thread).
Also, make sure it is broken up into multiple small(er) transactions against metastore DB.
Also more timeOutLocks() locks there as well.
see about adding TXNS.COMMENT field which can be used for "Auto aborted due to timeout" for example.
The symptom of this is that the system keeps showing more and more Open transactions that don't seem to ever go away (and have no locks associated with them)