Skip to content

Enforce newly created tables define a sharding_key

What does this MR do and why?

Enforce newly created tables define a sharding_key.

As part of introducing Organizations to support Cells we need to ensure that all tables that are meant to be sharded across cells all map to a single organization via a sharding_key. This is described in detail in https://docs.gitlab.com/ee/architecture/blueprints/organization/isolation.html which is updated by this MR.

The basic idea is that we define a column in sharding_key that references a parent table for the record. The parent table can only be from projects, namespaces or organizations. As projects and namespaces already has an organization_id we can immediately map this parent record to a specific organization.

This MR just introduces the changes to the db/docs/*.yml file to support configuring this sharding_key and a new spec which will ensure it is set for all newly created tables.

Resolves #429163 (closed)

Resolves #429181 (closed)

Resolves #429162 (closed)

Screenshots or screen recordings

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

Before After

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.

Related to #429163 (closed)

Edited by Dylan Griffith

Merge request reports