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
69b0252b
Commit
69b0252b
authored
Feb 23, 2021
by
Vitali Tatarintev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove MergeRequestAssigneesMigrationProgressCheck background migration
Removes an old background mutation
parent
56d95d9a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
0 additions
and
177 deletions
+0
-177
db/post_migrate/20190402224749_schedule_merge_request_assignees_migration_progress_check.rb
...edule_merge_request_assignees_migration_progress_check.rb
+0
-18
db/schema_migrations/20190402224749
db/schema_migrations/20190402224749
+0
-1
lib/gitlab/background_migration/merge_request_assignees_migration_progress_check.rb
...ation/merge_request_assignees_migration_progress_check.rb
+0
-43
spec/lib/gitlab/background_migration/merge_request_assignees_migration_progress_check_spec.rb
.../merge_request_assignees_migration_progress_check_spec.rb
+0
-99
spec/migrations/schedule_merge_request_assignees_migration_progress_check_spec.rb
..._merge_request_assignees_migration_progress_check_spec.rb
+0
-16
No files found.
db/post_migrate/20190402224749_schedule_merge_request_assignees_migration_progress_check.rb
deleted
100644 → 0
View file @
56d95d9a
# frozen_string_literal: true
class
ScheduleMergeRequestAssigneesMigrationProgressCheck
<
ActiveRecord
::
Migration
[
5.0
]
include
Gitlab
::
Database
::
MigrationHelpers
MIGRATION
=
'MergeRequestAssigneesMigrationProgressCheck'
DOWNTIME
=
false
disable_ddl_transaction!
def
up
BackgroundMigrationWorker
.
perform_async
(
MIGRATION
)
end
def
down
end
end
db/schema_migrations/20190402224749
deleted
100644 → 0
View file @
56d95d9a
f655a3f9f1f41710ae501c3e4ef0893791c28971d87e12f87d4b65131502b812
\ No newline at end of file
lib/gitlab/background_migration/merge_request_assignees_migration_progress_check.rb
deleted
100644 → 0
View file @
56d95d9a
# frozen_string_literal: true
module
Gitlab
module
BackgroundMigration
# rubocop: disable Style/Documentation
class
MergeRequestAssigneesMigrationProgressCheck
include
Gitlab
::
Utils
::
StrongMemoize
RESCHEDULE_DELAY
=
3
.
hours
WORKER
=
'PopulateMergeRequestAssigneesTable'
DeadJobsError
=
Class
.
new
(
StandardError
)
def
perform
raise
DeadJobsError
,
"Only dead background jobs in the queue for
#{
WORKER
}
"
if
!
ongoing?
&&
dead_jobs?
if
ongoing?
BackgroundMigrationWorker
.
perform_in
(
RESCHEDULE_DELAY
,
self
.
class
.
name
)
else
Feature
.
enable
(
:multiple_merge_request_assignees
)
end
end
private
def
dead_jobs?
strong_memoize
(
:dead_jobs
)
do
migration_klass
.
dead_jobs?
(
WORKER
)
end
end
def
ongoing?
strong_memoize
(
:ongoing
)
do
migration_klass
.
exists?
(
WORKER
)
||
migration_klass
.
retrying_jobs?
(
WORKER
)
end
end
def
migration_klass
Gitlab
::
BackgroundMigration
end
end
# rubocop: enable Style/Documentation
end
end
spec/lib/gitlab/background_migration/merge_request_assignees_migration_progress_check_spec.rb
deleted
100644 → 0
View file @
56d95d9a
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
Gitlab
::
BackgroundMigration
::
MergeRequestAssigneesMigrationProgressCheck
do
context
'rescheduling'
do
context
'when there are ongoing and no dead jobs'
do
it
'reschedules check'
do
allow
(
Gitlab
::
BackgroundMigration
).
to
receive
(
:exists?
)
.
with
(
'PopulateMergeRequestAssigneesTable'
)
.
and_return
(
true
)
allow
(
Gitlab
::
BackgroundMigration
).
to
receive
(
:dead_jobs?
)
.
with
(
'PopulateMergeRequestAssigneesTable'
)
.
and_return
(
false
)
expect
(
BackgroundMigrationWorker
).
to
receive
(
:perform_in
).
with
(
described_class
::
RESCHEDULE_DELAY
,
described_class
.
name
)
described_class
.
new
.
perform
end
end
context
'when there are ongoing and dead jobs'
do
it
'reschedules check'
do
allow
(
Gitlab
::
BackgroundMigration
).
to
receive
(
:exists?
)
.
with
(
'PopulateMergeRequestAssigneesTable'
)
.
and_return
(
true
)
allow
(
Gitlab
::
BackgroundMigration
).
to
receive
(
:dead_jobs?
)
.
with
(
'PopulateMergeRequestAssigneesTable'
)
.
and_return
(
true
)
expect
(
BackgroundMigrationWorker
).
to
receive
(
:perform_in
).
with
(
described_class
::
RESCHEDULE_DELAY
,
described_class
.
name
)
described_class
.
new
.
perform
end
end
context
'when there retrying jobs and no scheduled'
do
it
'reschedules check'
do
allow
(
Gitlab
::
BackgroundMigration
).
to
receive
(
:exists?
)
.
with
(
'PopulateMergeRequestAssigneesTable'
)
.
and_return
(
false
)
allow
(
Gitlab
::
BackgroundMigration
).
to
receive
(
:retrying_jobs?
)
.
with
(
'PopulateMergeRequestAssigneesTable'
)
.
and_return
(
true
)
expect
(
BackgroundMigrationWorker
).
to
receive
(
:perform_in
).
with
(
described_class
::
RESCHEDULE_DELAY
,
described_class
.
name
)
described_class
.
new
.
perform
end
end
end
context
'when there are no scheduled, or retrying or dead'
do
before
do
stub_feature_flags
(
multiple_merge_request_assignees:
false
)
end
it
'enables feature'
do
allow
(
Gitlab
::
BackgroundMigration
).
to
receive
(
:exists?
)
.
with
(
'PopulateMergeRequestAssigneesTable'
)
.
and_return
(
false
)
allow
(
Gitlab
::
BackgroundMigration
).
to
receive
(
:retrying_jobs?
)
.
with
(
'PopulateMergeRequestAssigneesTable'
)
.
and_return
(
false
)
allow
(
Gitlab
::
BackgroundMigration
).
to
receive
(
:dead_jobs?
)
.
with
(
'PopulateMergeRequestAssigneesTable'
)
.
and_return
(
false
)
described_class
.
new
.
perform
expect
(
Feature
.
enabled?
(
:multiple_merge_request_assignees
,
type: :licensed
)).
to
eq
(
true
)
end
end
context
'when there are only dead jobs'
do
it
'raises DeadJobsError error'
do
allow
(
Gitlab
::
BackgroundMigration
).
to
receive
(
:exists?
)
.
with
(
'PopulateMergeRequestAssigneesTable'
)
.
and_return
(
false
)
allow
(
Gitlab
::
BackgroundMigration
).
to
receive
(
:retrying_jobs?
)
.
with
(
'PopulateMergeRequestAssigneesTable'
)
.
and_return
(
false
)
allow
(
Gitlab
::
BackgroundMigration
).
to
receive
(
:dead_jobs?
)
.
with
(
'PopulateMergeRequestAssigneesTable'
)
.
and_return
(
true
)
expect
{
described_class
.
new
.
perform
}
.
to
raise_error
(
described_class
::
DeadJobsError
,
"Only dead background jobs in the queue for
#{
described_class
::
WORKER
}
"
)
end
end
end
spec/migrations/schedule_merge_request_assignees_migration_progress_check_spec.rb
deleted
100644 → 0
View file @
56d95d9a
# frozen_string_literal: true
require
'spec_helper'
require
Rails
.
root
.
join
(
'db'
,
'post_migrate'
,
'20190402224749_schedule_merge_request_assignees_migration_progress_check.rb'
)
RSpec
.
describe
ScheduleMergeRequestAssigneesMigrationProgressCheck
do
describe
'#up'
do
it
'schedules MergeRequestAssigneesMigrationProgressCheck background job'
do
expect
(
BackgroundMigrationWorker
).
to
receive
(
:perform_async
)
.
with
(
described_class
::
MIGRATION
)
.
and_call_original
subject
.
up
end
end
end
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