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
1b36f9ab
Commit
1b36f9ab
authored
May 21, 2021
by
Terri Chu
Committed by
Olena Horal-Koretska
May 21, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only check Elasticsearch index_exists? when changing Advanced Search settings
parent
0fc3ec38
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
27 additions
and
7 deletions
+27
-7
ee/app/controllers/admin/elasticsearch_controller.rb
ee/app/controllers/admin/elasticsearch_controller.rb
+6
-1
ee/app/services/ee/application_settings/update_service.rb
ee/app/services/ee/application_settings/update_service.rb
+1
-1
ee/app/views/admin/application_settings/_elasticsearch_form.html.haml
.../admin/application_settings/_elasticsearch_form.html.haml
+2
-2
ee/changelogs/unreleased/321742-elasticsearch-index_exists-check-should-only-happen-when-changi.yml
...rch-index_exists-check-should-only-happen-when-changi.yml
+5
-0
ee/spec/controllers/admin/elasticsearch_controller_spec.rb
ee/spec/controllers/admin/elasticsearch_controller_spec.rb
+3
-3
ee/spec/services/application_settings/update_service_spec.rb
ee/spec/services/application_settings/update_service_spec.rb
+10
-0
No files found.
ee/app/controllers/admin/elasticsearch_controller.rb
View file @
1b36f9ab
...
...
@@ -68,6 +68,11 @@ class Admin::ElasticsearchController < Admin::ApplicationController
end
def
trigger_reindexing_params
params
.
require
(
:elastic_reindexing_task
).
permit
(
%i(max_slices_running slice_multiplier)
)
permitted_params
=
params
.
require
(
:elastic_reindexing_task
).
permit
(
:elasticsearch_max_slices_running
,
:elasticsearch_slice_multiplier
)
trigger_reindexing_params
=
{}
trigger_reindexing_params
[
:max_slices_running
]
=
permitted_params
[
:elasticsearch_max_slices_running
]
if
permitted_params
.
has_key?
(
:elasticsearch_max_slices_running
)
trigger_reindexing_params
[
:slice_multiplier
]
=
permitted_params
[
:elasticsearch_slice_multiplier
]
if
permitted_params
.
has_key?
(
:elasticsearch_slice_multiplier
)
trigger_reindexing_params
end
end
ee/app/services/ee/application_settings/update_service.rb
View file @
1b36f9ab
...
...
@@ -23,7 +23,7 @@ module EE
elasticsearch_project_ids
=
params
.
delete
(
:elasticsearch_project_ids
)
if
result
=
super
find_or_create_elasticsearch_index
find_or_create_elasticsearch_index
if
params
.
keys
.
any?
{
|
key
|
key
.
to_s
.
start_with?
(
'elasticsearch'
)
}
update_elasticsearch_containers
(
ElasticsearchIndexedNamespace
,
elasticsearch_namespace_ids
)
update_elasticsearch_containers
(
ElasticsearchIndexedProject
,
elasticsearch_project_ids
)
update_elasticsearch_index_settings
(
number_of_replicas:
elasticsearch_replicas
,
number_of_shards:
elasticsearch_shards
)
...
...
ee/app/views/admin/application_settings/_elasticsearch_form.html.haml
View file @
1b36f9ab
...
...
@@ -239,7 +239,7 @@
%fieldset
.form-group
=
f
.
label
:slice_multiplier
,
_
(
'Slice multiplier'
),
class:
'label-bold'
=
f
.
number_field
:slice_multiplier
,
class:
'form-control gl-form-input'
,
value:
@elasticsearch_reindexing_task
.
slice_multiplier
=
f
.
number_field
:
elasticsearch_
slice_multiplier
,
class:
'form-control gl-form-input'
,
value:
@elasticsearch_reindexing_task
.
slice_multiplier
.form-text.gl-text-gray-600.gl-mt-0
-
slice_multiplier_link_url
=
help_page_path
(
'integration/elasticsearch.md'
,
anchor:
'slice-multiplier'
)
-
slice_multiplier_link_start
=
'<a href="%{url}" target="_blank" rel="noopener noreferrer">'
.
html_safe
%
{
url:
slice_multiplier_link_url
}
...
...
@@ -247,7 +247,7 @@
.form-group
=
f
.
label
:max_slices_running
,
_
(
'Maximum running slices'
),
class:
'label-bold'
=
f
.
number_field
:max_slices_running
,
class:
'form-control gl-form-input'
,
value:
@elasticsearch_reindexing_task
.
max_slices_running
=
f
.
number_field
:
elasticsearch_
max_slices_running
,
class:
'form-control gl-form-input'
,
value:
@elasticsearch_reindexing_task
.
max_slices_running
.form-text.gl-text-gray-600.gl-mt-0
-
max_slices_running_link_url
=
help_page_path
(
'integration/elasticsearch.md'
,
anchor:
'maximum-running-slices'
)
-
max_slices_running_link_start
=
'<a href="%{url}" target="_blank" rel="noopener noreferrer">'
.
html_safe
%
{
url:
max_slices_running_link_url
}
...
...
ee/changelogs/unreleased/321742-elasticsearch-index_exists-check-should-only-happen-when-changi.yml
0 → 100644
View file @
1b36f9ab
---
title
:
Only check index status if modifying Advanced Search form
merge_request
:
62135
author
:
type
:
fixed
ee/spec/controllers/admin/elasticsearch_controller_spec.rb
View file @
1b36f9ab
...
...
@@ -50,7 +50,7 @@ RSpec.describe Admin::ElasticsearchController do
expect
(
task
).
to
receive
(
:save
).
and_return
(
true
)
end
post
:trigger_reindexing
,
params:
{
elastic_reindexing_task:
{
max_slices_running:
60
,
slice_multiplier:
2
}
}
post
:trigger_reindexing
,
params:
{
elastic_reindexing_task:
{
elasticsearch_max_slices_running:
60
,
elasticsearch_
slice_multiplier:
2
}
}
expect
(
controller
).
to
set_flash
[
:notice
].
to
include
(
'reindexing triggered'
)
expect
(
response
).
to
redirect_to
advanced_search_admin_application_settings_path
(
anchor:
'js-elasticsearch-reindexing'
)
...
...
@@ -59,14 +59,14 @@ RSpec.describe Admin::ElasticsearchController do
it
'does not create a reindexing task if there is another one'
do
allow
(
Elastic
::
ReindexingTask
).
to
receive
(
:current
).
and_return
(
build
(
:elastic_reindexing_task
))
post
:trigger_reindexing
,
params:
{
elastic_reindexing_task:
{
max_slices_running:
60
,
slice_multiplier:
2
}
}
post
:trigger_reindexing
,
params:
{
elastic_reindexing_task:
{
elasticsearch_max_slices_running:
60
,
elasticsearch_
slice_multiplier:
2
}
}
expect
(
controller
).
to
set_flash
[
:warning
].
to
include
(
'already in progress'
)
expect
(
response
).
to
redirect_to
advanced_search_admin_application_settings_path
(
anchor:
'js-elasticsearch-reindexing'
)
end
it
'does not create a reindexing task if a required param is nil'
do
post
:trigger_reindexing
,
params:
{
elastic_reindexing_task:
{
max_slices_running:
nil
,
slice_multiplier:
2
}
}
post
:trigger_reindexing
,
params:
{
elastic_reindexing_task:
{
elasticsearch_max_slices_running:
nil
,
elasticsearch_
slice_multiplier:
2
}
}
expect
(
controller
).
to
set_flash
[
:alert
].
to
include
(
'Elasticsearch reindexing was not started'
)
expect
(
response
).
to
redirect_to
advanced_search_admin_application_settings_path
(
anchor:
'js-elasticsearch-reindexing'
)
...
...
ee/spec/services/application_settings/update_service_spec.rb
View file @
1b36f9ab
...
...
@@ -63,6 +63,16 @@ RSpec.describe ApplicationSettings::UpdateService do
expect
{
service
.
execute
}.
not_to
raise_error
end
end
context
'when modifying a non Advanced Search setting'
do
let
(
:opts
)
{
{
repository_size_limit:
'100'
}
}
it
'does not check index_exists'
do
expect
(
helper
).
not_to
receive
(
:create_empty_index
)
service
.
execute
end
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