Class: Gitlab::BackgroundMigration::BackfillRunnerTypeAndShardingKeyIdOnCiRunnerManagers
- Inherits:
-
BatchedMigrationJob
- Object
- BatchedMigrationJob
- Gitlab::BackgroundMigration::BackfillRunnerTypeAndShardingKeyIdOnCiRunnerManagers
- Defined in:
- lib/gitlab/background_migration/backfill_runner_type_and_sharding_key_id_on_ci_runner_managers.rb
Defined Under Namespace
Classes: CiRunnerManager
Constant Summary collapse
- UPDATE_RUNNER_MANAGERS_SQL =
<<~SQL UPDATE ci_runner_machines SET sharding_key_id = ci_runners.sharding_key_id, runner_type = ci_runners.runner_type FROM ci_runners WHERE ci_runner_machines.runner_id = ci_runners.id AND ci_runner_machines.id IN (?); SQL
Constants inherited from BatchedMigrationJob
Gitlab::BackgroundMigration::BatchedMigrationJob::DEFAULT_FEATURE_CATEGORY
Constants included from Database::DynamicModelHelpers
Database::DynamicModelHelpers::BATCH_SIZE
Instance Method Summary collapse
Methods inherited from BatchedMigrationJob
#batch_metrics, cursor, cursor?, cursor_columns, feature_category, #filter_batch, generic_instance, #initialize, job_arguments, job_arguments_count, operation_name, scope_to
Methods included from Database::DynamicModelHelpers
#define_batchable_model, #each_batch, #each_batch_range
Constructor Details
This class inherits a constructor from Gitlab::BackgroundMigration::BatchedMigrationJob
Instance Method Details
#perform ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/gitlab/background_migration/backfill_runner_type_and_sharding_key_id_on_ci_runner_managers.rb', line 23 def perform each_sub_batch do |sub_batch| sub_batch = sub_batch.where(sharding_key_id: nil).limit(sub_batch_size).select(:id) connection.exec_update(CiRunnerManager.sanitize_sql([UPDATE_RUNNER_MANAGERS_SQL, sub_batch])) end end |