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
3c86b08a
Commit
3c86b08a
authored
Jan 03, 2020
by
Dylan Griffith
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add logging to error in Elastic::IndexRecordService
parent
f91c27a2
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
1 deletion
+16
-1
ee/app/services/elastic/index_record_service.rb
ee/app/services/elastic/index_record_service.rb
+8
-1
ee/spec/services/elastic/index_record_service_spec.rb
ee/spec/services/elastic/index_record_service_spec.rb
+8
-0
No files found.
ee/app/services/elastic/index_record_service.rb
View file @
3c86b08a
...
@@ -22,13 +22,16 @@ module Elastic
...
@@ -22,13 +22,16 @@ module Elastic
update_issue_notes
(
record
,
options
[
"changed_fields"
])
if
record
.
class
==
Issue
update_issue_notes
(
record
,
options
[
"changed_fields"
])
if
record
.
class
==
Issue
true
true
rescue
Elasticsearch
::
Transport
::
Transport
::
Errors
::
NotFound
,
ActiveRecord
::
RecordNotFound
rescue
Elasticsearch
::
Transport
::
Transport
::
Errors
::
NotFound
,
ActiveRecord
::
RecordNotFound
=>
e
# These errors can happen in several cases, including:
# These errors can happen in several cases, including:
# - A record is updated, then removed before the update is handled
# - A record is updated, then removed before the update is handled
# - Indexing is enabled, but not every item has been indexed yet - updating
# - Indexing is enabled, but not every item has been indexed yet - updating
# and deleting the un-indexed records will raise exception
# and deleting the un-indexed records will raise exception
#
#
# We can ignore these.
# We can ignore these.
logger
.
error
(
message:
'elastic_index_record_service_caught_exception'
,
error_class:
e
.
class
.
name
,
error_message:
e
.
message
)
true
true
end
end
...
@@ -88,5 +91,9 @@ module Elastic
...
@@ -88,5 +91,9 @@ module Elastic
ids
=
errors
.
map
{
|
error
|
error
[
'index'
][
'_id'
][
/_(\d+)$/
,
1
]
}
ids
=
errors
.
map
{
|
error
|
error
[
'index'
][
'_id'
][
/_(\d+)$/
,
1
]
}
association
.
id_in
(
ids
).
es_import
(
options
)
association
.
id_in
(
ids
).
es_import
(
options
)
end
end
def
logger
@logger
||=
::
Gitlab
::
Elasticsearch
::
Logger
.
build
end
end
end
end
end
ee/spec/services/elastic/index_record_service_spec.rb
View file @
3c86b08a
...
@@ -50,6 +50,14 @@ describe Elastic::IndexRecordService, :elastic do
...
@@ -50,6 +50,14 @@ describe Elastic::IndexRecordService, :elastic do
Gitlab
::
Elastic
::
Helper
.
refresh_index
Gitlab
::
Elastic
::
Helper
.
refresh_index
end
.
to
change
{
Elasticsearch
::
Model
.
search
(
'new'
).
records
.
size
}.
by
(
1
)
end
.
to
change
{
Elasticsearch
::
Model
.
search
(
'new'
).
records
.
size
}.
by
(
1
)
end
end
it
'ignores Elasticsearch::Transport::Transport::Errors::NotFound errors'
do
object
=
create
(
type
)
allow
(
object
.
__elasticsearch__
).
to
receive
(
:index_document
).
and_raise
(
Elasticsearch
::
Transport
::
Transport
::
Errors
::
NotFound
)
expect
(
subject
.
execute
(
object
,
true
)).
to
eq
(
true
)
end
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