Skip to content
Snippets Groups Projects

Add migration for backfilling traversal_ids in blobs and wiki blobs

Merged Siddharth Dungarwal requested to merge 351381-backfill-blobs-and-wiki-blobs into master
1 unresolved thread
Compare and Show latest version
2 files
+ 64
82
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -22,10 +22,10 @@ def migrate
end
if task_status['completed']
log "Updating traversal_ids in original index is completed for task_id:#{task_id}"
log "Updating traversal_ids in original index is completed for task_id: #{task_id}"
set_migration_state(task_id: nil)
else
log "Updating traversal_ids in original index is still in progress for task_id:#{task_id}"
log "Updating traversal_ids in original index is still in progress for task_id: #{task_id}"
end
return
@@ -39,10 +39,10 @@ def migrate
log "Searching for the projects with missing traversal_ids"
project_ids = projects_with_missing_traversal_ids
log "Found #{project_ids.size} projects with missing traversal_ids"
project_ids.each do |project_id|
update_by_query(Project.find(project_id))
begin
update_by_query(Project.find(project_ids[0])) unless project_ids.empty?
rescue ActiveRecord::RecordNotFound
log "Project not found: #{project_id}"
log "Project not found: #{project_ids[0]}"
end
end
@@ -58,6 +58,7 @@ def completed?
private
def update_by_query(project)
log "Launching update query for project #{project.id}"
response = client.update_by_query(
index: helper.target_name,
body: {
@@ -85,7 +86,7 @@ def update_by_query(project)
end
task_id = response['task']
log "Adding traversal_ids to original index is started with task_id:#{task_id}"
log "Adding traversal_ids to original index is started with task_id: #{task_id}"
set_migration_state(
task_id: task_id
Loading