Add a batch migration to populate detumbled_email in emails table

What does this MR do and why?

Related to https://gitlab.com/gitlab-org/modelops/anti-abuse/team-tasks/-/work_items/828

This MR adds a background migration to populate the detumbled_email column that was introduced in !159658 (merged)

New email records are now automatically setting the detumbled_email attribute before save. This was introduced in !161663 (merged) and the feature flag was removed in !163556 (merged)

This migration is expected to update 16,882,924 records.

[ gprd ] production> Email.where(detumbled_email: nil).count
=> 16882924

Estimated duration based on this equation

interval * number of records / max batch
2 minutes * 16882924 / 10000 ≈ 3376.58 minutes or 2 days 8 hours 

Query Plans

Update query: https://console.postgres.ai/shared/fc4c569c-8658-4627-b7f1-3d1dab76709e

Batch selection: https://console.postgres.ai/gitlab/gitlab-production-main/sessions/31205/commands/96916

MR acceptance checklist

Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Screenshots or screen recordings

Screenshots are required for UI changes, and strongly recommended for all other merge requests.

Before After

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

Edited by Ian Anderson

Merge request reports

Loading