Skip to content
Snippets Groups Projects

Add desired sharding keys for deployment_management

1 unresolved thread

Add desired sharding keys for feature category deployment_management.

These tables have been identified as a cell local tables. All cell local tables require a sharding key or a desired sharding key

A desired sharding key has been automatically selected for these tables. These keys were chosen as the desired sharding keys because the table has a :belongs_to relationship to a table that itself has a NOT NULL sharding key.

Additionally, gitlab_schema has been set to gitlab_main_cell for any tables 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

We have assigned a random backend engineer from groupenvironments to review these changes.

Please confirm that:

  • each of these tables can be classified as cell local
  • the selected desired sharding key is appropriate
  • the backfill configuration for the desired sharding key is correct

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, @DylanGriffith or @manojmj.

If you would like to go through similar merged MRs so as to gather an understanding on this topic, you can use this link.

This change was generated by gitlab-housekeeper

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
1 1 ---
2 2 table_name: agent_activity_events
  • Author Maintainer

    @tigerwnz so this is one of the tables I talked about on Slack.

    Automation tries to create agent_activity_events.project_id as the desired sharding key, but project_id is already a null-able column on this table, so the spec fails - which is why this had to be reverted within this MR.

    https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/27242/commands/84739 says there are indeed many rows where agent_activity_events.project_id is null.

    Since this table belongs to deploy as well, I thought of asking you for advice on how to move forward: can project_id be backfilled to turn it into a non-nullable column. Or, should we put in a desired sharding key that's renamed, like, say sharding_project_id?

  • @manojmj the project_id column on this table is actually unused (it is NULL for all records). It was originally added for a feature that hasn't been implemented yet, and I'm not sure if it will ever be used.

    Even so, it might be easier to just add a new sharding key column as that way it can be handled fully via automation (and the original project_id is then available if we do decide to use it).

  • Please register or sign in to reply
  • Please register or sign in to reply
    Loading