From 6f2d9b1b30cec6041d14bc1169c1f68d7f3feb05 Mon Sep 17 00:00:00 2001 From: Vasilii Iakliushin Date: Wed, 23 Jul 2025 11:43:13 +0200 Subject: [PATCH] Add sharding key for `push_rules` Contributes to https://gitlab.com/gitlab-org/gitlab/-/issues/490488 After migrating group and organization specific push rules to separate tables: * https://gitlab.com/gitlab-org/gitlab/-/issues/498935 * https://gitlab.com/gitlab-org/gitlab/-/issues/498939 push rules table will be responsible for project push rules. It allow us to set a sharding key per project. Added a temporary exclusion for NOT NULL check until https://gitlab.com/groups/gitlab-org/-/epics/16895 is finished. --- db/docs/push_rules.yml | 3 ++- spec/lib/gitlab/database/sharding_key_spec.rb | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/db/docs/push_rules.yml b/db/docs/push_rules.yml index 8b9d9407fd3472..ba5c3a988005e3 100644 --- a/db/docs/push_rules.yml +++ b/db/docs/push_rules.yml @@ -8,5 +8,6 @@ description: TODO introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/commit/1b98b5ab97ce3e9997df542059cbf3c6ce0bf0e1 milestone: '8.10' gitlab_schema: gitlab_main_cell -sharding_key_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/490488 table_size: small +sharding_key: + project_id: projects diff --git a/spec/lib/gitlab/database/sharding_key_spec.rb b/spec/lib/gitlab/database/sharding_key_spec.rb index 393e8dd779836a..aeafd041938d5d 100644 --- a/spec/lib/gitlab/database/sharding_key_spec.rb +++ b/spec/lib/gitlab/database/sharding_key_spec.rb @@ -29,6 +29,7 @@ *['labels.project_id', 'labels.group_id'], # https://gitlab.com/gitlab-org/gitlab/-/issues/434356 'member_roles.namespace_id', # https://gitlab.com/gitlab-org/gitlab/-/issues/444161 *['todos.project_id', 'todos.group_id'], + 'push_rules.project_id', *uploads_and_partitions ] end -- GitLab