debian-mirror-gitlab/lib/gitlab/database/reindexing.rb

26 lines
749 B
Ruby
Raw Normal View History

2021-01-03 14:25:43 +05:30
# frozen_string_literal: true
module Gitlab
module Database
module Reindexing
2021-02-22 17:27:13 +05:30
# Number of indexes to reindex per invocation
DEFAULT_INDEXES_PER_INVOCATION = 2
# candidate_indexes: Array of Gitlab::Database::PostgresIndex
def self.perform(candidate_indexes, how_many: DEFAULT_INDEXES_PER_INVOCATION)
indexes = IndexSelection.new(candidate_indexes).take(how_many)
Coordinator.new(indexes).perform
2021-01-03 14:25:43 +05:30
end
def self.candidate_indexes
Gitlab::Database::PostgresIndex
.regular
2021-01-29 00:20:46 +05:30
.where('NOT expression')
2021-01-03 14:25:43 +05:30
.not_match("^#{ConcurrentReindex::TEMPORARY_INDEX_PREFIX}")
.not_match("^#{ConcurrentReindex::REPLACED_INDEX_PREFIX}")
end
end
end
end