Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
7f674389
Commit
7f674389
authored
Jul 28, 2021
by
Thong Kuah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix disable_prepared_statements clobbering pool size
Use a fresh config when using with establish_connection
parent
1d854f3e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
3 deletions
+19
-3
lib/gitlab/database/connection.rb
lib/gitlab/database/connection.rb
+6
-3
spec/lib/gitlab/database/connection_spec.rb
spec/lib/gitlab/database/connection_spec.rb
+13
-0
No files found.
lib/gitlab/database/connection.rb
View file @
7f674389
...
...
@@ -34,11 +34,14 @@ module Gitlab
Gitlab
::
Runtime
.
max_threads
+
headroom
end
def
config
@config
||=
def
uncached_config
scope
.
connection_db_config
.
configuration_hash
.
with_indifferent_access
end
def
config
@config
||=
uncached_config
end
def
pool_size
config
[
:pool
]
||
default_pool_size
end
...
...
@@ -69,7 +72,7 @@ module Gitlab
# Disables prepared statements for the current database connection.
def
disable_prepared_statements
scope
.
establish_connection
(
config
.
merge
(
prepared_statements:
false
))
scope
.
establish_connection
(
uncached_
config
.
merge
(
prepared_statements:
false
))
end
def
read_only?
...
...
spec/lib/gitlab/database/connection_spec.rb
View file @
7f674389
...
...
@@ -140,6 +140,19 @@ RSpec.describe Gitlab::Database::Connection do
expect
(
connection
.
scope
.
connection
.
prepared_statements
).
to
eq
(
false
)
end
context
'with dynamic connection pool size'
do
before
do
connection
.
scope
.
establish_connection
(
connection
.
config
.
merge
(
pool:
7
))
end
it
'retains the set pool size'
do
connection
.
disable_prepared_statements
expect
(
connection
.
scope
.
connection
.
prepared_statements
).
to
eq
(
false
)
expect
(
connection
.
scope
.
connection
.
pool
.
size
).
to
eq
(
7
)
end
end
end
describe
'#read_only?'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment