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
e2aa3325
Commit
e2aa3325
authored
Feb 12, 2019
by
Felipe Artur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve batch size
parent
362d56e6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
11 deletions
+12
-11
app/models/concerns/issuable_states.rb
app/models/concerns/issuable_states.rb
+6
-6
app/models/merge_request.rb
app/models/merge_request.rb
+0
-1
db/migrate/20190211131150_add_state_id_to_issuables.rb
db/migrate/20190211131150_add_state_id_to_issuables.rb
+6
-4
No files found.
app/models/concerns/issuable_states.rb
View file @
e2aa3325
...
...
@@ -2,7 +2,7 @@
# == IssuableStates concern
#
# Defines stat
uses shared by issuables which are persisted on state
column
# Defines stat
es shared by issuables which are persisted on state_id
column
# using the state machine.
#
# Used by EE::Epic, Issue and MergeRequest
...
...
@@ -14,10 +14,6 @@ module IssuableStates
# Check MergeRequest::AVAILABLE_STATES
AVAILABLE_STATES
=
{
opened:
1
,
closed:
2
}.
freeze
included
do
before_save
:set_state_id
end
class_methods
do
def
states
@states
||=
OpenStruct
.
new
(
self
::
AVAILABLE_STATES
)
...
...
@@ -26,7 +22,11 @@ module IssuableStates
# The state:string column is being migrated to state_id:integer column
# This is a temporary hook to populate state_id column with new values
# and can be removed after the complete migration is done.
# and can be removed after the state column is removed.
included
do
before_save
:set_state_id
end
def
set_state_id
return
if
state
.
nil?
||
state
.
empty?
...
...
app/models/merge_request.rb
View file @
e2aa3325
...
...
@@ -22,7 +22,6 @@ class MergeRequest < ActiveRecord::Base
self
.
reactive_cache_lifetime
=
10
.
minutes
SORTING_PREFERENCE_FIELD
=
:merge_requests_sort
MERGE_REQUEST_STATES
=
AVAILABLE_STATES
=
AVAILABLE_STATES
.
merge
(
merged:
3
,
locked:
4
).
freeze
ignore_column
:locked_at
,
...
...
db/migrate/20190211131150_add_state_id_to_issuables.rb
View file @
e2aa3325
...
...
@@ -5,10 +5,12 @@ class AddStateIdToIssuables < ActiveRecord::Migration[5.0]
DOWNTIME
=
false
MIGRATION
=
'SyncIssuablesStateId'
.
freeze
# TODO - find out how many issues and merge requests in production
# to adapt the batch size and delay interval
# Keep in mind that the migration will be scheduled for issues and merge requests.
BATCH_SIZE
=
5000
# 2019-02-12 Gitlab.com issuable numbers
# issues count: 13587305
# merge requests count: 18925274
# Using this 50000 as batch size should take around 13 hours
# to migrate both issues and merge requests
BATCH_SIZE
=
50000
DELAY_INTERVAL
=
5
.
minutes
.
to_i
class
Issue
<
ActiveRecord
::
Base
...
...
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