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
03310908
Commit
03310908
authored
Jan 16, 2021
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Yield job to BackgroundMigration#steal predicate
parent
cd2ff96f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
4 additions
and
3 deletions
+4
-3
lib/gitlab/background_migration.rb
lib/gitlab/background_migration.rb
+1
-1
spec/lib/gitlab/background_migration_spec.rb
spec/lib/gitlab/background_migration_spec.rb
+1
-1
spec/lib/gitlab/database/partitioning_migration_helpers/table_management_helpers_spec.rb
...ioning_migration_helpers/table_management_helpers_spec.rb
+2
-1
No files found.
lib/gitlab/background_migration.rb
View file @
03310908
...
...
@@ -33,7 +33,7 @@ module Gitlab
next
unless
job
.
queue
==
self
.
queue
next
unless
migration_class
==
steal_class
next
if
block_given?
&&
!
(
yield
migration_args
)
next
if
block_given?
&&
!
(
yield
job
)
begin
perform
(
migration_class
,
migration_args
)
if
job
.
delete
...
...
spec/lib/gitlab/background_migration_spec.rb
View file @
03310908
...
...
@@ -55,7 +55,7 @@ RSpec.describe Gitlab::BackgroundMigration do
expect
(
described_class
).
to
receive
(
:perform
)
.
with
(
'Foo'
,
[
10
,
20
])
described_class
.
steal
(
'Foo'
)
{
|
(
arg1
,
arg2
)
|
arg1
==
10
&&
arg2
==
20
}
described_class
.
steal
(
'Foo'
)
{
|
job
|
job
.
args
.
second
.
first
==
10
&&
job
.
args
.
second
.
second
==
20
}
end
it
'does not steal jobs that do not match the predicate'
do
...
...
spec/lib/gitlab/database/partitioning_migration_helpers/table_management_helpers_spec.rb
View file @
03310908
...
...
@@ -513,6 +513,7 @@ RSpec.describe Gitlab::Database::PartitioningMigrationHelpers::TableManagementHe
context
'finishing pending background migration jobs'
do
let
(
:source_table_double
)
{
double
(
'table name'
)
}
let
(
:raw_arguments
)
{
[
1
,
50_000
,
source_table_double
,
partitioned_table
,
source_column
]
}
let
(
:background_job
)
{
double
(
'background job'
,
args:
raw_arguments
)
}
before
do
allow
(
migration
).
to
receive
(
:table_exists?
).
with
(
partitioned_table
).
and_return
(
true
)
...
...
@@ -528,7 +529,7 @@ RSpec.describe Gitlab::Database::PartitioningMigrationHelpers::TableManagementHe
expect
(
Gitlab
::
BackgroundMigration
).
to
receive
(
:steal
)
.
with
(
described_class
::
MIGRATION_CLASS_NAME
)
.
and_yield
(
raw_arguments
)
.
and_yield
(
background_job
)
expect
(
source_table_double
).
to
receive
(
:==
).
with
(
source_table
.
to_s
)
...
...
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