Commit fb7fdc33 authored by Dylan Griffith's avatar Dylan Griffith

Merge branch 'fix-cluster-reindexing-task' into 'master'

Handle elastic:reindex_cluster unique index violation

See merge request gitlab-org/gitlab!43690
parents d260e7a9 74c35852
---
title: Gracefully handle gitlab:elastic:reindex_cluster unique index violation
merge_request: 43690
author:
type: fixed
......@@ -91,11 +91,7 @@ namespace :gitlab do
desc "GitLab | Elasticsearch | Zero-downtime cluster reindexing"
task reindex_cluster: :environment do
Elastic::ReindexingTask.create!
ElasticClusterReindexingCronWorker.perform_async
puts "Reindexing job was successfully scheduled".color(:green)
trigger_cluster_reindexing
end
desc "GitLab | Elasticsearch | Clear indexing status"
......@@ -137,6 +133,16 @@ namespace :gitlab do
count
end
def trigger_cluster_reindexing
Elastic::ReindexingTask.create!
ElasticClusterReindexingCronWorker.perform_async
puts 'Reindexing job was successfully scheduled'.color(:green)
rescue PG::UniqueViolation, ActiveRecord::RecordNotUnique
puts 'There is another task in progress. Please wait for it to finish.'.color(:red)
end
def display_unindexed(projects)
arr = if projects.count < 500 || ENV['SHOW_ALL']
projects
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment