Skip to content

Remove orphan project bots

What does this MR do and why?

Removes orphaned project bots for groups which were deleted.

Migration output

main: == 20220921144258 RemoveOrphanGroupTokenUsers: reverting ======================
main: == 20220921144258 RemoveOrphanGroupTokenUsers: reverted (0.0005s) =============

main: == 20220920135356 TiebreakUserTypeIndex: reverting ============================
main: -- transaction_open?()
main:    -> 0.0000s
main: -- index_exists?(:users, :user_type, {:name=>"index_users_on_user_type", :algorithm=>:concurrently})
main:    -> 0.0131s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0002s
main: -- add_index(:users, :user_type, {:name=>"index_users_on_user_type", :algorithm=>:concurrently})
main:    -> 0.0022s
main: -- execute("RESET statement_timeout")
main:    -> 0.0004s
main: -- transaction_open?()
main:    -> 0.0000s
main: -- indexes(:users)
main:    -> 0.0107s
main: -- remove_index(:users, {:algorithm=>:concurrently, :name=>"index_users_on_user_type_and_id"})
main:    -> 0.0027s
main: == 20220920135356 TiebreakUserTypeIndex: reverted (0.0384s) ===================

main: == 20220920135356 TiebreakUserTypeIndex: migrating ============================
main: -- transaction_open?()
main:    -> 0.0000s
main: -- index_exists?(:users, [:user_type, :id], {:name=>"index_users_on_user_type_and_id", :algorithm=>:concurrently})
main:    -> 0.0123s
main: -- execute("SET statement_timeout TO 0")
main:    -> 0.0002s
main: -- add_index(:users, [:user_type, :id], {:name=>"index_users_on_user_type_and_id", :algorithm=>:concurrently})
main:    -> 0.0021s
main: -- execute("RESET statement_timeout")
main:    -> 0.0003s
main: -- transaction_open?()
main:    -> 0.0000s
main: -- indexes(:users)
main:    -> 0.0136s
main: -- remove_index(:users, {:algorithm=>:concurrently, :name=>"index_users_on_user_type"})
main:    -> 0.0021s
main: == 20220920135356 TiebreakUserTypeIndex: migrated (0.0355s) ===================

main: == 20220921144258 RemoveOrphanGroupTokenUsers: migrating ======================
main: == 20220921144258 RemoveOrphanGroupTokenUsers: migrated (0.0178s) =============

Migration estimates:

Less that 100k project bots in total. Few hundreds of tokens and users to be removed. More info in db migration job.

Query plans

Select batch https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/12267/commands/43552 Select inside batch https://console.postgres.ai/gitlab/gitlab-production-tunnel-pg12/sessions/12267/commands/43563

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

Edited by Pavel Shutsin

Merge request reports

Loading