Skip to content

Add keyset pagination for tags API

Vasilii Iakliushin requested to merge 340591_use_gitaly_pagination into master

What does this MR do and why?

It adds a keyset pagination to Tags API. Additionally it applies a Gitaly pagination to the first page of the results. It should improve the performance of the endpoint when no arguments are provided.

Screenshots or screen recordings

Without pagination Screenshot_2021-11-15_at_10.44.06
With keyset pagination Screenshot_2021-11-15_at_10.47.51

How to set up and validate locally

Feature.enable(:tag_list_keyset_pagination)
  1. Find repository with tags
  2. Send a request to: http://localhost:3000/api/v4/projects/<project_id>/repository/tags
  3. Send another request to: http://localhost:3000/api/v4/projects/<project_id>/repository/tags?pagination=keyset&page_token=<tag_name>, where tag_name is a tag from the first request.
  4. Verify that you see elements that go after the page token

For example, you have a repository with following tags:

aaa
bbb
ccc
ddd

Then the request to http://localhost:3000/api/v4/projects/<project_id>/repository/tags?pagination=keyset&page_token=bbb should return

ccc
ddd

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 Vasilii Iakliushin

Merge request reports