diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-20 00:09:01 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-05-20 00:09:01 +0300 |
commit | 8acf72a1d95677e37ca2c3a8bea3e65139443527 (patch) | |
tree | dcb7f53c394ff29b5bee9bc1a60f19c4cda29b40 /app/workers | |
parent | 91aa6c6479ec883328ae656ab70d6fc3824b5673 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/workers')
-rw-r--r-- | app/workers/database/batched_background_migration/execution_worker.rb | 1 | ||||
-rw-r--r-- | app/workers/database/batched_background_migration/single_database_worker.rb | 27 |
2 files changed, 4 insertions, 24 deletions
diff --git a/app/workers/database/batched_background_migration/execution_worker.rb b/app/workers/database/batched_background_migration/execution_worker.rb index 53c92ab8969..1bdc829418a 100644 --- a/app/workers/database/batched_background_migration/execution_worker.rb +++ b/app/workers/database/batched_background_migration/execution_worker.rb @@ -15,6 +15,7 @@ module Database included do data_consistency :always feature_category :database + prefer_calling_context_feature_category true queue_namespace :batched_background_migrations end diff --git a/app/workers/database/batched_background_migration/single_database_worker.rb b/app/workers/database/batched_background_migration/single_database_worker.rb index b7b46937db2..ebf63d34cbf 100644 --- a/app/workers/database/batched_background_migration/single_database_worker.rb +++ b/app/workers/database/batched_background_migration/single_database_worker.rb @@ -16,7 +16,6 @@ module Database included do data_consistency :always feature_category :database - prefer_calling_context_feature_category true idempotent! end @@ -58,39 +57,19 @@ module Database Gitlab::Database::SharedModel.using_connection(base_model.connection) do break unless self.class.enabled? - if parallel_execution_enabled? - migrations = Gitlab::Database::BackgroundMigration::BatchedMigration - .active_migrations_distinct_on_table(connection: base_model.connection, limit: max_running_migrations).to_a + migrations = Gitlab::Database::BackgroundMigration::BatchedMigration + .active_migrations_distinct_on_table(connection: base_model.connection, limit: max_running_migrations).to_a - queue_migrations_for_execution(migrations) if migrations.any? - else - break unless active_migration - - with_exclusive_lease(active_migration.interval) do - run_active_migration - end - end + queue_migrations_for_execution(migrations) if migrations.any? end end private - def parallel_execution_enabled? - Feature.enabled?(:batched_migrations_parallel_execution) - end - def max_running_migrations execution_worker_class.max_running_jobs end - def active_migration - @active_migration ||= Gitlab::Database::BackgroundMigration::BatchedMigration.active_migration(connection: base_model.connection) - end - - def run_active_migration - execution_worker_class.new.perform_work(tracking_database, active_migration.id) - end - def tracking_database self.class.tracking_database end |