Skip to content

Wiki: do not set default branch

John Cai requested to merge jc-wiki-dont-call-writeref into master

What does this MR do and why?

#353935 (closed) uncovered an underlying bug in rails where snippet creation called gitaly's WriteRef RPC in a racy way. This was fixed by adding a parameter to gitaly such that rails can pass in a default branch to gitaly upon repository creation, removing the need for an extra call to WriteRef to set the branch HEAD points to.

In !82731 (merged), we fix snippets to get rid of the extra call to WriteRef.

Turns out wikis also make a call to WriteRef to set the default branch. This is not exactly the same problem as snippets since for wikis its done synchronously. However, this still ends up being an extra RPC call we can save.

How to set up and validate locally

  1. Set a default branch https://docs.gitlab.com/ee/user/project/repository/branches/default.html#change-the-default-branch-name-for-an-instance-or-group
  2. create a new project
  3. create a new wiki page
  4. confirm the wiki's repository is on the default branch in the rails console:
Project.find(<project_id>).wiki.repository.root_ref

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by John Cai

Merge request reports