Replace Wiki service list_pages by normal repository RPCs
What does this MR do and why?
For #357651 (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 list_pages RPC. This RPC is responsible for fetching the list of all available pages. This call is replaced by the following RPCs:
-
repository#search_files_by_regexp
: perform a search to fetch all files ending with eligible file extensions. -
repository#blobs_at
: fulfill the latest content of matched files above. -
repository#last_commit_for_path
: occasionally fetches the latest commit for path individually. This is a part of last updated date on the UI.
Those RPC replacements are not fast, but they don't make the situation worse. I did an in-depth analysis of the entry points of this RPC here: #357651 (comment 1077458464) to explain the reasons. Most of the use cases fetch a limited set of pages (20 pages maximum). The only exception is the Wiki APIs. They fetch all pages at once. I opened #371859 to follow up this performance issue.
This MR also removes the created_at sorting option on the UI in /-/wikis/pages
pages. The reason behind this removal is mentioned in #357651 (comment 1081355714). This decision was also approved by @ericschurter
, the product manager of ~"group::editor" - owner of Wiki features.
Screenshots or screen recordings
Before: the page includes sort options and sort direction
After: the page includes the sort direction only
Sort works with non-Ascii characters. Wiki pages of the same directory are grouped together
Wiki API
Wiki API with content
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.