Skip to content

Support multiple transactions over a single update-ref process

Sami Hiltunen requested to merge smh-long-lived-update-ref into master

Gitaly's update-ref wrapper closes after performing a single transaction. This is not ideal in the context of applying a write-ahead log. With each repository having a single goroutine writing into it, it is wasteful to start and stop an update-ref process separately for each log entry. This commit changes the Updater to support running multiple transaction over it. Start transaction needs to be explicitly called prior to performing any updates. Committing a transaction no longer automatically closes the updater. The caller is responsible for calling Cancel once it is done with the process.

Since the calling conventions changed, all of the call sites were updated to explicitly start a transaction and to close the updater after use. Cleaner was changed to instantiate the update-ref process in the method where it is used to make it easy to ensure the process is always cleaned up at the end.

Closes #4630 (closed)

Merge request reports