For JTA we store the participant records with the transaction record so when the transaction has rolled back we delete the transaction and implicitly the resource that had a heuristic outcome.
For JTS we store participants separately from the transaction. When the transaction rolls back we delete the transaction. When we rollback the second resource we delete its log but when we tried to commit the first resource it did a heuristic rollback and in this case we leave the record in the store since the administrator may need to investigate.
[Edit] Actually I think the log should eventually get cleaned up. Bottom up recovery will find the xid corresponding to the log and determine that its one of ours but that there is no associated transaction so will vote rollback (this decision is made by one of the orphan filters) and then call forget on the resource. The forget will perform the removal of the log record.
I got it. Mike, thanks a lot for clarification.