Class: Gitlab::BackgroundMigration::BackfillIssueSearchData
- Inherits:
-
Object
- Object
- Gitlab::BackgroundMigration::BackfillIssueSearchData
- Includes:
- Database::DynamicModelHelpers
- Defined in:
- lib/gitlab/background_migration/backfill_issue_search_data.rb
Overview
Backfills the new ‘issue_search_data` table, which contains the tsvector from the issue title and description.
Constant Summary
Constants included from Database::DynamicModelHelpers
Database::DynamicModelHelpers::BATCH_SIZE
Instance Method Summary collapse
Methods included from Database::DynamicModelHelpers
#define_batchable_model, #each_batch, #each_batch_range
Instance Method Details
#perform(start_id, stop_id, batch_table, batch_column, sub_batch_size, pause_ms) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/gitlab/background_migration/backfill_issue_search_data.rb', line 11 def perform(start_id, stop_id, batch_table, batch_column, sub_batch_size, pause_ms) define_batchable_model(batch_table, connection: ApplicationRecord.connection).where(batch_column => start_id..stop_id).each_batch(of: sub_batch_size) do |sub_batch| update_search_data(sub_batch) sleep(pause_ms * 0.001) rescue ActiveRecord::StatementInvalid => e raise unless e.cause.is_a?(PG::ProgramLimitExceeded) && e..include?('string is too long for tsvector') update_search_data_individually(sub_batch, pause_ms) end end |