Skip to content

Remove pending builds covering index

Marius Bobin requested to merge 332953-remove-pending-builds-covering-index into master

What does this MR do and why?

Related to #332953 (closed)

In %15.2 we've removed the legacy queuing mechanism based on the ci_builds table and now we can remove the index that was supporting it.

There is not usage data for this index in the last 8 weeks.

Because of gitlab-com/gl-infra/production#6821 (closed) we need to drop the index in production via a Change Request before merging this MR: gitlab-com/gl-infra/production#7477 (closed)

Screenshots or screen recordings

> bin/rails db:migrate
main: == 20220720090354 RemovePendingBuildsCoveringIndexFromCiBuilds: migrating =====
main: -- transaction_open?()
main:    -> 0.0000s
main: -- indexes(:ci_builds)
main:    -> 0.0207s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0004s
main: -- remove_index(:ci_builds, {:algorithm=>:concurrently, :name=>"index_ci_builds_runner_id_pending_covering"})
main:    -> 0.0032s
main: -- execute("RESET statement_timeout")
main:    -> 0.0003s
main: == 20220720090354 RemovePendingBuildsCoveringIndexFromCiBuilds: migrated (0.0341s)

ci: == 20220720090354 RemovePendingBuildsCoveringIndexFromCiBuilds: migrating =====
ci: -- transaction_open?()
ci:    -> 0.0000s
ci: -- indexes(:ci_builds)
ci:    -> 0.0191s
ci: -- execute("SET statement_timeout TO 0")
ci:    -> 0.0005s
ci: -- remove_index(:ci_builds, {:algorithm=>:concurrently, :name=>"index_ci_builds_runner_id_pending_covering"})
ci:    -> 0.0037s
ci: -- execute("RESET statement_timeout")
ci:    -> 0.0004s
ci: == 20220720090354 RemovePendingBuildsCoveringIndexFromCiBuilds: migrated (0.0277s)

> bin/rails db:rollback:main
main: == 20220720090354 RemovePendingBuildsCoveringIndexFromCiBuilds: reverting =====
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0004s
main: -- indexes(:ci_builds)
main:    -> 0.0184s
main: -- current_schema()
main:    -> 0.0002s
main: -- execute("CREATE INDEX CONCURRENTLY index_ci_builds_runner_id_pending_covering ON ci_builds (runner_id, id) INCLUDE (project_id) WHERE status = 'pending' AND type = 'Ci::Build'")
main:    -> 0.0057s
main: -- execute("RESET statement_timeout")
main:    -> 0.0004s
main: == 20220720090354 RemovePendingBuildsCoveringIndexFromCiBuilds: reverted (0.0293s)

> bin/rails db:rollback:ci
ci: == 20220720090354 RemovePendingBuildsCoveringIndexFromCiBuilds: reverting =====
ci: -- execute("SET statement_timeout TO 0")
ci:    -> 0.0004s
ci: -- indexes(:ci_builds)
ci:    -> 0.0187s
ci: -- current_schema()
ci:    -> 0.0004s
ci: -- execute("CREATE INDEX CONCURRENTLY index_ci_builds_runner_id_pending_covering ON ci_builds (runner_id, id) INCLUDE (project_id) WHERE status = 'pending' AND type = 'Ci::Build'")
ci:    -> 0.0061s
ci: -- execute("RESET statement_timeout")
ci:    -> 0.0003s
ci: == 20220720090354 RemovePendingBuildsCoveringIndexFromCiBuilds: reverted (0.0302s)

How to set up and validate locally

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

MR acceptance checklist

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

Edited by Marius Bobin

Merge request reports

Loading