Allow RPC handler to manually clean up a transaction's snapshot
Each transaction has their own snapshot that is cleaned up after the transaction is cleaned up. The snapshot is currently either cleaned up by the client goroutine or the TransactionManager
itself depending on whether the transaction was admitted for processing by the TransactionManager
:
- The client goroutine cleans up the snapshot here if it wasn't yet admitted by the TransactionManager for processing.
- The
TransactionManager
cleans up the snapshot after it is done with a transaction it was processing here.
This is an issue with *ReceivePack
RPC handlers when using proc-receive
hook (#5991). The transaction needs to be committed while receive-pack
is still running before we can report back whether a given reference update is successful. Committing the transaction removes the working directory (the transaction's snapshot of the repository) of the receive-pack
command which causes a failure.
We should extend the TransactionManager
to allow manual clean up of the snapshot to accommodate for this.