Skip to content

Uniquify with randomized suffix to speed up unique path finding

What does this MR do and why?

When we have attempted to find a unique path more than Namespace::RandomizedSuffixPath::MAX_TRIES times we use randomized path. This is being done to speed up the process of finding a unique path for groups. We currently have certain paths that have a lot of rows due to their popularity. This currently makes us run many iterations to find the next path since we always increment by one.

This approach tries to balance the user having a short path assigned with the time it takes to find a unique path for the namespace and not obviously place a near exact created_at timestamp for the namespace in the URL.

We are doing this to address issues raised in #375629 (closed) and related slowdowns noticed when investigating gitlab-org/growth/team-tasks#675 (closed)

Screenshots or screen recordings

Screenshot_2023-01-19_at_00.15.19

Screenshot_2023-01-19_at_00.16.59

How to set up and validate locally

Example below:

  1. create a test group multiple times
    1. sign in as root and go to: http://localhost:3000/users/sign_up/groups_projects/new and create a test group 5 times
  2. you should see the slug suggested for the group path increment each additional time (e.g. test1, test2, test3, test4, test4201603)

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 Sam Figueroa

Merge request reports