Namespace api find un-replicated namespace from primary DB

What does this MR do and why?

For issue https://gitlab.com/gitlab-org/customers-gitlab-com/-/issues/9808+

Gitlab.com trial has a create group flow. In this flow, the Customer create a new group, and passing the group.id to CustomersDot API to create the trial. CustomersDot API will find the namespace data by calling GitLab namespace API, using the group ID. Sometimes the Gitlab database has a delay to replicate from primary DB to replicate DB. In this case, when CustomersDot find the namespace data using Gitlab namespace API, there is a chance the newly created group is not found in replication DB in Gitlab. This causes 404 not found error.

This MR stick the namespace ID when the new group is created in the create group trial flow. Then in Gitlab namespace API, it query the namespace from up-to-date replica DB(or primary DB). This ensures the newly created group be found correctly.

References

Please include cross links to any resources that are relevant to this MR. This will give reviewers and future readers helpful context to give an efficient review of the changes introduced.

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

Trial with create group fail, due to namespace not found

image.png

Trial with create group succeed.

image

How to set up and validate locally

  1. Enable database load balancing feature in GDK, following this documentation. Especially make sure to Simulating replication delay
  2. Start Gitlab application and CustomersDot application
  3. In Gitlab application, create a new group, go to group billing page
My local test result

image

  1. On group billing page, click the button Start free trial of GitLab Ultimate and GitLab Duo Enterprise, fill in required data, and click Continue button
My local test result

image

  1. Select create group, and click Activate my trial. It should succeed.
My local test result

image

image

image

  1. Switch to master branch, repeat the same test in step 3/4/5, the trial creation failed due to namespace not found.
My local test result

image

image

image

Edited by Qingyu Zhao

Merge request reports

Loading