Skip to content

Prepare indexes on events for bigint column conversions

Krasimir Angelov requested to merge 288005-events-indexes-async-creation into master

What does this MR do?

This MR enqueues async creation for the indexes that will be needed to convert events.id to bigint - !64779 (merged).

This is done to prevent the actual column swap migration running for an excessive length of time.

Database migrations

Up

$ bundle exec rails db:migrate:up VERSION=20210817024335
== 20210817024335 PrepareIndexesForEventsBigintConversion: migrating ==========
-- index_exists?("events", :id_convert_to_bigint, {:unique=>true, :name=>:index_events_on_id_convert_to_bigint, :algorithm=>:concurrently})
   -> 0.0050s
-- add_index_options("events", :id_convert_to_bigint, {:unique=>true, :name=>:index_events_on_id_convert_to_bigint, :algorithm=>:concurrently})
   -> 0.0000s
-- index_exists?("events", [:project_id, :id_convert_to_bigint], {:name=>:index_events_on_project_id_and_id_convert_to_bigint, :algorithm=>:concurrently})
   -> 0.0035s
-- add_index_options("events", [:project_id, :id_convert_to_bigint], {:name=>:index_events_on_project_id_and_id_convert_to_bigint, :algorithm=>:concurrently})
   -> 0.0000s
-- index_exists?("events", [:project_id, :id_convert_to_bigint], {:order=>{:id_convert_to_bigint=>:desc}, :where=>"action = 7", :name=>:index_events_on_project_id_and_id_bigint_desc_on_merged_action, :algorithm=>:concurrently})
   -> 0.0034s
-- add_index_options("events", [:project_id, :id_convert_to_bigint], {:order=>{:id_convert_to_bigint=>:desc}, :where=>"action = 7", :name=>:index_events_on_project_id_and_id_bigint_desc_on_merged_action, :algorithm=>:concurrently})
   -> 0.0000s
== 20210817024335 PrepareIndexesForEventsBigintConversion: migrated (0.0417s) =

Down

$ bundle exec rails db:migrate:down VERSION=20210817024335
== 20210817024335 PrepareIndexesForEventsBigintConversion: reverting ==========
== 20210817024335 PrepareIndexesForEventsBigintConversion: reverted (0.0151s) =

How to setup and validate locally (strongly suggested)

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

Does this MR contain changes to processing or storing of credentials or tokens, authorization and authentication methods or other items described in the security review guidelines? If not, then delete this Security section.

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team

Related to #288005 (closed)

Edited by Krasimir Angelov

Merge request reports

Loading