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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
dfef5437
Commit
dfef5437
authored
Feb 16, 2018
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use a helper to schedule pipeline stages migration
parent
2ee20d5a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
7 deletions
+6
-7
db/post_migrate/20180212101928_schedule_build_stage_migration.rb
..._migrate/20180212101928_schedule_build_stage_migration.rb
+6
-5
lib/gitlab/background_migration/migrate_build_stage.rb
lib/gitlab/background_migration/migrate_build_stage.rb
+0
-2
No files found.
db/post_migrate/20180212101928_schedule_build_stage_migration.rb
View file @
dfef5437
...
...
@@ -3,7 +3,7 @@ class ScheduleBuildStageMigration < ActiveRecord::Migration
DOWNTIME
=
false
MIGRATION
=
'MigrateBuildStage'
.
freeze
BATCH_SIZE
=
8
00
BATCH_SIZE
=
5
00
disable_ddl_transaction!
...
...
@@ -15,10 +15,11 @@ class ScheduleBuildStageMigration < ActiveRecord::Migration
def
up
disable_statement_timeout
Build
.
where
(
'stage_id IS NULL'
).
each_batch
(
of:
BATCH_SIZE
)
do
|
builds
,
index
|
builds
.
pluck
(
'MIN(id)'
,
'MAX(id)'
).
first
.
tap
do
|
range
|
BackgroundMigrationWorker
.
perform_in
(
index
*
5
.
minutes
,
MIGRATION
,
range
)
end
Build
.
where
(
'stage_id IS NULL'
).
tap
do
|
relation
|
queue_background_migration_jobs_by_range_at_intervals
(
relation
,
MIGRATION
,
5
.
minutes
,
batch_size:
BATCH_SIZE
)
end
end
...
...
lib/gitlab/background_migration/migrate_build_stage.rb
View file @
dfef5437
...
...
@@ -35,8 +35,6 @@ module Gitlab
end
def
perform
(
start_id
,
stop_id
)
# TODO, statement timeout?
stages
=
Migratable
::
Build
.
where
(
'stage_id IS NULL'
)
.
where
(
'id BETWEEN ? AND ?'
,
start_id
,
stop_id
)
.
map
{
|
build
|
build
.
ensure_stage!
}
...
...
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