Shard spam_logs table
Action Required: Classify the spam_logs table
To properly configure the spam_logs table, please choose the one classification below that best fits its data and purpose. This choice will determine the table's database schema and sharding key.
After selecting the best option, remove the sharding_key_issue_url and apply the corresponding configuration.
1. Choose a Classification
Select the most suitable option for the spam_logs table from the following:
A. Org-level with sharding key
This is for data that belongs to an entire organization.
-
Action:
- Set
gitlab_schema: gitlab_main_cell. - Add the
sharding_keyordesired_sharding_key. - If the key doesn't yet meet
not-nullor foreign key requirements, you can add a temporary exception. Please link to a follow-up issue in a comment next to the exception. -
See an example at
db/docs/epics.yml.
- Set
2. Complete the Task
- Add this issue to the epic: &11670
- Review the documentation below for more details.
Documentation
Tasks
-
Add organization_idtospam_logstable !207058 (merged) -
Enforce a foreign key constraint on spam_logs.user_idand clean up orphan rows !212667 (merged) -
Add NOT NULLconstraint tospam_logs.user_id!212667 (merged) !214701 -
Add foreign key constraint to spam_logs.user_idand removespam_logsrecords referencing non-existentusers.id!212667 (merged) !214701 -
Backfill organization_idviaspam_logs.user_id!210030 (closed) !212438 -
Add NOT NULLconstraints toorganization_id!212438 -
Add sharding_key:configuration tospam_logs.ymltable definition.
Edited by mo khan