Fully shard approval_merge_request_rules_users

ApprovalMergeRequestRulesUsers (large table - https://postgres.ai/console/gitlab/gitlab-production-main/sessions/41965/commands/128836)

Milestone 18.2 (required stop)

Milestone 18.3

  • finalize sharding key backfill -> !197961 (merged)
  • validate the sharding key backfill was finalized
  • add a NOT NULL (NOT VALID) constraint on sharding key for new records -> !199931 (merged)
  • prepare async constraint validation -> !200377 (merged)
  • verify the NOT NULL constraint check is set on the table's sharding key

Milestone 18.4

  • validate NOT NULL constraint on sharding key -> !200535 (merged)
  • add validate presence: true on the sharding columns in the rails model
  • update db/docs/*.yml with sharding key
  • add index on foreign key + add a foreign key constraint (NOT VALID) -> !200661 (merged)
  • verify the foreign key constraint (NOT VALID) and index are present on the table's sharding key column
  • validate foreign key constraint (ASYNC) -> !202062 (merged)
  • verify the foreign key constraint is present on the table's sharding key column
  • validate foreign key constraint (SYNC) -> !202646 (merged)
  • remove table from allowed_to_be_missing_foreign_key in spec/lib/gitlab/database/sharding_key_spec.rb -> !202032 (merged)
Edited by Tomasz Skorupa