From 54ec24bb31ae92b19a8237d8aedd275bbd43870c Mon Sep 17 00:00:00 2001 From: Manoj M J <mmj@gitlab.com> Date: Mon, 25 Mar 2024 14:03:34 +0100 Subject: [PATCH] Add sharding keys for error_tracking Add sharding keys for feature category `error_tracking`. These tables have been identified as [cell local tables](https://docs.gitlab.com/ee/development/database/multiple_databases.html#guidelines-on-choosing-between-gitlab_main_cell-and-gitlab_main_clusterwide-schema). All cell local tables require a [sharding key](https://docs.gitlab.com/ee/development/database/multiple_databases.html#defining-a-sharding-key-for-all-cell-local-tables). A sharding key has been automatically selected for these tables. The sharding key was chosen because it is a `NOT NULL` column referencing either `projects` or `namespaces`. Additionally, `gitlab_schema` has been set to `gitlab_main_cell` for any tables that didn't use this schema already. For these tables we have also added `allow_cross_joins`, `allow_cross_transactions` and `allow_cross_foreign_keys`. These will silence any existing violations, allowing the pipeline to pass without requiring further changes. In the future, we'll remove these `allow_...` statements and fix any violations as they arise. You can read more about this in the [documentation for multiple databases](https://docs.gitlab.com/ee/development/database/multiple_databases.html). We have assigned a random backend engineer from ~"" to review these changes. Please confirm that each table should indeed be cell local, and that the selected column is an appropriate sharding key. When you are finished, please request a review from the database maintainer suggested by Danger. If you have any questions or concerns, reach out to @tigerwnz or @DylanGriffith. If you would like to go through similar merged MRs so as to gather an understanding on this topic, you can use [this](https://gitlab.com/gitlab-org/gitlab/-/merge_requests?scope=all&state=merged&label_name[]=automation%3Agitlab-housekeeper-authored) link. This change was generated by [gitlab-housekeeper](https://gitlab.com/gitlab-org/gitlab/-/tree/master/gems/gitlab-housekeeper) using the Keeps::DetermineShardingKeyFeatureCategory keep. To provide feedback on your experience with `gitlab-housekeeper` please comment in <https://gitlab.com/gitlab-org/gitlab/-/issues/442003>. Changelog: other --- db/docs/error_tracking_client_keys.yml | 10 +++++++++- db/docs/error_tracking_errors.yml | 10 +++++++++- db/docs/project_error_tracking_settings.yml | 10 +++++++++- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/db/docs/error_tracking_client_keys.yml b/db/docs/error_tracking_client_keys.yml index 81fc55a197c28..c7e288d97b31b 100644 --- a/db/docs/error_tracking_client_keys.yml +++ b/db/docs/error_tracking_client_keys.yml @@ -7,4 +7,12 @@ feature_categories: description: Model to store public keys used by Sentry SDK for Error Tracking introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/66466 milestone: '14.2' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell +allow_cross_joins: +- gitlab_main_clusterwide +allow_cross_transactions: +- gitlab_main_clusterwide +allow_cross_foreign_keys: +- gitlab_main_clusterwide +sharding_key: + project_id: projects diff --git a/db/docs/error_tracking_errors.yml b/db/docs/error_tracking_errors.yml index f42f248dad769..b0e5603f40f80 100644 --- a/db/docs/error_tracking_errors.yml +++ b/db/docs/error_tracking_errors.yml @@ -7,4 +7,12 @@ feature_categories: description: Persists error data for the Error Tracking's GitLab backend introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/64712 milestone: '14.1' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell +allow_cross_joins: +- gitlab_main_clusterwide +allow_cross_transactions: +- gitlab_main_clusterwide +allow_cross_foreign_keys: +- gitlab_main_clusterwide +sharding_key: + project_id: projects diff --git a/db/docs/project_error_tracking_settings.yml b/db/docs/project_error_tracking_settings.yml index 5bfc278a20601..e2e1f05ca56ca 100644 --- a/db/docs/project_error_tracking_settings.yml +++ b/db/docs/project_error_tracking_settings.yml @@ -7,4 +7,12 @@ feature_categories: description: Project settings related to Error Tracking introduced_by_url: https://gitlab.com/gitlab-org/gitlab-foss/-/merge_requests/24047 milestone: '11.7' -gitlab_schema: gitlab_main +gitlab_schema: gitlab_main_cell +allow_cross_joins: +- gitlab_main_clusterwide +allow_cross_transactions: +- gitlab_main_clusterwide +allow_cross_foreign_keys: +- gitlab_main_clusterwide +sharding_key: + project_id: projects -- GitLab