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
40b0280f
Commit
40b0280f
authored
Mar 06, 2017
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Parallelise the gitlab:elastic:index_database Rake task
parent
e0c158d7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
7 deletions
+25
-7
changelogs/unreleased-ee/1839-parallelise-rake-gitlab-elastic-index_database.yml
...e/1839-parallelise-rake-gitlab-elastic-index_database.yml
+4
-0
lib/tasks/gitlab/elastic.rake
lib/tasks/gitlab/elastic.rake
+21
-7
No files found.
changelogs/unreleased-ee/1839-parallelise-rake-gitlab-elastic-index_database.yml
0 → 100644
View file @
40b0280f
---
title
:
Parallelise the gitlab:elastic:index_database Rake task
merge_request
:
1361
author
:
lib/tasks/gitlab/elastic.rake
View file @
40b0280f
...
...
@@ -58,12 +58,23 @@ namespace :gitlab do
end
end
desc
"GitLab | Elasticsearch | Index all database objects"
task
index_database: :environment
do
[
Project
,
Issue
,
MergeRequest
,
Snippet
,
Note
,
Milestone
].
each
do
|
klass
|
print
"Indexing
#{
klass
}
records... "
case
klass
.
to_s
INDEXABLE_CLASSES
=
{
"Project"
=>
"index_projects"
,
"Issue"
=>
"index_issues"
,
"MergeRequest"
=>
"index_merge_requests"
,
"Snippet"
=>
"index_snippets"
,
"Note"
=>
"index_notes"
,
"Milestone"
=>
"index_milestones"
,
}.
freeze
INDEXABLE_CLASSES
.
each
do
|
klass_name
,
task_name
|
task
task_name
=>
:environment
do
logger
=
Logger
.
new
(
STDOUT
)
logger
.
info
(
"Indexing
#{
klass_name
.
pluralize
}
..."
)
klass
=
Kernel
.
const_get
(
klass_name
)
case
klass_name
when
'Note'
Note
.
searchable
.
import_with_parent
when
'Project'
,
'Snippet'
...
...
@@ -72,10 +83,13 @@ namespace :gitlab do
klass
.
import_with_parent
end
puts
"done"
.
color
(
:green
)
logger
.
info
(
"Indexing
#{
klass_name
.
pluralize
}
... "
+
"done"
.
color
(
:green
)
)
end
end
desc
"GitLab | Elasticsearch | Index all database objects"
multitask
index_database:
INDEXABLE_CLASSES
.
values
desc
"GitLab | Elasticsearch | Create empty index"
task
create_empty_index: :environment
do
Gitlab
::
Elastic
::
Helper
.
create_empty_index
...
...
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