Skip to content

Replace Wiki service find_page RPC by normal repository RPCs

What does this MR do and why?

For #357649 (closed)

In &2862 (closed), we are trying to get rid of ruby sidecar inside Gitaly. The ruby sidecar is responsible for some hard-to-migrate when we invented Gitaly long before. One of a particular feature handled by Ruby sidecar is Wiki service. When GitLab Rails requests any Wiki-related data from Gitaly, it triggers a Wiki RPC call. This call is handled by Gitaly, but it instantly forwards to a Ruby gRPC server inside Gitaly. Eventually, the call is handled by Ruby. Underlying, the whole Wiki service is handled by Gollum. This gem structures Wiki data as a Git directory. Therefore, it makes a lot of sense to let Gitaly handles those business logic via normal repository RPCs.

This MR concentrates on moving the find_page RPC. This RPC is responsible for fetching an in individual page by its title/slug. To fulfill this duty, it performs the following RPCs:

  • repository#search_files_by_regexp to fetch the first matched eligible wiki pages. As a user can push anything to the wiki repository, we imply the underlying file path from the title/slug, and append the list of valid extensions.
  • repository#blob_at to get the information of a page from the blob. Just because the above RPC doesn't include blob info.
  • repository#repository.commit to get missing information of the page, such as author, or last updated at.
  • repository#last_commit_for_path to check whether the current page is at latest version. This code path is executed only whenever users view a historical page.

I created a detailed analysis from performance perspective in this thread: #357649 (comment 1065678396). Overall, this change won't affect the performance of the system.

This replacement is behind the feature flag: #371487 (closed)

Screenshots or screen recordings

This feature does not affect users. In fact, that's the whole point of this replacement initiative. I did some manual test to ensure everything works as before.

View home page

Screen_Shot_2022-08-30_at_15.21.04

View page history

Screen_Shot_2022-08-30_at_15.21.10

View a historical page

Screen_Shot_2022-08-30_at_15.23.17

View a non-ASCII title page

Screen_Shot_2022-08-30_at_15.21.28

View file in a sub-folder

Screen_Shot_2022-08-30_at_15.22.19

/api/v4/project/:id/wikis/:slug

Screen_Shot_2022-08-30_at_15.24.33

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

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 Quang-Minh Nguyen

Merge request reports

Loading