From a303eb5d329ee4fee3ad76b9c2e32ce1d6d4a13b Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Mon, 6 Nov 2023 21:10:28 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- ...nvalid_protected_branch_merge_access_levels.yml | 7 ++++++ ...invalid_protected_branch_push_access_levels.yml | 7 ++++++ ..._invalid_protected_tag_create_access_levels.yml | 7 ++++++ ...8_add_temporary_index_to_merge_access_levels.rb | 25 +++++++++++++++++++ ...invalid_protected_branch_merge_access_levels.rb | 28 ++++++++++++++++++++++ ...26_add_temporary_index_to_push_access_levels.rb | 25 +++++++++++++++++++ ..._invalid_protected_branch_push_access_levels.rb | 28 ++++++++++++++++++++++ ..._add_temporary_index_to_create_access_levels.rb | 25 +++++++++++++++++++ ...e_invalid_protected_tag_create_access_levels.rb | 27 +++++++++++++++++++++ db/schema_migrations/20231016173128 | 1 + db/schema_migrations/20231016173129 | 1 + db/schema_migrations/20231016194926 | 1 + db/schema_migrations/20231016194927 | 1 + db/schema_migrations/20231016194942 | 1 + db/schema_migrations/20231016194943 | 1 + db/structure.sql | 6 +++++ 16 files changed, 191 insertions(+) create mode 100644 db/docs/batched_background_migrations/delete_invalid_protected_branch_merge_access_levels.yml create mode 100644 db/docs/batched_background_migrations/delete_invalid_protected_branch_push_access_levels.yml create mode 100644 db/docs/batched_background_migrations/delete_invalid_protected_tag_create_access_levels.yml create mode 100644 db/post_migrate/20231016173128_add_temporary_index_to_merge_access_levels.rb create mode 100644 db/post_migrate/20231016173129_queue_delete_invalid_protected_branch_merge_access_levels.rb create mode 100644 db/post_migrate/20231016194926_add_temporary_index_to_push_access_levels.rb create mode 100644 db/post_migrate/20231016194927_queue_delete_invalid_protected_branch_push_access_levels.rb create mode 100644 db/post_migrate/20231016194942_add_temporary_index_to_create_access_levels.rb create mode 100644 db/post_migrate/20231016194943_queue_delete_invalid_protected_tag_create_access_levels.rb create mode 100644 db/schema_migrations/20231016173128 create mode 100644 db/schema_migrations/20231016173129 create mode 100644 db/schema_migrations/20231016194926 create mode 100644 db/schema_migrations/20231016194927 create mode 100644 db/schema_migrations/20231016194942 create mode 100644 db/schema_migrations/20231016194943 (limited to 'db') diff --git a/db/docs/batched_background_migrations/delete_invalid_protected_branch_merge_access_levels.yml b/db/docs/batched_background_migrations/delete_invalid_protected_branch_merge_access_levels.yml new file mode 100644 index 00000000000..cd85f7e4ab2 --- /dev/null +++ b/db/docs/batched_background_migrations/delete_invalid_protected_branch_merge_access_levels.yml @@ -0,0 +1,7 @@ +--- +migration_job_name: DeleteInvalidProtectedBranchMergeAccessLevels +description: Remove rows from protected_branch_merge_access_levels for groups that do not have project_group_links to the project for the associated protected branch +feature_category: source_code_management +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/issues/427486 +milestone: 16.6 +queued_migration_version: 20231016173129 diff --git a/db/docs/batched_background_migrations/delete_invalid_protected_branch_push_access_levels.yml b/db/docs/batched_background_migrations/delete_invalid_protected_branch_push_access_levels.yml new file mode 100644 index 00000000000..dd92e35f26f --- /dev/null +++ b/db/docs/batched_background_migrations/delete_invalid_protected_branch_push_access_levels.yml @@ -0,0 +1,7 @@ +--- +migration_job_name: DeleteInvalidProtectedBranchPushAccessLevels +description: Remove rows from protected_branch_push_access_levels for groups that do not have project_group_links to the project for the associated protected branch +feature_category: source_code_management +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/issues/427486 +milestone: 16.6 +queued_migration_version: 20231016194927 diff --git a/db/docs/batched_background_migrations/delete_invalid_protected_tag_create_access_levels.yml b/db/docs/batched_background_migrations/delete_invalid_protected_tag_create_access_levels.yml new file mode 100644 index 00000000000..0c406c7650b --- /dev/null +++ b/db/docs/batched_background_migrations/delete_invalid_protected_tag_create_access_levels.yml @@ -0,0 +1,7 @@ +--- +migration_job_name: DeleteInvalidProtectedTagCreateAccessLevels +description: Remove rows from protected_tag_create_access_levels for groups that do not have project_group_links to the project for the associated protected tag +feature_category: source_code_management +introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/issues/427486 +milestone: 16.6 +queued_migration_version: 20231016194943 diff --git a/db/post_migrate/20231016173128_add_temporary_index_to_merge_access_levels.rb b/db/post_migrate/20231016173128_add_temporary_index_to_merge_access_levels.rb new file mode 100644 index 00000000000..0d8fbdfea00 --- /dev/null +++ b/db/post_migrate/20231016173128_add_temporary_index_to_merge_access_levels.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +class AddTemporaryIndexToMergeAccessLevels < Gitlab::Database::Migration[2.2] + disable_ddl_transaction! + milestone '16.6' + + INDEX_NAME = 'tmp_idx_protected_branch_merge_access_levels_on_id_with_group' + + def up + # Temporary index to be removed in 16.7 https://gitlab.com/gitlab-org/gitlab/-/issues/430843 + add_concurrent_index( + :protected_branch_merge_access_levels, + %i[id], + where: 'group_id IS NOT NULL', + name: INDEX_NAME + ) + end + + def down + remove_concurrent_index_by_name( + :protected_branch_merge_access_levels, + INDEX_NAME + ) + end +end diff --git a/db/post_migrate/20231016173129_queue_delete_invalid_protected_branch_merge_access_levels.rb b/db/post_migrate/20231016173129_queue_delete_invalid_protected_branch_merge_access_levels.rb new file mode 100644 index 00000000000..3f4009d783c --- /dev/null +++ b/db/post_migrate/20231016173129_queue_delete_invalid_protected_branch_merge_access_levels.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +class QueueDeleteInvalidProtectedBranchMergeAccessLevels < Gitlab::Database::Migration[2.1] + MIGRATION = "DeleteInvalidProtectedBranchMergeAccessLevels" + DELAY_INTERVAL = 2.minutes + MAX_BATCH_SIZE = 10_000 + BATCH_SIZE = 5_000 + SUB_BATCH_SIZE = 500 + + disable_ddl_transaction! + restrict_gitlab_migration gitlab_schema: :gitlab_main + + def up + queue_batched_background_migration( + MIGRATION, + :protected_branch_merge_access_levels, + :id, + job_interval: DELAY_INTERVAL, + queued_migration_version: '20231016173129', + batch_size: BATCH_SIZE, + sub_batch_size: SUB_BATCH_SIZE + ) + end + + def down + delete_batched_background_migration(MIGRATION, :protected_branch_merge_access_levels, :id, []) + end +end diff --git a/db/post_migrate/20231016194926_add_temporary_index_to_push_access_levels.rb b/db/post_migrate/20231016194926_add_temporary_index_to_push_access_levels.rb new file mode 100644 index 00000000000..91599051fd4 --- /dev/null +++ b/db/post_migrate/20231016194926_add_temporary_index_to_push_access_levels.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +class AddTemporaryIndexToPushAccessLevels < Gitlab::Database::Migration[2.2] + disable_ddl_transaction! + + milestone '16.6' + INDEX_NAME = 'tmp_idx_protected_branch_push_access_levels_on_id_with_group' + + def up + # Temporary index to be removed in 16.7 https://gitlab.com/gitlab-org/gitlab/-/issues/430843 + add_concurrent_index( + :protected_branch_push_access_levels, + %i[id], + where: 'group_id IS NOT NULL', + name: INDEX_NAME + ) + end + + def down + remove_concurrent_index_by_name( + :protected_branch_push_access_levels, + INDEX_NAME + ) + end +end diff --git a/db/post_migrate/20231016194927_queue_delete_invalid_protected_branch_push_access_levels.rb b/db/post_migrate/20231016194927_queue_delete_invalid_protected_branch_push_access_levels.rb new file mode 100644 index 00000000000..6accaa3296b --- /dev/null +++ b/db/post_migrate/20231016194927_queue_delete_invalid_protected_branch_push_access_levels.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +class QueueDeleteInvalidProtectedBranchPushAccessLevels < Gitlab::Database::Migration[2.1] + MIGRATION = "DeleteInvalidProtectedBranchPushAccessLevels" + DELAY_INTERVAL = 2.minutes + MAX_BATCH_SIZE = 10_000 + BATCH_SIZE = 5_000 + SUB_BATCH_SIZE = 500 + + disable_ddl_transaction! + restrict_gitlab_migration gitlab_schema: :gitlab_main + + def up + queue_batched_background_migration( + MIGRATION, + :protected_branch_push_access_levels, + :id, + job_interval: DELAY_INTERVAL, + queued_migration_version: '20231016194927', + batch_size: BATCH_SIZE, + sub_batch_size: SUB_BATCH_SIZE + ) + end + + def down + delete_batched_background_migration(MIGRATION, :protected_branch_push_access_levels, :id, []) + end +end diff --git a/db/post_migrate/20231016194942_add_temporary_index_to_create_access_levels.rb b/db/post_migrate/20231016194942_add_temporary_index_to_create_access_levels.rb new file mode 100644 index 00000000000..d28b664c517 --- /dev/null +++ b/db/post_migrate/20231016194942_add_temporary_index_to_create_access_levels.rb @@ -0,0 +1,25 @@ +# frozen_string_literal: true + +class AddTemporaryIndexToCreateAccessLevels < Gitlab::Database::Migration[2.2] + disable_ddl_transaction! + milestone '16.6' + + INDEX_NAME = 'tmp_idx_protected_tag_create_access_levels_on_id_with_group' + + def up + # Temporary index to be removed in 16.7 https://gitlab.com/gitlab-org/gitlab/-/issues/430843 + add_concurrent_index( + :protected_tag_create_access_levels, + %i[id], + where: 'group_id IS NOT NULL', + name: INDEX_NAME + ) + end + + def down + remove_concurrent_index_by_name( + :protected_tag_create_access_levels, + INDEX_NAME + ) + end +end diff --git a/db/post_migrate/20231016194943_queue_delete_invalid_protected_tag_create_access_levels.rb b/db/post_migrate/20231016194943_queue_delete_invalid_protected_tag_create_access_levels.rb new file mode 100644 index 00000000000..5880124d0a6 --- /dev/null +++ b/db/post_migrate/20231016194943_queue_delete_invalid_protected_tag_create_access_levels.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +class QueueDeleteInvalidProtectedTagCreateAccessLevels < Gitlab::Database::Migration[2.1] + MIGRATION = "DeleteInvalidProtectedTagCreateAccessLevels" + DELAY_INTERVAL = 2.minutes + BATCH_SIZE = 10_000 + SUB_BATCH_SIZE = 500 + + disable_ddl_transaction! + restrict_gitlab_migration gitlab_schema: :gitlab_main + + def up + queue_batched_background_migration( + MIGRATION, + :protected_tag_create_access_levels, + :id, + job_interval: DELAY_INTERVAL, + queued_migration_version: '20231016194943', + batch_size: BATCH_SIZE, + sub_batch_size: SUB_BATCH_SIZE + ) + end + + def down + delete_batched_background_migration(MIGRATION, :protected_tag_create_access_levels, :id, []) + end +end diff --git a/db/schema_migrations/20231016173128 b/db/schema_migrations/20231016173128 new file mode 100644 index 00000000000..6aa7c3f955e --- /dev/null +++ b/db/schema_migrations/20231016173128 @@ -0,0 +1 @@ +b720259efa4eb9fe75a3352a64b9e14ae7b048240daf34c40a66cc5ef409dcc0 \ No newline at end of file diff --git a/db/schema_migrations/20231016173129 b/db/schema_migrations/20231016173129 new file mode 100644 index 00000000000..acbf77968e9 --- /dev/null +++ b/db/schema_migrations/20231016173129 @@ -0,0 +1 @@ +f886678df9907d2bf60f98c0184c91604069cd613b541a0476e30789f327df15 \ No newline at end of file diff --git a/db/schema_migrations/20231016194926 b/db/schema_migrations/20231016194926 new file mode 100644 index 00000000000..4aa858f00f0 --- /dev/null +++ b/db/schema_migrations/20231016194926 @@ -0,0 +1 @@ +0f2e4b7fc2658b5063dbe8dea6c881fb59a9d99ed53332ae1bdb5578343c3e89 \ No newline at end of file diff --git a/db/schema_migrations/20231016194927 b/db/schema_migrations/20231016194927 new file mode 100644 index 00000000000..6d8d7d11191 --- /dev/null +++ b/db/schema_migrations/20231016194927 @@ -0,0 +1 @@ +44474805c7858d07d093650e43f3313746976e4c523b408d029e32829a5b7301 \ No newline at end of file diff --git a/db/schema_migrations/20231016194942 b/db/schema_migrations/20231016194942 new file mode 100644 index 00000000000..05862999a37 --- /dev/null +++ b/db/schema_migrations/20231016194942 @@ -0,0 +1 @@ +43de9dd5e63a80c51aa21e42b7f41d03b6d36143afa45cf45ead6ee0cc8152cc \ No newline at end of file diff --git a/db/schema_migrations/20231016194943 b/db/schema_migrations/20231016194943 new file mode 100644 index 00000000000..df18251008c --- /dev/null +++ b/db/schema_migrations/20231016194943 @@ -0,0 +1 @@ +b17f7eaff454fab3e46e438d81fdebab14776322af261e0f2a12ceb69a5623a8 \ No newline at end of file diff --git a/db/structure.sql b/db/structure.sql index 0da8e0b7ce1..dea21fc06ca 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -35071,6 +35071,12 @@ CREATE INDEX tmp_idx_orphaned_approval_merge_request_rules ON approval_merge_req CREATE INDEX tmp_idx_orphaned_approval_project_rules ON approval_project_rules USING btree (id) WHERE ((report_type = ANY (ARRAY[2, 4])) AND (security_orchestration_policy_configuration_id IS NULL)); +CREATE INDEX tmp_idx_protected_branch_merge_access_levels_on_id_with_group ON protected_branch_merge_access_levels USING btree (id) WHERE (group_id IS NOT NULL); + +CREATE INDEX tmp_idx_protected_branch_push_access_levels_on_id_with_group ON protected_branch_push_access_levels USING btree (id) WHERE (group_id IS NOT NULL); + +CREATE INDEX tmp_idx_protected_tag_create_access_levels_on_id_with_group ON protected_tag_create_access_levels USING btree (id) WHERE (group_id IS NOT NULL); + CREATE INDEX tmp_index_ci_job_artifacts_on_expire_at_where_locked_unknown ON ci_job_artifacts USING btree (expire_at, job_id) WHERE ((locked = 2) AND (expire_at IS NOT NULL)); CREATE INDEX tmp_index_cis_vulnerability_reads_on_id ON vulnerability_reads USING btree (id) WHERE (report_type = 7); -- cgit v1.2.3