diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-22 21:09:52 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-04-22 21:09:52 +0300 |
commit | db061f44328ca45f713eaf22d92aae8e76148fda (patch) | |
tree | 56f1297f970cb41a13e27cae12f5e9665957c885 /db | |
parent | 7a7345366550f509c03595e0dada7cbd0d73103d (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
-rw-r--r-- | db/post_migrate/20200128210353_cleanup_optimistic_locking_nulls.rb | 2 | ||||
-rw-r--r-- | db/post_migrate/20200217210353_cleanup_optimistic_locking_nulls_pt2.rb | 47 | ||||
-rw-r--r-- | db/structure.sql | 7 |
3 files changed, 1 insertions, 55 deletions
diff --git a/db/post_migrate/20200128210353_cleanup_optimistic_locking_nulls.rb b/db/post_migrate/20200128210353_cleanup_optimistic_locking_nulls.rb index 5c172159561..8bc037c7333 100644 --- a/db/post_migrate/20200128210353_cleanup_optimistic_locking_nulls.rb +++ b/db/post_migrate/20200128210353_cleanup_optimistic_locking_nulls.rb @@ -31,7 +31,7 @@ class CleanupOptimisticLockingNulls < ActiveRecord::Migration[5.2] 'CleanupOptimisticLockingNulls', 2.minutes, batch_size: BATCH_SIZE, - other_job_arguments: [table] + other_arguments: [table] ) end end diff --git a/db/post_migrate/20200217210353_cleanup_optimistic_locking_nulls_pt2.rb b/db/post_migrate/20200217210353_cleanup_optimistic_locking_nulls_pt2.rb deleted file mode 100644 index 62031d6dc8c..00000000000 --- a/db/post_migrate/20200217210353_cleanup_optimistic_locking_nulls_pt2.rb +++ /dev/null @@ -1,47 +0,0 @@ -# frozen_string_literal: true - -# See http://doc.gitlab.com/ce/development/migration_style_guide.html -# for more information on how to write migrations for GitLab. - -class CleanupOptimisticLockingNullsPt2 < ActiveRecord::Migration[5.2] - include Gitlab::Database::MigrationHelpers - - DOWNTIME = false - - disable_ddl_transaction! - - TABLES = %w(ci_stages ci_builds ci_pipelines).freeze - BATCH_SIZE = 10_000 - - def declare_class(table) - Class.new(ActiveRecord::Base) do - include EachBatch - - self.table_name = table - self.inheritance_column = :_type_disabled # Disable STI - end - end - - def up - last_table_final_delay = 0 - - TABLES.each do |table| - add_concurrent_index table.to_sym, :lock_version, where: "lock_version IS NULL" - - last_table_final_delay = queue_background_migration_jobs_by_range_at_intervals( - declare_class(table).where(lock_version: nil), - 'CleanupOptimisticLockingNulls', - 2.minutes, - batch_size: BATCH_SIZE, - other_job_arguments: [table], - initial_delay: last_table_final_delay - ) - end - end - - def down - TABLES.each do |table| - remove_concurrent_index table.to_sym, :lock_version, where: "lock_version IS NULL" - end - end -end diff --git a/db/structure.sql b/db/structure.sql index cc9a332be97..faf61a6986a 100644 --- a/db/structure.sql +++ b/db/structure.sql @@ -8862,8 +8862,6 @@ CREATE INDEX index_ci_builds_on_commit_id_and_type_and_name_and_ref ON public.ci CREATE INDEX index_ci_builds_on_commit_id_and_type_and_ref ON public.ci_builds USING btree (commit_id, type, ref); -CREATE INDEX index_ci_builds_on_lock_version ON public.ci_builds USING btree (lock_version) WHERE (lock_version IS NULL); - CREATE INDEX index_ci_builds_on_name_and_security_type_eq_ci_build ON public.ci_builds USING btree (name, id) WHERE (((name)::text = ANY (ARRAY[('container_scanning'::character varying)::text, ('dast'::character varying)::text, ('dependency_scanning'::character varying)::text, ('license_management'::character varying)::text, ('sast'::character varying)::text, ('license_scanning'::character varying)::text])) AND ((type)::text = 'Ci::Build'::text)); CREATE INDEX index_ci_builds_on_project_id_and_id ON public.ci_builds USING btree (project_id, id); @@ -8940,8 +8938,6 @@ CREATE INDEX index_ci_pipelines_on_auto_canceled_by_id ON public.ci_pipelines US CREATE INDEX index_ci_pipelines_on_external_pull_request_id ON public.ci_pipelines USING btree (external_pull_request_id) WHERE (external_pull_request_id IS NOT NULL); -CREATE INDEX index_ci_pipelines_on_lock_version ON public.ci_pipelines USING btree (lock_version) WHERE (lock_version IS NULL); - CREATE INDEX index_ci_pipelines_on_merge_request_id ON public.ci_pipelines USING btree (merge_request_id) WHERE (merge_request_id IS NOT NULL); CREATE INDEX index_ci_pipelines_on_pipeline_schedule_id ON public.ci_pipelines USING btree (pipeline_schedule_id); @@ -9010,8 +9006,6 @@ CREATE INDEX index_ci_sources_projects_on_pipeline_id ON public.ci_sources_proje CREATE UNIQUE INDEX index_ci_sources_projects_on_source_project_id_and_pipeline_id ON public.ci_sources_projects USING btree (source_project_id, pipeline_id); -CREATE INDEX index_ci_stages_on_lock_version ON public.ci_stages USING btree (lock_version) WHERE (lock_version IS NULL); - CREATE INDEX index_ci_stages_on_pipeline_id ON public.ci_stages USING btree (pipeline_id); CREATE UNIQUE INDEX index_ci_stages_on_pipeline_id_and_name ON public.ci_stages USING btree (pipeline_id, name); @@ -13070,7 +13064,6 @@ COPY "schema_migrations" (version) FROM STDIN; 20200214214934 20200215222507 20200215225103 -20200217210353 20200217223651 20200217225719 20200218113721 |