diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-03 15:14:02 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-03 15:14:02 +0300 |
commit | aaa65d324933a1f7e380c0f05a7b87fb3fe2e4b7 (patch) | |
tree | a0f5b589949e66adc9c2fdce9428778862e08950 /db | |
parent | 642ed51ed88d96df94cd56cdbfaff0f58c0433b1 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'db')
4 files changed, 56 insertions, 0 deletions
diff --git a/db/post_migrate/20220215190020_rerun_convert_stringified_raw_metadata_hash_to_json.rb b/db/post_migrate/20220215190020_rerun_convert_stringified_raw_metadata_hash_to_json.rb new file mode 100644 index 00000000000..1f36132c578 --- /dev/null +++ b/db/post_migrate/20220215190020_rerun_convert_stringified_raw_metadata_hash_to_json.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +class RerunConvertStringifiedRawMetadataHashToJson < Gitlab::Database::Migration[1.0] + MIGRATION_CLASS = Gitlab::BackgroundMigration::FixVulnerabilityOccurrencesWithHashesAsRawMetadata + MODEL_CLASS = MIGRATION_CLASS::Finding + DELAY_INTERVAL = 2.minutes + BATCH_SIZE = 500 + + disable_ddl_transaction! + + def up + queue_background_migration_jobs_by_range_at_intervals( + MODEL_CLASS.by_api_report_types, + MIGRATION_CLASS.name.demodulize, + DELAY_INTERVAL, + batch_size: BATCH_SIZE, + track_jobs: true + ) + end + + def down + # no-op + + # up fixes invalid data by updating columns in-place. + # It is a backwards-compatible change, and reversing it in a downgrade would not be desirable. + end +end diff --git a/db/post_migrate/20220223112304_schedule_nullify_orphan_runner_id_on_ci_builds.rb b/db/post_migrate/20220223112304_schedule_nullify_orphan_runner_id_on_ci_builds.rb new file mode 100644 index 00000000000..08a7c869eb1 --- /dev/null +++ b/db/post_migrate/20220223112304_schedule_nullify_orphan_runner_id_on_ci_builds.rb @@ -0,0 +1,27 @@ +# frozen_string_literal: true + +class ScheduleNullifyOrphanRunnerIdOnCiBuilds < Gitlab::Database::Migration[1.0] + MIGRATION = 'NullifyOrphanRunnerIdOnCiBuilds' + INTERVAL = 2.minutes + BATCH_SIZE = 100_000 + MAX_BATCH_SIZE = 25_000 # 100k * 25k = 2.5B ci_builds + SUB_BATCH_SIZE = 1_000 + + def up + queue_batched_background_migration( + MIGRATION, + :ci_builds, + :id, + job_interval: INTERVAL, + batch_size: BATCH_SIZE, + max_batch_size: MAX_BATCH_SIZE, + sub_batch_size: SUB_BATCH_SIZE + ) + end + + def down + Gitlab::Database::BackgroundMigration::BatchedMigration + .for_configuration(MIGRATION, :ci_builds, :id, []) + .delete_all + end +end diff --git a/db/schema_migrations/20220215190020 b/db/schema_migrations/20220215190020 new file mode 100644 index 00000000000..1d5be90ca1f --- /dev/null +++ b/db/schema_migrations/20220215190020 @@ -0,0 +1 @@ +aa92afc5f74f051132aeb73889d7360bbd6258b27c0aedb4fea6a44ccce597b3
\ No newline at end of file diff --git a/db/schema_migrations/20220223112304 b/db/schema_migrations/20220223112304 new file mode 100644 index 00000000000..bfcbf9c1225 --- /dev/null +++ b/db/schema_migrations/20220223112304 @@ -0,0 +1 @@ +57dc23bb2a9faddefe20c1e30a8879ebb1f6f32f17e3cc381acc1d06ad3b598a
\ No newline at end of file |