Commit 57851cfd authored by Yannis Roussos's avatar Yannis Roussos

Merge branch 'ab/reindexing-statement-timeout' into 'master'

Set statement timeout in seconds

See merge request gitlab-org/gitlab!45143
parents ea65d3be 3648854f
...@@ -111,7 +111,7 @@ module Gitlab ...@@ -111,7 +111,7 @@ module Gitlab
end end
def set_statement_timeout def set_statement_timeout
execute("SET statement_timeout TO #{STATEMENT_TIMEOUT}") execute("SET statement_timeout TO '%ds'" % STATEMENT_TIMEOUT)
yield yield
ensure ensure
execute('RESET statement_timeout') execute('RESET statement_timeout')
......
...@@ -111,7 +111,7 @@ RSpec.describe Gitlab::Database::Reindexing::ConcurrentReindex, '#perform' do ...@@ -111,7 +111,7 @@ RSpec.describe Gitlab::Database::Reindexing::ConcurrentReindex, '#perform' do
end end
it 'replaces the existing index with an identical index' do it 'replaces the existing index with an identical index' do
expect(connection).to receive(:execute).with('SET statement_timeout TO 21600').twice expect(connection).to receive(:execute).with('SET statement_timeout TO \'21600s\'').twice
expect_to_execute_concurrently_in_order(create_index) expect_to_execute_concurrently_in_order(create_index)
...@@ -136,7 +136,7 @@ RSpec.describe Gitlab::Database::Reindexing::ConcurrentReindex, '#perform' do ...@@ -136,7 +136,7 @@ RSpec.describe Gitlab::Database::Reindexing::ConcurrentReindex, '#perform' do
end end
it 'replaces the existing index with an identical index' do it 'replaces the existing index with an identical index' do
expect(connection).to receive(:execute).with('SET statement_timeout TO 21600').exactly(3).times expect(connection).to receive(:execute).with('SET statement_timeout TO \'21600s\'').exactly(3).times
expect_to_execute_concurrently_in_order(drop_index) expect_to_execute_concurrently_in_order(drop_index)
expect_to_execute_concurrently_in_order(create_index) expect_to_execute_concurrently_in_order(create_index)
......
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