BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
7b7fb754
Commit
7b7fb754
authored
Sep 14, 2017
by
Michael Kozono
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce batch size
…to stay within our query timeout of 60s. Also reduce the job interval to keep the same overall migration time of ~3.3 days.
parent
c9232087
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
5 deletions
+7
-5
20170907170235_delete_conflicting_redirect_routes.rb
...rate/20170907170235_delete_conflicting_redirect_routes.rb
+3
-1
delete_conflicting_redirect_routes_spec.rb
spec/migrations/delete_conflicting_redirect_routes_spec.rb
+4
-4
No files found.
db/post_migrate/20170907170235_delete_conflicting_redirect_routes.rb
View file @
7b7fb754
...
...
@@ -6,6 +6,8 @@ class DeleteConflictingRedirectRoutes < ActiveRecord::Migration
DOWNTIME
=
false
MIGRATION
=
'DeleteConflictingRedirectRoutesRange'
.
freeze
BATCH_SIZE
=
200
# At 200, I expect under 20s per batch, which is under our query timeout of 60s.
DELAY_INTERVAL
=
12
.
seconds
disable_ddl_transaction!
...
...
@@ -18,7 +20,7 @@ class DeleteConflictingRedirectRoutes < ActiveRecord::Migration
def
up
say
opening_message
queue_background_migration_jobs_by_range_at_intervals
(
Route
,
MIGRATION
,
1
.
minute
)
queue_background_migration_jobs_by_range_at_intervals
(
Route
,
MIGRATION
,
DELAY_INTERVAL
,
batch_size:
BATCH_SIZE
)
end
def
down
...
...
spec/migrations/delete_conflicting_redirect_routes_spec.rb
View file @
7b7fb754
...
...
@@ -10,7 +10,7 @@ describe DeleteConflictingRedirectRoutes, :migration, :sidekiq do
end
before
do
stub_const
(
"
Gitlab::Database::MigrationHelpers::BACKGROUND_MIGRATION_
BATCH_SIZE"
,
2
)
stub_const
(
"
DeleteConflictingRedirectRoutes::
BATCH_SIZE"
,
2
)
stub_const
(
"Gitlab::Database::MigrationHelpers::BACKGROUND_MIGRATION_JOB_BUFFER_SIZE"
,
2
)
routes
.
create!
(
id:
1
,
source_id:
1
,
source_type:
'Namespace'
,
path:
'foo1'
)
...
...
@@ -38,11 +38,11 @@ describe DeleteConflictingRedirectRoutes, :migration, :sidekiq do
migrate!
expect
(
BackgroundMigrationWorker
.
jobs
[
0
][
'args'
]).
to
eq
([
described_class
::
MIGRATION
,
[
1
,
2
]])
expect
(
BackgroundMigrationWorker
.
jobs
[
0
][
'at'
]).
to
eq
(
1
.
minute
.
from_now
.
to_f
)
expect
(
BackgroundMigrationWorker
.
jobs
[
0
][
'at'
]).
to
eq
(
1
2
.
seconds
.
from_now
.
to_f
)
expect
(
BackgroundMigrationWorker
.
jobs
[
1
][
'args'
]).
to
eq
([
described_class
::
MIGRATION
,
[
3
,
4
]])
expect
(
BackgroundMigrationWorker
.
jobs
[
1
][
'at'
]).
to
eq
(
2
.
minute
s
.
from_now
.
to_f
)
expect
(
BackgroundMigrationWorker
.
jobs
[
1
][
'at'
]).
to
eq
(
2
4
.
second
s
.
from_now
.
to_f
)
expect
(
BackgroundMigrationWorker
.
jobs
[
2
][
'args'
]).
to
eq
([
described_class
::
MIGRATION
,
[
5
,
5
]])
expect
(
BackgroundMigrationWorker
.
jobs
[
2
][
'at'
]).
to
eq
(
3
.
minute
s
.
from_now
.
to_f
)
expect
(
BackgroundMigrationWorker
.
jobs
[
2
][
'at'
]).
to
eq
(
3
6
.
second
s
.
from_now
.
to_f
)
expect
(
BackgroundMigrationWorker
.
jobs
.
size
).
to
eq
3
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