Skip to content

Schedule removal of index events on project id and id desc

What does this MR do and why?

Remove index events on project id and id desc

This commit schedules removal of index index_events_on_project_id_and_id_desc_on_merged_action asynchronously

Changelog: performance

In #415091 (closed) we found out that index_events_on_project_id_and_id_desc_on_merged_action is longer used. So to remove this index we need to follow process mentioned here: https://docs.gitlab.com/ee/development/database/adding_database_indexes.html#drop-indexes-asynchronously

In this MR we are doing step 1 which is to schedule the index to be removed: https://docs.gitlab.com/ee/development/database/adding_database_indexes.html#schedule-the-index-to-be-removed

Migration Logs

rake db:migrate
main: == [advisory_lock_connection] object_id: 228860, pg_backend_pid: 63268
main: == 20230619072744 RemoveIndexEventsOnProjectIdAndIdDescOnMergedAction: migrating
main: -- index_exists?(:events, [:project_id, :id], {:order=>{:id=>:desc}, :where=>"action = 7", :name=>"index_events_on_project_id_and_id_desc_on_merged_action"})
main:    -> 0.1159s
main: -- quote_column_name("index_events_on_project_id_and_id_desc_on_merged_action")
main:    -> 0.0000s
main: == 20230619072744 RemoveIndexEventsOnProjectIdAndIdDescOnMergedAction: migrated (0.1379s)

main: == [advisory_lock_connection] object_id: 228860, pg_backend_pid: 63268
ci: == [advisory_lock_connection] object_id: 229140, pg_backend_pid: 63272
ci: == [advisory_lock_connection] object_id: 229140, pg_backend_pid: 63272

rake db:rollback:main
main: == [advisory_lock_connection] object_id: 228600, pg_backend_pid: 61891
main: == 20230619072744 RemoveIndexEventsOnProjectIdAndIdDescOnMergedAction: reverting
main: == 20230619072744 RemoveIndexEventsOnProjectIdAndIdDescOnMergedAction: reverted (0.1161s)

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 #415091 (closed)

Edited by Harsimar Sandhu

Merge request reports