Skip to content

Finish column swap for self-hosted installs

Jon Jenkins requested to merge 389344-migrate-sent-bigint-self-install into master

What does this MR do and why?

Finishes sent_notifications id column swap for self-hosted customers.

We need to be careful about the state of the database, so I will try to document what we have so far as well as what needs done.

Sent notifications migration timeline

  • 2023-01-30-A In regular migration call initialize_conversion_of_integer_to_bigint for all platforms - net effect is creation of id_convert_to_bigint on sent notifications and creation of copy trigger
  • 2023-01-30-B In post migration call backfill_conversion_of_integer_to_bigint, queues background migration to copy IDs to bigint columns, all platforms
  • 2023-03-15 In post migration for com, dev or test but not jihu, call ensure_batched_background_migration_is_finished
  • 2023-03-17 In post migration for com, dev or test but not jihu, call prepare_async_index
  • 2023-03-28 In post migration for com, dev or test but not jihu, swap columns
  • 2023-04-11 In post migration for com, dev or test but not jihu, cleanup, net effect is the id_convert_to_bigint column is dropped

Proposed Actions

Therefore, for self-managed, we need:

  1. To ensure that the BBM is finished
  2. Add index on id_convert_to_bigint concurrently
  3. Swap columns
  4. Cleanup (should drop vestigial id_convert_to_bigint)

My assessment is that self-hosted installs have databases that have triggers, id swap columns, and presumably after a couple of months the requisite backfill has had time to finish. Since we're not using async index creation, there is no long-running process to work around, therefore we should be able to finish this with a single MR. This also brings self-hosted DB's back in line with structure.sql, at least as far as sent_notifications is concerned.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Related to #389344 (closed)

Edited by Jon Jenkins

Merge request reports