Skip to content

Draft: Async remove: `index_audit_events_on_entity_id_and_entity_type_a...`

What does this MR do and why?

This index was originally meant to be removed as part of the Cleanup audit_event_group_rollup Feature Flag MR

However, it was pointed out in this thread that I made a mistake in that migration by using unprepare_async_index_by_name rather than prepare_async_index_removal.

This commit intends to correct that mistake

postgres_async_indexes after migration header
image

Migration output

bundle exec rails db:migrate
main: == [advisory_lock_connection] object_id: 183480, pg_backend_pid: 430416
main: == 20240117040820 RemoveAuditEventsGroupIndexAgain: migrating =================
main: -- index_exists?(:audit_events, [:entity_id, :entity_type, :created_at, :id], {:name=>"index_audit_events_on_entity_id_and_entity_type_and_created_at"})
main:    -> 0.0051s
main: -- quote_column_name("index_audit_events_on_entity_id_and_entity_type_and_created_at")
main:    -> 0.0000s
main: == 20240117040820 RemoveAuditEventsGroupIndexAgain: migrated (0.0148s) ========

main: == [advisory_lock_connection] object_id: 183480, pg_backend_pid: 430416
ci: == [advisory_lock_connection] object_id: 183740, pg_backend_pid: 430418
ci: == 20240117040820 RemoveAuditEventsGroupIndexAgain: migrating =================
ci: -- index_exists?(:audit_events, [:entity_id, :entity_type, :created_at, :id], {:name=>"index_audit_events_on_entity_id_and_entity_type_and_created_at"})
ci:    -> 0.0030s
ci: -- quote_column_name("index_audit_events_on_entity_id_and_entity_type_and_created_at")
ci:    -> 0.0000s
ci: == 20240117040820 RemoveAuditEventsGroupIndexAgain: migrated (0.0104s) ========

ci: == [advisory_lock_connection] object_id: 183740, pg_backend_pid: 430418
bundle exec rails db:migrate:down:main VERSION=20240117040820
main: == [advisory_lock_connection] object_id: 183060, pg_backend_pid: 428800
main: == 20240117040820 RemoveAuditEventsGroupIndexAgain: reverting =================
main: == 20240117040820 RemoveAuditEventsGroupIndexAgain: reverted (0.0025s) ========

main: == [advisory_lock_connection] object_id: 183060, pg_backend_pid: 428800
bundle exec rails db:migrate:down:ci VERSION=20240117040820
ci: == [advisory_lock_connection] object_id: 183000, pg_backend_pid: 429200
ci: == 20240117040820 RemoveAuditEventsGroupIndexAgain: reverting =================
ci: == 20240117040820 RemoveAuditEventsGroupIndexAgain: reverted (0.0075s) ========

ci: == [advisory_lock_connection] object_id: 183000, pg_backend_pid: 429200

Changelog: removed

How to set up and validate locally

  1. follow the steps from the docs

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 #418184

Edited by Michael Becker

Merge request reports