summaryrefslogtreecommitdiff
path: root/lib/gitlab/database/reindexing.rb
blob: baffe28d9eda91ee80e972b97f1a4fe459f1b8fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# frozen_string_literal: true

module Gitlab
  module Database
    module Reindexing
      def self.perform(index_selector)
        Array.wrap(index_selector).each do |index|
          ReindexAction.keep_track_of(index) do
            ConcurrentReindex.new(index).perform
          end
        end
      end

      def self.candidate_indexes
        Gitlab::Database::PostgresIndex
          .regular
          .not_match("^#{ConcurrentReindex::TEMPORARY_INDEX_PREFIX}")
          .not_match("^#{ConcurrentReindex::REPLACED_INDEX_PREFIX}")
      end
    end
  end
end