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
b07edea7
Commit
b07edea7
authored
Sep 13, 2021
by
Simon Tomlinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove subtransactions from partition management
parent
01f9dc8e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
4 deletions
+11
-4
lib/gitlab/database/partitioning/partition_manager.rb
lib/gitlab/database/partitioning/partition_manager.rb
+6
-4
spec/lib/gitlab/database/partitioning/partition_manager_spec.rb
...ib/gitlab/database/partitioning/partition_manager_spec.rb
+5
-0
No files found.
lib/gitlab/database/partitioning/partition_manager.rb
View file @
b07edea7
...
...
@@ -74,8 +74,9 @@ module Gitlab
end
def
create
(
partitions
)
connection
.
transaction
do
with_lock_retries
do
# with_lock_retries starts a requires_new transaction most of the time, but not on the last iteration
with_lock_retries
do
connection
.
transaction
(
requires_new:
false
)
do
# so we open a transaction here if not already in progress
partitions
.
each
do
|
partition
|
connection
.
execute
partition
.
to_sql
...
...
@@ -88,8 +89,9 @@ module Gitlab
end
def
detach
(
partitions
)
connection
.
transaction
do
with_lock_retries
do
# with_lock_retries starts a requires_new transaction most of the time, but not on the last iteration
with_lock_retries
do
connection
.
transaction
(
requires_new:
false
)
do
# so we open a transaction here if not already in progress
partitions
.
each
{
|
p
|
detach_one_partition
(
p
)
}
end
end
...
...
spec/lib/gitlab/database/partitioning/partition_manager_spec.rb
View file @
b07edea7
...
...
@@ -18,6 +18,11 @@ RSpec.describe Gitlab::Database::Partitioning::PartitionManager do
it
'remembers registered models'
do
expect
{
described_class
.
register
(
model
)
}.
to
change
{
described_class
.
models
}.
to
include
(
model
)
end
after
do
# Do not leak the double to other specs
described_class
.
models
.
delete
(
model
)
end
end
context
'creating partitions (mocked)'
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