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
6706148b
Commit
6706148b
authored
Sep 07, 2021
by
Kamil Trzciński
Committed by
Sean McGivern
Sep 07, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix `Connection#disable_prepared_statements` loosing connection qualifier
parent
7bfa0963
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
1 deletion
+16
-1
lib/gitlab/database/connection.rb
lib/gitlab/database/connection.rb
+10
-1
spec/lib/gitlab/database/connection_spec.rb
spec/lib/gitlab/database/connection_spec.rb
+6
-0
No files found.
lib/gitlab/database/connection.rb
View file @
6706148b
...
...
@@ -88,7 +88,16 @@ module Gitlab
# Disables prepared statements for the current database connection.
def
disable_prepared_statements
scope
.
establish_connection
(
config
.
merge
(
prepared_statements:
false
))
db_config_object
=
scope
.
connection_db_config
config
=
db_config_object
.
configuration_hash
.
merge
(
prepared_statements:
false
)
hash_config
=
ActiveRecord
::
DatabaseConfigurations
::
HashConfig
.
new
(
db_config_object
.
env_name
,
db_config_object
.
name
,
config
)
scope
.
establish_connection
(
hash_config
)
end
# Check whether the underlying database is in read-only mode
...
...
spec/lib/gitlab/database/connection_spec.rb
View file @
6706148b
...
...
@@ -162,6 +162,12 @@ RSpec.describe Gitlab::Database::Connection do
expect
(
connection
.
scope
.
connection
.
prepared_statements
).
to
eq
(
false
)
end
it
'retains the connection name'
do
connection
.
disable_prepared_statements
expect
(
connection
.
scope
.
connection_db_config
.
name
).
to
eq
(
'main'
)
end
context
'with dynamic connection pool size'
do
before
do
connection
.
scope
.
establish_connection
(
connection
.
config
.
merge
(
pool:
7
))
...
...
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