Commit 09cdfb16 authored by Andreas Brandl's avatar Andreas Brandl

Cleanup unneeded code

parent 37ddbe2f
...@@ -5,8 +5,6 @@ module Gitlab ...@@ -5,8 +5,6 @@ module Gitlab
module Reindexing module Reindexing
# This is a >= PG12 reindexing strategy based on `REINDEX CONCURRENTLY` # This is a >= PG12 reindexing strategy based on `REINDEX CONCURRENTLY`
class ReindexConcurrently class ReindexConcurrently
include Gitlab::Utils::StrongMemoize
ReindexError = Class.new(StandardError) ReindexError = Class.new(StandardError)
TEMPORARY_INDEX_PATTERN = '\_ccnew[0-9]*' TEMPORARY_INDEX_PATTERN = '\_ccnew[0-9]*'
...@@ -45,7 +43,6 @@ module Gitlab ...@@ -45,7 +43,6 @@ module Gitlab
execute("REINDEX INDEX CONCURRENTLY #{quote_table_name(index.schema)}.#{quote_table_name(index.name)}") execute("REINDEX INDEX CONCURRENTLY #{quote_table_name(index.schema)}.#{quote_table_name(index.name)}")
end end
end end
ensure ensure
cleanup_dangling_indexes cleanup_dangling_indexes
end end
......
...@@ -109,32 +109,4 @@ RSpec.describe Gitlab::Database::Reindexing::ReindexConcurrently, '#perform' do ...@@ -109,32 +109,4 @@ RSpec.describe Gitlab::Database::Reindexing::ReindexConcurrently, '#perform' do
end end
end end
end end
def expect_index_rename(from, to)
expect(connection).to receive(:execute).with(<<~SQL).ordered
ALTER INDEX "public"."#{from}"
RENAME TO "#{to}"
SQL
end
def expect_index_drop(drop_index)
expect_next_instance_of(::Gitlab::Database::WithLockRetries) do |instance|
expect(instance).to receive(:run).with(raise_on_exhaustion: false).and_yield
end
expect_to_execute_concurrently_in_order(drop_index)
end
def find_index_create_statement
ActiveRecord::Base.connection.select_value(<<~SQL)
SELECT indexdef
FROM pg_indexes
WHERE schemaname = 'public'
AND indexname = #{ActiveRecord::Base.connection.quote(index.name)}
SQL
end
def check_index_exists
expect(find_index_create_statement).to eq(original_index)
end
end end
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