Skip to content
代码片段 群组 项目
提交 7324229b 编辑于 作者: Manoj M J's avatar Manoj M J
浏览文件

Add relaxed sharding keys for vulnerability_management

Add relaxed sharding keys for feature category `vulnerability_management`.

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 "relaxed" sharding key has been automatically selected for these tables, referencing either `projects` or `namespaces`, or a combination of both.

The term "relaxed" is used because:

- normally, a sharding key needs to have a NOT NULL constraint on the database.
- But, "relaxed" sharding keys do not have NOT NULL constraints. However, we have verified via database-lab that these
  columns do not contain any NULL values across any rows in the table.

This means that while the NOT NULL constraint is missing, the data itself is clean, so we can always add a NOT NULL constraint after the classification of these tables are completed.

Reviwer, 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 `@manojmj` or `@tigerwnz`.

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::DetermineRelaxedShardingKey keep.

To provide feedback on your experience with `gitlab-housekeeper` please comment in
<https://gitlab.com/gitlab-org/gitlab/-/issues/442003>.

Changelog: other
上级 74014e2e
No related branches found
No related tags found
无相关合并请求
......@@ -7,4 +7,13 @@ feature_categories:
description: Stores metadata about exported Vulnerabilities CSV files
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/27196
milestone: '13.0'
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
group_id: namespaces
......@@ -38,7 +38,8 @@
'sprints.group_id',
'subscription_add_on_purchases.namespace_id', # https://gitlab.com/gitlab-org/gitlab/-/issues/444338
'temp_notes_backup.project_id', # https://gitlab.com/gitlab-org/gitlab/-/issues/443667'
*['todos.project_id', 'todos.group_id']
*['todos.project_id', 'todos.group_id'],
*['vulnerability_exports.project_id', 'vulnerability_exports.group_id']
]
end
......
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册